# Unfinalize contract

Revert a finalized builder session contract back to a pending (editable) state. Once unfinalized, the document can be patched again and the end-user can continue drafting.
Only a session with a `completed` status can be unfinalized. Calling this on a session that is not completed will return a `409 Conflict` error.

Endpoint: POST /api/builder/sessions/{session_id}/contract/unfinalize
Version: 1.0.0
Security: APIKey

## Security:

  - `APIKey` (unknown)
    http bearer API Key

## Path parameters:

  - `session_id` (string, required)
    The UUID of the session to unfinalize.

## Header parameters:

  - `X-Participant` (string, required)
    The participant ID for the builder session performing the unfinalize action.

## Response 200:

  - `200` (unknown)
    Successfully unfinalized contract

## Response 200 fields (application/json):

  - `data` (object)

  - `data.state` (object)
    Contract current state

  - `data.state.id` (string)

  - `data.state.status` (string)
    If document is finalized, it cannot be edited.
    Enum: "draft", "finalized"

  - `data.state.document_name` (string)
    Name of the document. End-users can edit this. This is not visible on the document itself.

  - `data.state.jurisdiction` (string)
    Jurisdiction of the agreement.
    Example: FI

  - `data.state.languages` (array)
    Languages in which the document is drafted. It usually contains just one.
    Example: ["en-GB"]

  - `data.state.value` (object)
    Values filled in to the form. The schema varies in every template. See [this](/embed-api/legal-engine/document-state#update-document-field-values) for more information.

  - `data.state.sections` (array)
    List of sections included in the document. It contains templates and custom sections added by end-users. The sections are presented in the same order as they appear in the document.

  - `data.state.appearance` (object)

  - `data.state.appearance.logo` (object)

  - `data.state.appearance.logo.enabled` (boolean)
    Example: false

  - `data.state.appearance.logo.content` (string | null)
    Data URI with base64 encoded JPG,PNG or SVG image.
    Example: null

  - `data.state.appearance.logo.scale` (number)
    Size of the logo, scale 20-100 where 20 is the smallest and 100 is the largest.
    Example: 50

  - `data.state.appearance.footer` (object)

  - `data.state.appearance.footer.enabled` (boolean)
    Example: false

  - `data.state.appearance.footer.content` (string)

  - `data.state.appearance.heading1` (object)

  - `data.state.appearance.heading1.family` (string)
    Example: arial

  - `data.state.appearance.heading1.color` (string)
    Example: #000000

  - `data.state.appearance.heading1.size` (string)
    Example: 20

  - `data.state.appearance.heading1.weight` (string)
    Example: bold

  - `data.state.appearance.heading1.alignment` (string)
    Example: left

  - `data.state.appearance.heading1.transform` (string)
    Example: none

  - `data.state.appearance.heading2` (object)

  - `data.state.appearance.heading2.family` (string)
    Example: arial

  - `data.state.appearance.heading2.color` (string)
    Example: #000000

  - `data.state.appearance.heading2.size` (string)
    Example: 13

  - `data.state.appearance.heading2.weight` (string)
    Example: bold

  - `data.state.appearance.heading2.alignment` (string)
    Example: left

  - `data.state.appearance.heading2.transform` (string)
    Example: none

  - `data.state.appearance.heading3` (object)

  - `data.state.appearance.heading3.family` (string)
    Example: arial

  - `data.state.appearance.heading3.color` (string)
    Example: #000000

  - `data.state.appearance.heading3.size` (string)
    Example: 12

  - `data.state.appearance.heading3.weight` (string)
    Example: bold

  - `data.state.appearance.heading3.alignment` (string)
    Example: left

  - `data.state.appearance.heading3.transform` (string)
    Example: none

  - `data.state.appearance.heading4` (object)

  - `data.state.appearance.heading4.family` (string)
    Example: arial

  - `data.state.appearance.heading4.color` (string)
    Example: #000000

  - `data.state.appearance.heading4.size` (string)
    Example: 11

  - `data.state.appearance.heading4.weight` (string)
    Example: bold

  - `data.state.appearance.heading4.alignment` (string)
    Example: left

  - `data.state.appearance.heading4.transform` (string)
    Example: none

  - `data.state.appearance.heading5` (object)

  - `data.state.appearance.heading5.family` (string)
    Example: arial

  - `data.state.appearance.heading5.color` (string)
    Example: #000000

  - `data.state.appearance.heading5.size` (string)
    Example: 11

  - `data.state.appearance.heading5.weight` (string)
    Example: regular

  - `data.state.appearance.heading5.alignment` (string)
    Example: left

  - `data.state.appearance.heading5.transform` (string)
    Example: none

  - `data.state.appearance.heading6` (object)

  - `data.state.appearance.heading6.family` (string)
    Example: arial

  - `data.state.appearance.heading6.color` (string)
    Example: #000000

  - `data.state.appearance.heading6.size` (string)
    Example: 11

  - `data.state.appearance.heading6.weight` (string)
    Example: regular

  - `data.state.appearance.heading6.alignment` (string)
    Example: left

  - `data.state.appearance.heading6.transform` (string)
    Example: none

  - `data.state.appearance.paragraph` (object)

  - `data.state.appearance.paragraph.family` (string)
    Example: arial

  - `data.state.appearance.paragraph.color` (string)
    Example: #000000

  - `data.state.appearance.paragraph.size` (string)
    Example: 11

  - `data.state.appearance.paragraph.weight` (string)
    Example: regular

  - `data.state.appearance.paragraph.alignment` (string)
    Example: justify

  - `data.state.appearance.paragraph.transform` (string)
    Example: none

  - `data.state.appearance.table` (object)

  - `data.state.appearance.table.family` (string)
    Example: arial

  - `data.state.appearance.table.size` (string)
    Example: 11

  - `data.state.appearance.table.color` (string)
    Example: #000000

  - `data.state.appearance.table.bgColor` (string)
    Example: #ffffff

  - `data.state.appearance.table.headerBgColor` (string)
    Example: #e7e5e4

  - `data.state.appearance.table.headerColor` (string)
    Example: #000000

  - `data.state.appearance.table.borderColorEnabled` (boolean)
    Example: true

  - `data.state.appearance.table.borderColor` (string)
    Example: #ffffff

  - `data.state.appearance.table.alternatingRowBgColorEnabled` (boolean)
    Example: true

  - `data.state.appearance.table.alternatingRowBgColor` (string)
    Example: #fafaf9

  - `data.signees` (array)
    List of signees found from the document.

  - `data.signees._type` (string)
    Enum: "signature"

  - `data.signees.id` (string, required)
    Unique ID for the signature.

  - `data.signees.first_name` (string, required)

  - `data.signees.last_name` (string, required)

  - `data.signees.job_title` (string)

  - `data.signees.company_name` (string)

  - `data.signees.fieldset_name` (string, required)
    Name of the fieldset from which this signee originates.

  - `data.signees.page` (integer, required)
    Number of the page where the signature area of this signee is located. It is 1-based.

  - `data.signees.x` (number, required)
    X position of the signature area's location. The value is % of the page's width. For e.g. 0.10 means it is 10% of the page width.
    Example: 0.1

  - `data.signees.y` (number, required)
    Y position of the signature area's location. The value is % of the page's height. For e.g. 0.10 means it is 10% of the page height.
    Example: 0.1

  - `data.signees.width` (number, required)
    Width of the signature area. The value is % of the page's width. For e.g. 0.10 means it is 10% of the page width.
    Example: 0.1

  - `data.signees.height` (number, required)
    Height of the signature area. The value is % of the page's height. For e.g. 0.10 means it is 10% of the page height.
    Example: 0.1

## Response 409:

  - `409` (unknown)
    Contract is not in a completed state.

## Response 409 fields (application/json):

  - `data` (null, required)
    Always null for error responses.

  - `meta` (object, required)

  - `meta.status` (object, required)

  - `meta.status.code` (integer, required)
    Example: 409

  - `meta.status.text` (string, required)
    Example: Conflict

  - `meta.error` (object, required)

  - `meta.error.text` (string, required)
    Example: Only a completed session contract can be unfinalized

