---
title: "Create a template from a contract"
method: POST
path: "/contracts/{contract_id}/copy_to_template"
tags: ["Contract"]
---

# Create a template from a contract

`POST /contracts/{contract_id}/copy_to_template`

Use this endpoint to create a template from an existing contract.

## Path parameters

- `contract_id` integer, required

## Headers

- `x-oneflow-api-token` string, required
- `x-oneflow-user-email` string, email, required

## Request body

- object — Request body for create a template from a contract.
  - `name` string
  - `workspace_id` integer — The workspace to which the template needs to be created from contract.

## Response `200`

Returns the created template.

- object — A template for a contract. See [Template](https://developer.oneflow.com/docs/template) for more information
  - `_links` object — Links to related endpoints.
    - `comments` object
      - `href` string, nullable
    - `contracts` object
      - `href` string, nullable
    - `contract` object
      - `href` string, nullable
    - `create` object
      - `href` string, nullable
    - `data_field` object
      - `href` string, nullable
    - `data_fields` object
      - `href` string, nullable
    - `events` object
      - `href` string, nullable
    - `event` object
      - `href` string, nullable
    - `files` object
      - `href` string, nullable
    - `file` object
      - `href` string, nullable
    - `next` object
      - `href` string, nullable
    - `parties` object
      - `href` string, nullable
    - `party` object
      - `href` string, nullable
    - `previous` object
      - `href` string, nullable
    - `publish` object
      - `href` string, nullable
    - `self` object
      - `href` string, nullable
    - `template_types` object
      - `href` string, nullable
    - `template_type` object
      - `href` string, nullable
    - `template` object
      - `href` string, nullable
    - `templates` object
      - `href` string, nullable
    - `workspaces` object
      - `href` string, nullable
    - `workspace` object
      - `href` string, nullable
    - `playbooks` object
      - `href` string, nullable
  - `_private` object — See [Private](https://developer.oneflow.com/docs/contract#private)
    - `date_format` string, required — The date format of the template.
    - `language` string — The language of the template.
    - `name` string, required — The name of the template.
    - `signing_period_expiration` union, required
      - object — The signing period for this contract never expires
        - `type` 'never', required — Can only be 'never'.
      - object — The signing period for this contract expires a given number of days after publishing. This setting can only be used when the contract is in the draft stage. Converts into a "fixed_date" after the contract is published.
        - `type` 'days_after_publish', required — Can only be 'days_after_publish'.
        - `expire_days_after_publish` integer, required
      - object — The signing period for this contract expires on a set date.
        - `type` 'fixed_date', required — Can only be 'fixed_date'.
        - `expire_date` string, date, required
    - `workspace_id` integer, nullable, required — The unique id of this workspace.
    - `single_sign` boolean — State of the feature single sign
  - `available_options` object, required — Available options in the contract. See [Available options](https://developer.oneflow.com/docs/contract#available-options).
    - `can_receive_attachments` boolean, required
    - `can_receive_expanded_pdf` boolean, required
    - `can_receive_products` boolean, required
    - `can_receive_product_tax` boolean, required
    - `delivery_channels` object[], required
      - `name` 'email' | 'sms' | 'email_and_sms' | 'same_device' | 'none' | 'unknown', required — One of the contract [delivery channels](contract#delivery-channels).
      - `preferred` boolean, required
      - `required_participant_attributes` string[], required
    - `sign_methods` object[], required
      - `name` 'standard_esign' | 'sms' | 'swedish_bankid' | 'norwegian_bankid' | 'danish_mitid' | 'finnish_bankid' | 'handwritten_signature' | 'eid_sign' | 'unknown', required — One of the [sign methods](contract#sign-methods).
      - `preferred` boolean, required
    - `two_step_authentication_methods` object[], required
      - `name` 'email' | 'sms' | 'personal_identification' | 'none' | 'unknown', required — One of the [two step authentication methods](contract#two-step-authentication-methods).
      - `preferred` boolean, required
      - `required_participant_attributes` string[], required
  - `attachment_file_groups` object[], required — A list of attachment type file groups in the contract.
    - `_private_ownerside` object, nullable, required — File group data that is private to the ownerside.
      - `created_time` string, datetime, required
      - `updated_time` string, datetime, nullable, required
    - `files` object[], required
      - `_private_ownerside` object, nullable, required — File data that is private to the ownerside.
        - `created_time` string, datetime, required
        - `updated_time` string, datetime, nullable, required
      - `extension` string, nullable, required — The file extension.
      - `id` integer, required
      - `name` string, nullable, required — The name of the file.
      - `size` integer, nullable, required — The size of the file in bytes.
    - `id` integer, required
    - `type` 'attachment' | 'pdf', required — The file group type of the file group sections. There are only two types available, `attachment` and `pdf`.
  - `configuration` object, nullable, required — Default configuration details of a template
    - `default_creator_roles` object, required — Roles of a default contract creator who creates contracts using a specific template.
      - `_permissions` object, required — This attribute contains the permissions for the participant/creator on the contract.
        - `contract:update` boolean, required
      - `organizer` boolean, required — A flag to indicate that the default contract creator functions as an organizer.
      - `signatory` boolean, required — A flag to indicate that the default contract creator functions as a signatory.
    - `default_counterparty_type` 'company' | 'individual' — Default counterpaty type in the template.
  - `created_time` string, datetime, required
  - `draft_approval_workflow` object, nullable — Draft approval work flow details.
    - `status` string, nullable
  - `id` integer, required
  - `name` string, required
  - `playbook` object, nullable, required — The playbook used by the template.
    - `id` integer, required
    - `name` string, required
  - `blueprints` object[], nullable, required
    - `id` integer, required
    - `name` string, required
  - `parties` union[], required — The parties involved in this template.
    - union
      - object — An individual party, where a single participant is signing on behalf of him- or herself. See [Individual party](https://developer.oneflow.com/docs/party#individual)
        - `_links` object — Links to related endpoints.
          - `comments` object
            - `href` string, nullable
          - `contracts` object
            - `href` string, nullable
          - `contract` object
            - `href` string, nullable
          - `create` object
            - `href` string, nullable
          - `data_field` object
            - `href` string, nullable
          - `data_fields` object
            - `href` string, nullable
          - `events` object
            - `href` string, nullable
          - `event` object
            - `href` string, nullable
          - `files` object
            - `href` string, nullable
          - `file` object
            - `href` string, nullable
          - `next` object
            - `href` string, nullable
          - `parties` object
            - `href` string, nullable
          - `party` object
            - `href` string, nullable
          - `previous` object
            - `href` string, nullable
          - `publish` object
            - `href` string, nullable
          - `self` object
            - `href` string, nullable
          - `template_types` object
            - `href` string, nullable
          - `template_type` object
            - `href` string, nullable
          - `template` object
            - `href` string, nullable
          - `templates` object
            - `href` string, nullable
          - `workspaces` object
            - `href` string, nullable
          - `workspace` object
            - `href` string, nullable
          - `playbooks` object
            - `href` string, nullable
        - `_private_ownerside` object, nullable, required — Party data that is private to the ownerside.
          - `created_time` string, datetime, required
          - `custom_id` string, nullable, required
          - `updated_time` string, datetime, nullable, required
        - `country_code` string, country_code, required
        - `id` integer, required
        - `identification_number` string, required
        - `my_party` boolean, required
        - `name` string, nullable, required
        - `participant` object, required — See [Participant](https://developer.oneflow.com/docs/participant).
          - `_links` object — Links to related endpoints.
            - `comments` object
              - …
            - `contracts` object
              - …
            - `contract` object
              - …
            - `create` object
              - …
            - `data_field` object
              - …
            - `data_fields` object
              - …
            - `events` object
              - …
            - `event` object
              - …
            - `files` object
              - …
            - `file` object
              - …
            - `next` object
              - …
            - `parties` object
              - …
            - `party` object
              - …
            - `previous` object
              - …
            - `publish` object
              - …
            - `self` object
              - …
            - `template_types` object
              - …
            - `template_type` object
              - …
            - `template` object
              - …
            - `templates` object
              - …
            - `workspaces` object
              - …
            - `workspace` object
              - …
            - `playbooks` object
              - …
          - `_permissions` object, required — This attribute contains the permissions for the participant/creator on the contract.
            - `contract:update` boolean, required
          - `_private_ownerside` object, nullable, required — Participant data that is private to the ownerside.
            - `created_time` string, datetime, required
            - `custom_id` string, nullable, required
            - `first_visited_time` string, datetime, nullable, required
            - `last_visited_time` string, datetime, nullable, required
            - `updated_time` string, datetime, nullable, required
            - `visits` integer, required
          - `delivery_channel` 'email' | 'sms' | 'email_and_sms' | 'same_device' | 'none' | 'unknown', required — One of the contract [delivery channels](contract#delivery-channels).
          - `delivery_status` 'not_sent' | 'pending' | 'failure' | 'bounce' | 'success' | 'opened' | 'unknown', required — One of the contract [delivery status](contract-participant#delivery-status).
          - `draft_approver` boolean — A flag to indicate if the participant is a draft approver.
          - `email` string, email, required
          - `id` integer, required
          - `identification_number` string, required
          - `my_participant` boolean, required
          - `name` string, nullable, required
          - `organizer` boolean, required — A flag to indicate if the participant is an organizer combined with the permissions.
          - `pending_approver` boolean — A flag to indicate if the participant is a pending approver.
          - `phone_number` string, nullable, required
          - `sign_method` 'standard_esign' | 'sms' | 'swedish_bankid' | 'norwegian_bankid' | 'danish_mitid' | 'finnish_bankid' | 'handwritten_signature' | 'eid_sign' | 'unknown', required — One of the [sign methods](contract#sign-methods).
          - `sign_state` 'undecided' | 'signed' | 'declined' | 'unknown', required — One of the [sign states](contract-participant#sign-state).
          - `sign_state_updated_time` string, datetime, nullable, required
          - `signatory` boolean, required — A flag to indicate if the participant is an signatory combined with the permissions.
          - `title` string, required
          - `two_step_authentication_method` 'email' | 'sms' | 'personal_identification' | 'none' | 'unknown', required — One of the [two step authentication methods](contract#two-step-authentication-methods).
        - `type` 'individual', required — Can only be `individual`.
      - object — The participants are signing on behalf of this company. See [Company party](https://developer.oneflow.com/docs/party#company).
        - `_links` object — Links to related endpoints.
          - `comments` object
            - `href` string, nullable
          - `contracts` object
            - `href` string, nullable
          - `contract` object
            - `href` string, nullable
          - `create` object
            - `href` string, nullable
          - `data_field` object
            - `href` string, nullable
          - `data_fields` object
            - `href` string, nullable
          - `events` object
            - `href` string, nullable
          - `event` object
            - `href` string, nullable
          - `files` object
            - `href` string, nullable
          - `file` object
            - `href` string, nullable
          - `next` object
            - `href` string, nullable
          - `parties` object
            - `href` string, nullable
          - `party` object
            - `href` string, nullable
          - `previous` object
            - `href` string, nullable
          - `publish` object
            - `href` string, nullable
          - `self` object
            - `href` string, nullable
          - `template_types` object
            - `href` string, nullable
          - `template_type` object
            - `href` string, nullable
          - `template` object
            - `href` string, nullable
          - `templates` object
            - `href` string, nullable
          - `workspaces` object
            - `href` string, nullable
          - `workspace` object
            - `href` string, nullable
          - `playbooks` object
            - `href` string, nullable
        - `_private_ownerside` object, nullable, required — Party data that is private to the ownerside.
          - `created_time` string, datetime, required
          - `custom_id` string, nullable, required
          - `updated_time` string, datetime, nullable, required
        - `country_code` string, country_code, required
        - `id` integer, required
        - `identification_number` string, required
        - `my_party` boolean, required
        - `name` string, required
        - `participants` object[], required — The maximum number of participants per contract across all parties is 40.
          - `_links` object — Links to related endpoints.
            - `comments` object
              - …
            - `contracts` object
              - …
            - `contract` object
              - …
            - `create` object
              - …
            - `data_field` object
              - …
            - `data_fields` object
              - …
            - `events` object
              - …
            - `event` object
              - …
            - `files` object
              - …
            - `file` object
              - …
            - `next` object
              - …
            - `parties` object
              - …
            - `party` object
              - …
            - `previous` object
              - …
            - `publish` object
              - …
            - `self` object
              - …
            - `template_types` object
              - …
            - `template_type` object
              - …
            - `template` object
              - …
            - `templates` object
              - …
            - `workspaces` object
              - …
            - `workspace` object
              - …
            - `playbooks` object
              - …
          - `_permissions` object, required — This attribute contains the permissions for the participant/creator on the contract.
            - `contract:update` boolean, required
          - `_private_ownerside` object, nullable, required — Participant data that is private to the ownerside.
            - `created_time` string, datetime, required
            - `custom_id` string, nullable, required
            - `first_visited_time` string, datetime, nullable, required
            - `last_visited_time` string, datetime, nullable, required
            - `updated_time` string, datetime, nullable, required
            - `visits` integer, required
          - `delivery_channel` 'email' | 'sms' | 'email_and_sms' | 'same_device' | 'none' | 'unknown', required — One of the contract [delivery channels](contract#delivery-channels).
          - `delivery_status` 'not_sent' | 'pending' | 'failure' | 'bounce' | 'success' | 'opened' | 'unknown', required — One of the contract [delivery status](contract-participant#delivery-status).
          - `draft_approver` boolean — A flag to indicate if the participant is a draft approver.
          - `email` string, email, required
          - `id` integer, required
          - `identification_number` string, required
          - `my_participant` boolean, required
          - `name` string, nullable, required
          - `organizer` boolean, required — A flag to indicate if the participant is an organizer combined with the permissions.
          - `pending_approver` boolean — A flag to indicate if the participant is a pending approver.
          - `phone_number` string, nullable, required
          - `sign_method` 'standard_esign' | 'sms' | 'swedish_bankid' | 'norwegian_bankid' | 'danish_mitid' | 'finnish_bankid' | 'handwritten_signature' | 'eid_sign' | 'unknown', required — One of the [sign methods](contract#sign-methods).
          - `sign_state` 'undecided' | 'signed' | 'declined' | 'unknown', required — One of the [sign states](contract-participant#sign-state).
          - `sign_state_updated_time` string, datetime, nullable, required
          - `signatory` boolean, required — A flag to indicate if the participant is an signatory combined with the permissions.
          - `title` string, required
          - `two_step_authentication_method` 'email' | 'sms' | 'personal_identification' | 'none' | 'unknown', required — One of the [two step authentication methods](contract#two-step-authentication-methods).
        - `type` 'company', required — Can only be `company`.
  - `pdf_file_groups` object[], required — A list of expanded pdf type file groups in the contract.
    - `_private_ownerside` object, nullable, required — File group data that is private to the ownerside.
      - `created_time` string, datetime, required
      - `updated_time` string, datetime, nullable, required
    - `files` object[], required
      - `_private_ownerside` object, nullable, required — File data that is private to the ownerside.
        - `created_time` string, datetime, required
        - `updated_time` string, datetime, nullable, required
      - `extension` string, nullable, required — The file extension.
      - `id` integer, required
      - `name` string, nullable, required — The name of the file.
      - `size` integer, nullable, required — The size of the file in bytes.
    - `id` integer, required
    - `type` 'attachment' | 'pdf', required — The file group type of the file group sections. There are only two types available, `attachment` and `pdf`.
  - `pending_approval_workflow` object, nullable — Pending approval work flow details.
    - `status` string, nullable
  - `product_groups` object[], required — A list of product groups.
    - `_private_ownerside` object, nullable, required — Product group data that is private to the ownerside.
      - `created_time` string, datetime, required
      - `custom_id` string, nullable, required
      - `updated_time` string, datetime, nullable, required
    - `configuration` object, required — Updated product group configuration
      - `columns` object[]
        - `enabled` boolean
        - `key` 'name' | 'description' | 'price_1' | 'price_2' | 'count', required — One of the product group column keys.
        - `label` string
        - `tax_1` object — Product group tax display name.
          - `label` string — The product group tax display name label.
          - `incl_tax` boolean — If true, prices are entered including tax.
      - `counterpart_edit` boolean
      - `hide_price_summation` boolean
      - `name` object — Product group name data.
        - `enabled` boolean — If true, the product group name is enabled.
        - `label` string — The product group name label.
      - `price_affixes` object — Postfix and prefix of a contract product price.
        - `postfix` string
        - `prefix` string
      - `price_precision` integer, nullable
      - `quantity_precision` integer, nullable
      - `tax_1` object — Product group tax display name.
        - `label` string — The product group tax display name label.
        - `incl_tax` boolean — If true, prices are entered including tax.
    - `created_from` integer, nullable — This will be only available in the contract create response.
    - `enabled_columns` object[], required
      - `enabled` boolean, required
      - `key` string, required
    - `id` integer, required
    - `products` object[], required
      - `_private_ownerside` object, nullable, required — Product data that is private to the ownerside.
        - `created_time` string, datetime, required
        - `custom_id` string, nullable, required
        - `updated_time` string, datetime, nullable, required
      - `counterparty_lock` boolean
      - `created_from` integer, nullable — This will be only available in the contract create response.
      - `description` string
      - `id` integer, required
      - `name` string, required
      - `price_1` object, nullable, required — An object that holds all price related information for an individual product.
        - `amount` object, required — The price amount after discount.
          - `amount` string, signed_amount_4_decimal, nullable, required
        - `base_amount` object, required — The price amount before discount.
          - `amount` string, amount_4_decimal, nullable, required
        - `discount_amount` object, required — The absolute discount amount.
          - `amount` string, amount_4_decimal, nullable, required
        - `discount_percent` string, discount_percent, nullable, required — The discount percentage as a decimal string between "0" and "100".
        - `tax_1` object, nullable — Product tax details.
          - `key` 'percentage', required
          - `value` string, tax_percent, required — Represents the tax percentage as a decimal string greater than or equal to 0 and less than or equal to 100.
      - `price_2` object, nullable, required — An object that holds all price related information for an individual product.
        - `amount` object, required — The price amount after discount.
          - `amount` string, signed_amount_4_decimal, nullable, required
        - `base_amount` object, required — The price amount before discount.
          - `amount` string, amount_4_decimal, nullable, required
        - `discount_amount` object, required — The absolute discount amount.
          - `amount` string, amount_4_decimal, nullable, required
        - `discount_percent` string, discount_percent, nullable, required — The discount percentage as a decimal string between "0" and "100".
        - `tax_1` object, nullable — Product tax details.
          - `key` 'percentage', required
          - `value` string, tax_percent, required — Represents the tax percentage as a decimal string greater than or equal to 0 and less than or equal to 100.
      - `quantity` object, required — The object holds information about the quantity of an individual product. The default quantity type is multiple_choice. If the quantity type is single_choice or multiple_choice, the amount must be set to 0 or 1. If the quantity type is set to single_choice, the amount must be set to 1 at least for one product, and 0 for the rest of the products in the same product group with the quantity type single_choice.
        - `amount` number, nullable — The number of individual products selected, or the quantity.
        - `type` 'single_choice' | 'multiple_choice' | 'quantity' — One of the product's [quantity types](product-group#quantity-type).
  - `sign_later` boolean — A flag to indicate if the template has postponed signing.
  - `sign_order` object[] — Sign order of the participants.
    - `participant_id` integer, required — participant ID
    - `order` integer, required — Sign order
  - `source_contract_id` integer
  - `tags` object[], required — All tags associated with the template.
    - `id` integer, required
    - `name` string, required
  - `template_active` boolean
  - `template_type` object, nullable, required — An optional type for the template meaning it supports a specific set of template variables. See [Template type](https://developer.oneflow.com/docs/template-type).
    - `_links` object — Links to related endpoints.
      - `comments` object
        - `href` string, nullable
      - `contracts` object
        - `href` string, nullable
      - `contract` object
        - `href` string, nullable
      - `create` object
        - `href` string, nullable
      - `data_field` object
        - `href` string, nullable
      - `data_fields` object
        - `href` string, nullable
      - `events` object
        - `href` string, nullable
      - `event` object
        - `href` string, nullable
      - `files` object
        - `href` string, nullable
      - `file` object
        - `href` string, nullable
      - `next` object
        - `href` string, nullable
      - `parties` object
        - `href` string, nullable
      - `party` object
        - `href` string, nullable
      - `previous` object
        - `href` string, nullable
      - `publish` object
        - `href` string, nullable
      - `self` object
        - `href` string, nullable
      - `template_types` object
        - `href` string, nullable
      - `template_type` object
        - `href` string, nullable
      - `template` object
        - `href` string, nullable
      - `templates` object
        - `href` string, nullable
      - `workspaces` object
        - `href` string, nullable
      - `workspace` object
        - `href` string, nullable
      - `playbooks` object
        - `href` string, nullable
    - `created_time` string, datetime, nullable, required
    - `description` string, required
    - `extension_type` string, nullable, required
    - `id` integer, required
    - `name` string, required
    - `updated_time` string, datetime, nullable, required
  - `updated_time` string, datetime, nullable, required
  - `workspaces` object[], required — All workspaces associated with the template.
    - `id` integer, required
    - `name` string, nullable, required

## Other responses

- `400` — Invalid format or content of the request.
- `401` — The API token or the user email is invalid.
- `403` — The request is not authorized by the server.
- `404` — A required entity is missing.

---

[API](https://skmtc.net/oneflow/apis/public-api-for-oneflow.md) · [All operations](https://skmtc.net/oneflow/apis/public-api-for-oneflow/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/oneflow/public-api-for-oneflow/versions/0e73a45dec15/schema)
