# Contract

[Contract](oneflow-platform-glossary#contract) is the main working entity of Oneflow, to which all other contract content, settings, data, etc., are connected.

In addition to being the central point of connection, the contract entity itself contains quite a lot of data described further in this section.

# Contract attributes

The table below contains the list of all attributes available for each contract.

| Attribute                     | Type                                                            | Description                                                                                                                                                                       |
| :---------------------------- | :-------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| \_links                       | [object](type-reference#base-types)                             | Contains links to endpoints associated with the parent object. See [Links](links#links).                                                                                          |
| \_private                     | [object](type-reference#base-types)                             | Contains attributes that are only visible to the party of the current user. See [Private](contract#private).                                                                      |
| \_private\_ownerside          | [object](type-reference#base-types)                             | Contains attributes that are only visible to the owner-side party. See [Private ownerside](contract#private-ownerside).                                                           |
| \_permissions                 | [object](type-reference#base-types)                             | Contains permissions of the current user for various operations possible on the contract. See [Permissions](contract#permissions).                                                |
| attachment\_file\_groups      | [array](type-reference#base-types)                              | Contains the list of attachments in the contract. See [Attachment file groups](contract#attachment-file-groups).                                                                  |
| available\_options            | [object](type-reference#base-types)                             | Gives information about the capabilities of the contract. See [Available options](contract#available-options).                                                                    |
| data\_fields                  | [array](type-reference#base-types)                              | The list of data fields that exist in the contract template type. If there are no data fields in the contract template type, the list will be empty. See [Data field](data-field) |
| id                            | [integer(signed\_integer\_id)](type-reference#subtypes-for-int) | The unique ID of the contract.                                                                                                                                                    |
| lifecycle\_state              | [object](type-reference#base-types)                             | Keeps track of the contract status. See [Lifecycle state](contract#lifecycle-state).                                                                                              |
| lifecycle\_settings           | [object](type-reference#base-types)                             | Contains settings available for the lifecycle. See [Lifecycle settings](contract#lifecycle-settings).                                                                             |
| links                         | [array](type-reference#base-types)                              | The list of linked contracts with their link types. See [Links](contract#links).                                                                                                  |
| parties                       | [array](type-reference#base-types)                              | The list of parties in the contract, representing companies, organizations, individuals, government departments, etc. See [Party](party).                                         |
| pdf\_file\_groups             | [array](type-reference#base-types)                              | Contains the list of PDFs in the contract. See [PDF file groups](contract#pdf-file-groups).                                                                                       |
| product\_groups               | [array](type-reference#base-types)                              | The list of [product groups](oneflow-platform-glossary#product-group). See [Product group](https://developer.oneflow.com/docs/product-group).                                                                    |
| published\_time               | [string(datetime)](type-reference#subtypes-for-str)             | The time the contract was published.                                                                                                                                              |
| signing\_period\_expiry\_time | [string(datetime)](type-reference#subtypes-for-str)             | The time during which a [signatory](oneflow-platform-glossary#signatory) can sign the contract.                                                                                   |
| state                         | [string(enum)](type-reference#subtypes-for-str)                 | Indicates the status of the contract in the signing process. See [State](contract#state).                                                                                         |
| state\_updated\_time          | [string(datetime)](type-reference#subtypes-for-str)             | Time of the last update of the contract status.                                                                                                                                   |
| updated\_time                 | [string(datetime)](type-reference#subtypes-for-str)             | Time of the last update of the contract.                                                                                                                                          |

## Private

Some of the contract data is classified as private and only visible to the [party owning](oneflow-platform-glossary#owner-side-party) the data.

> 📘 Note:
>
> Private data exists in multiple attribute values, one for each party, where each party can only see its own copy.

The `_private` object contains attributes that are visible only to a specific set of parties.

| Attribute                   | Type                                   | Description                                                                                         |
| :-------------------------- | :------------------------------------- | :-------------------------------------------------------------------------------------------------- |
| name                        | [string](type-reference#base-types)    | The name of the contract.                                                                           |
| signing\_period\_expiration | [object](type-reference#base-types)    | The deadline for signing the contract. See [Signing period expiration](#signing-period-expiration). |
| value                       | [object](type-reference#base-types)    | The deal size of a contract expressed in monetary value. See [Value](#value).                       |
| workspace\_id               | [int](type-reference#subtypes-for-int) | The ID of the workspace that owns the template used to create the contract.                         |

### Signing period expiration

The `signing_period_expiration` object contains attributes related to the contract signing deadline.

There are three types of the `signing_period_expiration` setting:

* never
* days\_after\_publish
* fixed\_date.

> 📘 Note:
>
> You can specify the `days_after_published` type only before the contract is published, and once the contract is published, the system will convert it to `fixed_date`.

<Table align={["left","left","left","left"]}>
  <thead>
    <tr>
      <th>
        Attribute
      </th>

      <th>
        Type
      </th>

      <th>
        Description
      </th>

      <th>
        Required
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        type
      </td>

      <td>
        [string(enum)](type-reference#subtypes-for-str)
      </td>

      <td>
        The type of expiration.\
        Can be:  

        * `never`  
        * `days_after_publish`  
        * `fixed_date`.
      </td>

      <td>
        Always.
      </td>
    </tr>

    <tr>
      <td>
        expire\_days\_after\_publish
      </td>

      <td>
        [int](type-reference#subtypes-for-int)
      </td>

      <td>
        The number of days the contract is available for signing after it has been published.
      </td>

      <td>
        When `type` == `days_after_publish`.
      </td>
    </tr>

    <tr>
      <td>
        expire\_date
      </td>

      <td>
        [string(date)](type-reference#subtypes-for-str)
      </td>

      <td>
        The final day the contract is valid for signing.
      </td>

      <td>
        When `type` == `fixed_date`.
      </td>
    </tr>
  </tbody>
</Table>

### Value

The `value` object contains all attributes related to the contract value.

| Attribute | Type                                                | Description                                                                                                |
| :-------- | :-------------------------------------------------- | :--------------------------------------------------------------------------------------------------------- |
| amount    | [amount](type-reference#subtypes-for-str)           | Amount indicating the total value of the contract.                                                         |
| currency  | [string(currency)](type-reference#subtypes-for-str) | The currency of the amount. The currency is inherited from the workspace in which the contract is located. |

## Private ownerside

The `_private_ownerside` object contains attributes that are only visible to the [owner-side party](oneflow-platform-glossary#owner-side-party).  The owner-side party is the [party](oneflow-platform-glossary#party) that created the contract.

| Attribute          | Type                                                | Description                                          |
| :----------------- | :-------------------------------------------------- | :--------------------------------------------------- |
| created\_time      | [string(datetime)](type-reference#subtypes-for-str) | The time the contract was created.                   |
| template\_id       | [int](type-reference#subtypes-for-int)              | The ID of the template used to create the contract.  |
| template\_type\_id | [int](type-reference#subtypes-for-int)              | The ID of the template type the template belongs to. |

## Permissions

The `_permissions` object contains permissions for various operations possible within the contract. The permission format is ''contract:'' followed by a specific operation, such as ''contract:create.'' Currently, only the delete contract permission is displayed.

> 📘 Note:
>
> Permissions are always set for the current user. If the permission is set to `true`, the user will be able to perform the specified operation; otherwise, the operation will be disabled for the current user.

| Attribute       | Type                                 | Description                                                                                  |
| :-------------- | :----------------------------------- | :------------------------------------------------------------------------------------------- |
| contract:delete | [boolean](type-reference#base-types) | Indicates whether the [user](oneflow-platform-glossary#user) is allowed to delete contracts. |

## Attachment file groups

The `attachment_file_groups` contain the list of files uploaded to the [contract](oneflow-platform-glossary#contract) as [attachments](oneflow-platform-glossary#attachment).

### Attachment file groups attributes

The table below contains the list of all the attributes available for a Attachment file groups within a contract.

| Attribute            | Type                                                            | Description                                                                                                                                                                              |
| :------------------- | :-------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| \_private\_ownerside | [object](type-reference#base-types)                             | The attachment file group attributes that are visible only to the owner-side party. See [Private owner-side attachment file groups](contract#private-owner-side-attachment-file-groups). |
| files                | [array](type-reference#base-types)                              | The list of attachments in the contract.                                                                                                                                                 |
| id                   | [integer(signed\_integer\_id)](type-reference#subtypes-for-int) | The ID of the attachment file group.                                                                                                                                                     |
| type                 | [string(enum)](type-reference#subtypes-for-str)                 | The file uploaded to the contract as an attachment.                                                                                                                                      |

#### Private owner-side attachment file groups

| Attribute     | Type                                                | Description                                                        |
| :------------ | :-------------------------------------------------- | :----------------------------------------------------------------- |
| created\_time | [string(datetime)](type-reference#subtypes-for-str) | The date and time when the attachment file group was created.      |
| updated\_time | [string(datetime)](type-reference#subtypes-for-str) | The date and time when the attachment file group was last updated. |

#### Files

| Attribute            | Type                                                            | Description                                                                                                                                                                                                                                           |
| :------------------- | :-------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| \_private\_ownerside | [object](type-reference#base-types)                             | The attachment file group  attributes that are visible only to the owner-side party. See [Private owner-side attachment file groups](contract#private-owner-side-attachment-file-groups).                                                             |
| extension            | [string(enum)](type-reference#subtypes-for-str)                 | Indicates the attached file extension (see [Attachments](oneflow-platform-glossary#attachment)).  See also, [Contract file extensions](contract-file#contract-file-extensions).                                                                       |
| id                   | [integer(signed\_integer\_id)](type-reference#subtypes-for-int) | The ID of the attachment file.                                                                                                                                                                                                                        |
| name                 | [string](type-reference#base-types)                             | If the file name contains only non-US-ASCII characters, the default filename will be generated as `type_id.extension`. For example, a file named `*-+%&.png` will be changed to `attachment_123.png`, where `123` is the value of the `id` attribute. |
| size                 | [integer](type-reference#base-types)                            | The size of the attachment.                                                                                                                                                                                                                           |

## Available options

The `available_options` object gives information about the capabilities of the contract, such as which [delivery channels](oneflow-platform-glossary#delivery-channel), [sign methods](oneflow-platform-glossary#sign-method), and [two-step authentication methods](contract#two-step-authentication-methods) are available for the contract and lists the data types the contract can receive.

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>
        Attribute
      </th>

      <th>
        Type
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        can\_receive\_attachments
      </td>

      <td>
        [boolean](type-reference#base-types)
      </td>

      <td>
        Indicates if [attachments](oneflow-platform-glossary#attachment) can be uploaded to the contract via API.  

        Using API, you can only add attachments when there is only one **Attachments** section in the contract. In this case, the `true` value indicates that the contract has precisely one **Attachments** section, and you can attach files to it. Otherwise, the value will be `false`, which means that there are no **Attachments** sections in the contract, or there are several of them, and, therefore, attachments cannot be added to the contract.
      </td>
    </tr>

    <tr>
      <td>
        can\_receive\_expanded\_pdf
      </td>

      <td>
        [boolean](type-reference#base-types)
      </td>

      <td>
        Indicates if a [PDF document](oneflow-platform-glossary#pdf-document) can be uploaded to the contract via API.  

        Using the API, you can only add a PDF document when there is only one **PDF document** section in the contract. In this case, the `true` value indicates that the contract has precisely one **PDF document** section, and you can add a PDF document to it. Otherwise, the value will be `false`, which means that there are no **PDF document** sections in the contract, or there are several of them, and, therefore, the PDF document cannot be added to the contract.
      </td>
    </tr>

    <tr>
      <td>
        can\_receive\_products
      </td>

      <td>
        [boolean](type-reference#base-types)
      </td>

      <td>
        Indicates if [products](oneflow-platform-glossary#product) can be added to the contract via API.  

        Using the API, you can add products when there are one or more **Product table** sections in the contract. In this case, the `true` value indicates that the contract contains one or more **Product table** sections, and you can add products to it. Otherwise, the value will be `false`, which means that there are no **Product table** sections in the contract, and, therefore, products cannot be added to the contract.
      </td>
    </tr>

    <tr>
      <td>
        delivery\_channels
      </td>

      <td>
        [array](type-reference#base-types)\[[object](type-reference#base-types)]
      </td>

      <td>
        Indicates the available methods by which the contract can be delivered to its participants. See [Delivery channels](contract#delivery-channels).
      </td>
    </tr>

    <tr>
      <td>
        sign\_methods
      </td>

      <td>
        [array](type-reference#base-types)\[[object](type-reference#base-types)]
      </td>

      <td>
        Shows available methods of signing contracts. See [Sign methods](contract#sign-methods).
      </td>
    </tr>

    <tr>
      <td>
        two\_step\_authentication\_methods
      </td>

      <td>
        [array](type-reference#base-types)\[[object](type-reference#base-types)]
      </td>

      <td>
        Shows available two-step authentication methods. See [Two-step authentication methods](#two-step-authentication-methods).
      </td>
    </tr>
  </tbody>
</Table>

### Delivery channels

The `delivery_channels` array of objects indicates the available methods by which the contract can be delivered to its [participants](oneflow-platform-glossary#participant).

| Attribute                         | Type                                                                     | Description                                                                                                                                                                                                                         |
| :-------------------------------- | :----------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| name                              | [string](type-reference#base-types)                                      | The name of the delivery channel.  See [Delivery channel name](contract#delivery-channel-name).                                                                                                                                     |
| preferred                         | [boolean](type-reference#base-types)                                     | Indicates which delivery channel has been set as preferred by the template designer.                                                                                                                                                |
| required\_participant\_attributes | [array](type-reference#base-types)\[[string](type-reference#base-types)] | Indicates the attributes required by any participant depending on the selected delivery channel. For example, the SMS delivery channel  requires that the participant must have a phone number. All listed attributes are required. |

The table below shows what attributes and the contract signing methods are required for a [participant](/docs/participant), depending on the selected delivery channel method.\
All attributes marked with \* are required.\
It is required to use one of the available methods marked with \*\*.

| Method          | Required participant attributes | Allowed sign methods                                          |
| :-------------- | :------------------------------ | :------------------------------------------------------------ |
| email           | email\*                         | All listed [here](#sign-methods).\*\*                         |
| none            | -\*                             | All listed [here](#sign-methods).\*\*                         |
| same\_device    | sign\_method\*                  | All listed [here](#sign-methods) except `standard_esign`.\*\* |
| sms             | phone\_number\*                 | All listed [here](#sign-methods).\*\*                         |
| email\_and\_sms | email and phone\_number\*       | All listed [here](#sign-methods).\*\*                         |

> 📘 Note:
>
> For a free plan account, you can select only `email` and `none` as `delivery_channel` method and  only `standard_esign` as `sign_method`when adding a counterparty participant.

#### Delivery channel name

The table below displays all methods available for the `delivery_channels` object `name` attribute.

| Channel         | Description                                                                                                                                                                                                                                                                                                   |
| :-------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| email           | The [counterparty](oneflow-platform-glossary#counterparty) will receive an email with a link to the contract.                                                                                                                                                                                                 |
| sms             | The counterparty will receive an SMS with a link to the contract.                                                                                                                                                                                                                                             |
| email\_and\_sms | The counterparty will receive an email and an SMS with a link to the contract.                                                                                                                                                                                                                                |
| same\_device    | The counterparty views and signs the contract on the same device (computer, tablet, phone, etc.) used by the owner-side party to create the contract. This may be the case for door-to-door sellers or similar. Please, contact your customer success manager for more details on how to set up this feature. |
| none            | The contract will not be delivered when it is published. [Access tokens](oneflow-platform-glossary#api-token) can be requested after publish.                                                                                                                                                                 |
| unknown         | Used for future extensions. It can never be input when creating or updating contracts.                                                                                                                                                                                                                        |

### Sign methods

The `sign_methods` array of objects shows available methods of signing contracts.

| Attribute | Type                                 | Description                                                                                           |
| :-------- | :----------------------------------- | :---------------------------------------------------------------------------------------------------- |
| name      | [string](type-reference#base-types)  | The name of the method of signing the contract.  See [Sign method name](contract#sign-method-name).   |
| preferred | [boolean](type-reference#base-types) | Indicates the method of signing the contract that has been set as preferred by the template designer. |

#### Sign method name

The table below shows all methods available for the `sign_methods` array of objects `name` attribute.

> 📘 Note:
>
> To be able to use SMS-signing, you first need to activate the SMS [extension](oneflow-platform-glossary#extension). The same goes for all eIDs.

| Method                 | Description                                                                                                                                                                                                                                                                                                           |
| :--------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| standard\_esign        | This is the default setting for the Oneflow verification and signing. Your counterparty receives notification (email or SMS) with a unique and secure link to the contract. Now they can sign the contract in the [Oneflow application](oneflow-platform-glossary#oneflow-application) using the green *Sign* button. |
| sms                    | E-signature with an SMS code.                                                                                                                                                                                                                                                                                         |
| swedish\_bankid        | E-signature with a Swedish BankID.                                                                                                                                                                                                                                                                                    |
| norwegian\_bankid      | E-signature with a Norwegian BankID.                                                                                                                                                                                                                                                                                  |
| danish\_mitid          | E-signature with a Danish MitID. (This was previously known as Danish NemID.)                                                                                                                                                                                                                                         |
| finnish\_bankid        | E-signature with a Finnish BankID.                                                                                                                                                                                                                                                                                    |
| handwritten\_signature | Drawing of handwritten signature.                                                                                                                                                                                                                                                                                     |
| eid\_sign              | E-signature with any other electronic ID. Supported electronic IDs: .beID, Estonian ID card, Estonian Mobile-ID, Freja eID, Finnish Trust Network, iDIN, itsme, MitID, Norwegian BankID, Smart-ID, SimplySign, ZealID, Evrotrust, sign-me.                                                                            |
| unknown                | Used for future extensions. It can never be input when creating or updating contracts.                                                                                                                                                                                                                                |

### Two-step authentication methods

The two-step authentication is an optional way to increase your contract security by ensuring that only the intended recipient can access the contract.

The `two_step_authentication_methods` array of objects shows the available two-step authentication methods.

| Attribute                         | Type                                                                     | Description                                                                                                                                                                                                                                                                    |
| :-------------------------------- | :----------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| name                              | [string](type-reference#base-types)                                      | The name of the two-step authentication method.  See [Two-step authentication method name](contract#two-step-authentication-method-name).                                                                                                                                      |
| preferred                         | [boolean](type-reference#base-types)                                     | Indicates the two-step authentication method that has been set as preferred by the template designer.                                                                                                                                                                          |
| required\_participant\_attributes | [array](type-reference#base-types)\[[string](type-reference#base-types)] | Indicates the attributes required for all participants, depending on the available two-step authentication methods.  For example, if the SMS two-step authentication method is available, the participant must have a phone number. All of the listed attributes are required. |

The table below shows what participant-related attributes are required, depending on the two-step authentication method.\
All attributes marked with \* are required.

| Method                   | Required Participant Attributes |
| :----------------------- | :------------------------------ |
| email                    | email\*                         |
| none                     | -\*                             |
| sms                      | phone\_number\*                 |
| personal\_identification | identification\_number\*        |

#### Two-step authentication method name

The table below shows all methods available for the `two_step_authentication_methods` object `name` attribute.

| Type                     | Description                                                                                               |
| :----------------------- | :-------------------------------------------------------------------------------------------------------- |
| email                    | The security code is sent by email.                                                                       |
| sms                      | The security code is sent by SMS to a phone.                                                              |
| personal\_identification | A unique identification for a person such as date of birth, social security number, personal number, etc. |
| none                     | Two-step authentication is disabled.                                                                      |
| unknown                  | Used for future extensions. It can never be input when creating or updating contracts.                    |

## Lifecycle

The lifecycle of a contract, also called the contract **duration**, is the status of the contract after it has been signed.

> 📘 Note:
>
> Lifecycle applies *only* to signed contracts.

The lifecycle of a contract tells you when a contract starts and ends, whether it's active, ended, or canceled, when a recurring contract enters a new period, etc.

The contract lifecycle consists of:

* [Lifecycle state](contract#lifecycle-state)
* [Lifecycle settings](contract#lifecycle-settings).

## Lifecycle state

When a participant signs the contract, the contract gets a secondary lifecycle state.

The lifecycle state keeps track of the contract status, which can be **awaiting**, **active**, or **ended**. There are also composite states (see also [Composite](contract#composite)), or substates, for **canceled** (for active), and **terminated** (for ended).

![](https://files.readme.io/b472f13-states_2.svg "states (2).svg")

### Awaiting

Contracts that have a duration normally become **active** as soon as they are signed.\
However, a contract may have a start date in the future. Those contracts enter the **awaiting** lifecycle state upon being signed and remain so until the start date comes. Then they transition to **active**.

> 👍 Example:
>
> An example is renting a cabin for one week in June. When the contract is signed in March, the contract does not become **active** immediately but rather is **awaiting** until that week in June, when it becomes **active**.

### Active

**Active** contracts are contracts with a duration where the start date has passed (or was not set), the end date has not yet come, and the contract has not been terminated.

> 👍 Example:
>
> Continuing with the cabin example: the contract is only **active** for that one week in June (before it was **awaiting** and after the **active** state, it will be **ended**.)

#### Canceled

A contract of a recurring type can be **canceled**. If **canceled** before the end of the notice period, the contract will **end** at the end of the current period. If **canceled** after the end of the notice period, the contract will **end** at the end of the next period.\
A canceled contract will remain **active** until the end of the contract period (set by the `period` attribute, see the table below).

> 👍 Example:
>
> Let's take a recurring contract with a one-year duration that starts at the beginning of the year. If you have a one-month notice period and cancel the contract before December, the contract **ends** at the end of the year.  Otherwise, it will be in effect until the end of next year.

### Ended

A contract with a duration that has ended gets the **ended** state. A contract can **end** naturally (not canceled or manually terminated) or **terminated** (substate or ended).

#### Terminated

A contract can be terminated in two ways:

* The contract is canceled and passed the end date.
* The contract is terminated manually.\
  Terminating a contract manually will make it **end** immediately.

## Lifecycle state attributes

In addition to the **awaiting**, **active**, or **ended** states, known in the contract table as `lifecycle`, the lifecycle state also refers to a set of values that make up the entire lifecycle state of the contract. The table below displays all attributes available for the `lifecycle_state` object.

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>
        Attribute
      </th>

      <th>
        Type
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        composite
      </td>

      <td>
        [string(enum)](type-reference#subtypes-for-str)
      </td>

      <td>
        The attribute in the lifecycle that summarizes the current lifecycle state attributes. See [Composite](contract#composite).
      </td>
    </tr>

    <tr>
      <td>
        contract\_end\_time
      </td>

      <td>
        [string(datetime)](type-reference#subtypes-for-str)
      </td>

      <td>
        The time the contract ends.
      </td>
    </tr>

    <tr>
      <td>
        contract\_start\_time
      </td>

      <td>
        [string(datetime)](type-reference#subtypes-for-str)
      </td>

      <td>
        The time the contract starts.
      </td>
    </tr>

    <tr>
      <td>
        cancel\_time
      </td>

      <td>
        [string(datetime)](type-reference#subtypes-for-str)
      </td>

      <td>
        The time the contract was canceled. The value is `null` if not canceled.
      </td>
    </tr>

    <tr>
      <td>
        has\_ended\_by\_termination
      </td>

      <td>
        [boolean](type-reference#base-types)
      </td>

      <td>
        Indicates whether the contract was manually terminated.
      </td>
    </tr>

    <tr>
      <td>
        has\_passed\_notice\_period\_start\_time
      </td>

      <td>
        [boolean](type-reference#base-types)
      </td>

      <td>
        Indicates whether the notice period start time has passed. If  you cancel the contract before the expiration of the notice period, the contract will remain in effect until the next period.
      </td>
    </tr>

    <tr>
      <td>
        is\_canceled
      </td>

      <td>
        [boolean](type-reference#base-types)
      </td>

      <td>
        Indicates whether the contract has been canceled.
      </td>
    </tr>

    <tr>
      <td>
        is\_recurring
      </td>

      <td>
        [boolean](type-reference#base-types)
      </td>

      <td>
        Indicates whether the contract gets renewed periodically.
      </td>
    </tr>

    <tr>
      <td>
        lifecycle\_state
      </td>

      <td>
        [string(enum)](type-reference#subtypes-for-str)
      </td>

      <td>
        See [Lifecycle states](contract#lifecycle-states).
      </td>
    </tr>

    <tr>
      <td>
        lifecycle\_state\_updated\_time
      </td>

      <td>
        [string(datetime)](type-reference#subtypes-for-str)
      </td>

      <td>
        The time the lifecycle state was last updated.
      </td>
    </tr>

    <tr>
      <td>
        notice\_period\_start\_time
      </td>

      <td>
        [string(datetime)](type-reference#subtypes-for-str)
      </td>

      <td>
        The time the notice period starts.  

        * \*Note: \*\*Notice period always behaves the same, regardless of other settings.
      </td>
    </tr>

    <tr>
      <td>
        period
      </td>

      <td>
        [integer](type-reference#base-types)
      </td>

      <td>
        The count of the current period starting from 1.  

        **For the 1st period:**  

        * If you cancel the contract before `notice_period_start_time`, the contract will end after the 1st period.  
        * If you cancel the contract after `notice_period_start_time`,  the contract will be extended to the 2nd period.  

        **For the 2nd period:**  

        * If you cancel the contract during the 2nd period, the contract will remain active for a time equal to the notice period, after which the contract will end.
      </td>
    </tr>

    <tr>
      <td>
        period\_end\_time
      </td>

      <td>
        [string(datetime)](type-reference#subtypes-for-str)
      </td>

      <td>
        The time the current period ends.
      </td>
    </tr>

    <tr>
      <td>
        period\_start\_time
      </td>

      <td>
        [string(datetime)](type-reference#subtypes-for-str)
      </td>

      <td>
        The time the next period starts.
      </td>
    </tr>
  </tbody>
</Table>

### Composite

The lifecycle `composite` attribute summarizes the attributes of the current lifecycle state. It is more detailed than the `lifecycle_state` attribute and is meant to be used to distinguish between all possible contract states of a contract in your code without having to look at other lifecycle attributes.

In addition to the `lifecycle_state` attribute, the `composite` attribute indicates whether the contract is recurring, which means that it can be renewed over a set of periods (see the `lifecycle_state` object  [Duration types](contract#duration-types).) It also shows if the recurring contract was canceled. Finally, it shows whether the contract was terminated manually.

| Composite                  | Description                                                                                               |
| :------------------------- | :-------------------------------------------------------------------------------------------------------- |
| awaiting                   | The contract has not started yet.                                                                         |
| awaiting-recurring         | The contract is recurring and has not started yet.                                                        |
| active                     | The contract has started and is active until it’s canceled or ended naturally.                            |
| active-recurring           | The contract is recurring. It has started and is active until it’s canceled or ended naturally.           |
| active-canceled-recurring  | The contract is recurring. The contract has started, and then someone ended it by canceling the contract. |
| ended                      | The contract has ended after being canceled or ended naturally.                                           |
| ended-terminated           | The contract has ended by being terminated.                                                               |
| ended-terminated-recurring | The contract is recurring and has ended by being terminated.                                              |
| unknown                    | Used for future extensions.                                                                               |

### Lifecycle states

The table below displays all possible values of the `lifecycle_state` attribute.

| Lifecycle | Description                                                                   |
| :-------- | :---------------------------------------------------------------------------- |
| awaiting  | The contract has not started yet.                                             |
| active    | The contract has started and is active until it’s canceled or ends naturally. |
| ended     | The contract has ended after being canceled or ended naturally.               |
| unknown   | Used for future extensions.                                                   |

## Lifecycle settings

The lifecycle settings determine which lifecycle the contract will go through after it is signed. Will it have a duration? What is the duration? Is it recurring? When can it be canceled? When will it start? Etc.\
The table below displays all the attributes available for the `lifecycle_settings` object.

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>
        Attribute
      </th>

      <th>
        Type
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        duration
      </td>

      <td>
        [string(duration)](type-reference#subtypes-for-str)
      </td>

      <td>
        The duration of the contract period; the exact meaning depends on the `type`. See more in [Duration types](contract#duration-types).
      </td>
    </tr>

    <tr>
      <td>
        end\_date
      </td>

      <td>
        [string(datetime)](type-reference#subtypes-for-str)
      </td>

      <td>
        The end date of the contract or period;  the exact meaning depends on the `type`. See more in [Duraton types](contract#duration-types).  

        * \*Note: \*\*`end_date` cannot be combined with `initial_duration`.
      </td>
    </tr>

    <tr>
      <td>
        initial\_duration
      </td>

      <td>
        [string(duration)](type-reference#subtypes-for-str)
      </td>

      <td>
        The initial duration of the first period of the contract only works for recurring types.  

        * \*Note: \*\*`initial_duration` cannot be combined with `end_date`.
      </td>
    </tr>

    <tr>
      <td>
        notice\_period
      </td>

      <td>
        [string(duration)](type-reference#subtypes-for-str)
      </td>

      <td>
        The time before the start of a new contract period. During this time, one more period is added when the contract is canceled.
      </td>
    </tr>

    <tr>
      <td>
        start\_date
      </td>

      <td>
        [string(date)](type-reference#subtypes-for-str)
      </td>

      <td>
        The contract start day.
      </td>
    </tr>

    <tr>
      <td>
        type
      </td>

      <td>
        [string(enum)](type-reference#subtypes-for-str)
      </td>

      <td>
        The list of duration types. See [Duration types](contract#duration-types).
      </td>
    </tr>
  </tbody>
</Table>

### Duration types

The table below shows the types of contract duration available for the `lifecycle_settings` object `type` attribute.

| Duration                | Description                                                                                                                                                                                                         |
| :---------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| no\_duration            | `no_duration` is used when there is no contract duration, but you still want to set a fixed start date for the contract. See more in the [No duration type explained](contract#no-duration-type-explained) section. |
| single\_period          | The contract is valid for a single period of time, after which it will end.                                                                                                                                         |
| recurring               | The recurring contract will automatically renew for new periods until canceled.                                                                                                                                     |
| recurring\_two\_periods | The recurring contract has an initial period of finite duration and renews until the second period of infinite duration (unless canceled).                                                                          |

#### No duration type explained

The `no_duration` lifecycle setting is used for a lifecycle with no period, for example, a permanent employment contract.

> 📘 Note:
>
> A contract that does not have a duration section is the same as setting `type = no_duration` and clearing all other parameters. Please, read our Help Center article about [Contract duration and lifecycle settings](https://integrations.oneflow.com/redirect/support/duration-lifecycle) for more information.

The table below shows different outputs for contracts with the `no_duration` type depending on the contract start date and signing status:

| Start date                    | Signing time             | Response description                                                                           |
| :---------------------------- | :----------------------- | :--------------------------------------------------------------------------------------------- |
| No start date                 | Before and after signing | The `"lifecycle_state"` will be `null` and the `lifecycle_settings` attribute won’t be `null`. |
| With a start date in future   | Before signing           | The `"lifecycle_state"` will be `null` and the `lifecycle_settings` attribute won’t be `null`. |
| With a start date in future   | After signing            | Both the `"lifecycle_state"` and the `lifecycle_settings` attributes won’t be `null`.          |
| With a start date that passed | After signing            | The `"lifecycle_state"` will be `null` and the `lifecycle_settings` attribute won’t be `null`. |

## PDF file groups

PDF file groups contain the list of files uploaded as  `expanded_pdf` to the contract (see [Create a contract with a PDF](https://developer.oneflow.com/docs/create-a-contract-with-a-pdf)).

### PDF file groups attributes

The table below contains the list of all the attributes available for a PDF file groups within a contract.

| Attribute            | Type                                                            | Description                                                                                                                                                         |
| :------------------- | :-------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| \_private\_ownerside | [object](type-reference#base-types)                             | The PDF file group attributes that are visible only to the owner-side party. See [Private owner-side pdf file groups](contract#private-owner-side-pdf-file-groups). |
| files                | [array](type-reference#base-types)                              | The list of[ PDF](oneflow-platform-glossary#pdf-document)s in the contract.                                                                                         |
| id                   | [integer(signed\_integer\_id)](type-reference#subtypes-for-int) | The ID of the PDF file group.                                                                                                                                       |
| type                 | [string(enum)](type-reference#subtypes-for-str)                 | The file uploaded to the contract as an expanded PDF                                                                                                                |

#### Private owner-side pdf file groups

| Attribute     | Type                                                | Description                                                 |
| :------------ | :-------------------------------------------------- | :---------------------------------------------------------- |
| created\_time | [string(datetime)](type-reference#subtypes-for-str) | The date and time when the pdf file group was created.      |
| updated\_time | [string(datetime)](type-reference#subtypes-for-str) | The date and time when the pdf file group was last updated. |

#### Files

| Attribute            | Type                                                            | Description                                                                                                                                                                                                                                    |
| :------------------- | :-------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| \_private\_ownerside | [object](type-reference#base-types)                             | The pdf file group  attributes that are visible only to the owner-side party. See [Private owner-side pdf file groups](contract#private-owner-side-pdf-file-groups).                                                                           |
| extension            | [string(enum)](type-reference#subtypes-for-str)                 | Indicates the file extension (see [PDF Document](oneflow-platform-glossary#pdf-document)).                                                                                                                                                     |
| id                   | [integer(signed\_integer\_id)](type-reference#subtypes-for-int) | The ID of the pdf file.                                                                                                                                                                                                                        |
| name                 | [string](type-reference#base-types)                             | If the file name contains only non-US-ASCII characters, the default filename will be generated as `type_id.extension`. For example, a file named `*-+%&.png` will be changed to `pdf_123.pdf`, where `123` is the value of the `id` attribute. |
| size                 | [integer](type-reference#base-types)                            | The size of the pdf.                                                                                                                                                                                                                           |

## State

The contract `state` indicates where the contract is in the signing process.

![](https://files.readme.io/b8adf30-states_4.svg "states (4).svg")

> 🚧 Note:
>
> You cannot change contracts that have been **signed** or **declined**.\
> After a participant has signed the contract, changing the contract will reset their signature, and they will need to sign again.

| State    | Description                                                                                                                                     |
| :------- | :---------------------------------------------------------------------------------------------------------------------------------------------- |
| draft    | Only the owner-side can view the contract.                                                                                                      |
| pending  | The contract is under negotiation.                                                                                                              |
| overdue  | The contract signing period has expired, and the contract can no longer be signed. It will revert to pending if the signing period is extended. |
| signed   | All participants signed the contract. The contract is signed.                                                                                   |
| declined | One participant declined the contract. The contract is declined.                                                                                |
| unknown  | Used for future extensions.                                                                                                                     |

## Links

Related contracts can be linked to each other. The list of linked contracts with their link types will be listed under `links`.

> 📘 Note:
>
> You can have multiple contracts and different types of relationships linked to the same contract.

The table below displays all the attributes available for a link object.

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>
        Attribute
      </th>

      <th>
        Type
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        id
      </td>

      <td>
        [integer(signed\_integer\_id)](type-reference#subtypes-for-int)
      </td>

      <td>
        The unique ID of the link.
      </td>
    </tr>

    <tr>
      <td>
        linked\_contract
      </td>

      <td>
        [integer(signed\_integer\_id)](type-reference#subtypes-for-int)
      </td>

      <td>
        The unique ID of the linked contract. This is not available for links with the type `external`.
      </td>
    </tr>

    <tr>
      <td>
        type
      </td>

      <td>
        [string(enum)](type-reference#subtypes-for-str)
      </td>

      <td>
        The type of the link, which describes the relationship between the two contracts.\
        Can be one of the following:\
        `amends`,  `amended_by`,  `sub_contract`, `main_contract`,  `replaced_by`,  `replaces`, ` relates_to`, `external`
      </td>
    </tr>

    <tr>
      <td>
        external\_link
      </td>

      <td>
        [string](type-reference#base-types)
      </td>

      <td>
        The URL that links the contract to an external entity (i.e. a website). This is only used with links with the type `external`.
      </td>
    </tr>

    <tr>
      <td>
        external\_title
      </td>

      <td>
        [string](type-reference#base-types)
      </td>

      <td>
        The name of the `external_link`. This is only used with links with the type `external`.
      </td>
    </tr>
  </tbody>
</Table>

> 🚧 Note:
>
> In the API response, the link type represents the **target contract relationship to the main contract.** However, in the Oneflow application, this is represented the other way around (i.e. **Main contract relationship to the target contract**). There is no difference for links with the type `external`.

If we take the **main contract as X** and the **target contract as Y**, following table explains how the API response and Oneflow application represent the relationship between two contracts.

| API response                     | Oneflow application              |
| :------------------------------- | :------------------------------- |
| Y **relates\_to** X              | X **relates\_to** Y              |
| Y is the **main\_contract** of X | X is a **sub\_contract** of Y    |
| Y is a **sub\_contract** of X    | X is the **main\_contract** of Y |
| Y **replaces**  X                | X is **replaced\_by** Y          |
| Y is **replaced\_by**  X         | X **replaces** Y                 |
| Y **amends**  X                  | X **amended\_by** Y              |
| Y **amended\_by**  X             | X **amends**  Y                  |