Contractbook Spaces API

Organize contracts into a hierarchy of spaces. Retrieve the space tree (GET /spaces/{id}/tree) and create child spaces (POST /spaces/{id}) to structure a workspace's documents by team, department, or matter.

OpenAPI Specification

contractbook-openapi.json Raw ↑
{
  "components": {
    "responses": {},
    "schemas": {
      "AutomationIndexResponse": {
        "additionalProperties": false,
        "description": "A list of automations",
        "properties": {
          "automations": {
            "items": {
              "additionalProperties": false,
              "description": "Preview of an automation",
              "properties": {
                "id": {
                  "description": "Automation ID",
                  "example": "6b6314b6-56f9-4454-869a-84c96682cea9",
                  "format": "uuid",
                  "maxLength": 36,
                  "minLength": 36,
                  "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                  "type": "string"
                },
                "inserted_at": {
                  "description": "Date and time when the automation was created",
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "description": "Automation Name",
                  "example": "Generate Employment agreement",
                  "type": "string"
                },
                "published": {
                  "description": "Is automation published?",
                  "example": true,
                  "type": "boolean"
                },
                "updated_at": {
                  "description": "Date and time when the automation was las updated",
                  "format": "date-time",
                  "type": "string"
                }
              },
              "title": "AutomationPreview",
              "type": "object"
            },
            "type": "array"
          }
        },
        "title": "AutomationIndexResponse",
        "type": "object"
      },
      "AutomationPreview": {
        "additionalProperties": false,
        "description": "Preview of an automation",
        "properties": {
          "id": {
            "description": "Automation ID",
            "example": "6b6314b6-56f9-4454-869a-84c96682cea9",
            "format": "uuid",
            "maxLength": 36,
            "minLength": 36,
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
            "type": "string"
          },
          "inserted_at": {
            "description": "Date and time when the automation was created",
            "format": "date-time",
            "type": "string"
          },
          "name": {
            "description": "Automation Name",
            "example": "Generate Employment agreement",
            "type": "string"
          },
          "published": {
            "description": "Is automation published?",
            "example": true,
            "type": "boolean"
          },
          "updated_at": {
            "description": "Date and time when the automation was las updated",
            "format": "date-time",
            "type": "string"
          }
        },
        "title": "AutomationPreview",
        "type": "object"
      },
      "AutomationRunRequest": {
        "additionalProperties": false,
        "description": "Payload that will be passed to the automation when running it",
        "properties": {
          "attachments": {
            "description": "Publicly accesible links to files",
            "example": [
              "https://contractbook.com/file.pdf"
            ],
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "contacts": {
            "description": "List of Salesforce Contact IDs",
            "example": [
              "0030900000Ujt0BAAR",
              "0030900000Ujt0GAAR"
            ],
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "object_id": {
            "example": "0060900000FpKajAAF",
            "type": "string"
          },
          "object_type": {
            "example": "Opportunity",
            "type": "string"
          }
        },
        "required": [
          "object_type",
          "object_id"
        ],
        "title": "AutomationRunRequest",
        "type": "object"
      },
      "BadRequestError": {
        "additionalProperties": false,
        "description": "Bad Request",
        "properties": {
          "error": {
            "additionalProperties": false,
            "properties": {
              "failures": {
                "description": "List of request errors",
                "items": {
                  "additionalProperties": false,
                  "description": "Error description",
                  "properties": {
                    "detail": {
                      "description": "Details of the error",
                      "type": "string"
                    },
                    "source": {
                      "additionalProperties": false,
                      "properties": {
                        "pointer": {
                          "description": "Failing field name or reference",
                          "type": "string"
                        }
                      },
                      "required": [
                        "pointer"
                      ],
                      "type": "object"
                    },
                    "title": {
                      "description": "Title of the error",
                      "type": "string"
                    }
                  },
                  "required": [
                    "title",
                    "detail"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "message": {
                "description": "Error details message",
                "example": "Bad Request",
                "type": "string"
              },
              "type": {
                "description": "HTTP error message",
                "example": "bad_request",
                "type": "string"
              }
            },
            "readOnly": true,
            "required": [
              "type",
              "message"
            ],
            "type": "object"
          }
        },
        "readOnly": true,
        "required": [
          "error"
        ],
        "title": "BadRequestError",
        "type": "object"
      },
      "ConflictError": {
        "additionalProperties": false,
        "description": "Conflict",
        "properties": {
          "error": {
            "additionalProperties": false,
            "properties": {
              "message": {
                "description": "Error details message",
                "example": "Conflict",
                "type": "string"
              },
              "type": {
                "description": "HTTP error message",
                "example": "conflict",
                "type": "string"
              }
            },
            "readOnly": true,
            "required": [
              "type",
              "message"
            ],
            "type": "object"
          }
        },
        "readOnly": true,
        "required": [
          "error"
        ],
        "title": "ConflictError",
        "type": "object"
      },
      "DataField": {
        "description": "Data field",
        "properties": {
          "config": {
            "additionalProperties": false,
            "description": "Additional config for this data field. Contains `options` for `select`, or `label` for `checkbox`.",
            "nullable": false,
            "properties": {
              "label": {
                "nullable": true,
                "required": false,
                "type": "string"
              },
              "options": {
                "items": {
                  "type": "string"
                },
                "required": false,
                "type": "array"
              }
            },
            "type": "object"
          },
          "description": {
            "description": "Description",
            "nullable": true,
            "type": "string"
          },
          "formatting": {
            "additionalProperties": false,
            "description": "Formatting",
            "nullable": true,
            "properties": {
              "fractional": {
                "nullable": true,
                "type": "boolean"
              },
              "grouping": {
                "enum": [
                  "",
                  "dot",
                  "comma",
                  "space"
                ],
                "nullable": true,
                "type": "string"
              }
            },
            "type": "object"
          },
          "id": {
            "description": "Unique ID",
            "format": "uuid",
            "nullable": false,
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
            "type": "string"
          },
          "name": {
            "description": "Name",
            "nullable": false,
            "type": "string"
          },
          "required": {
            "description": "Whether this data field must be filled to send the document for signature",
            "type": "boolean"
          },
          "source": {
            "description": "Source of data for this data field",
            "enum": [
              "drafter_questionnaire",
              "ai",
              "salesforce"
            ],
            "nullable": true,
            "type": "string"
          },
          "source_mapping": {
            "description": "Integration data mapping for this data field. Revealed only when connected to the same integration instance.",
            "nullable": true,
            "type": "string"
          },
          "source_sync_type": {
            "description": "Integration sync mode for this data field. Revealed only when connected to the same integration instance.",
            "enum": [
              "downstream",
              "upstream",
              "bidirectional"
            ],
            "nullable": true,
            "type": "string"
          },
          "type": {
            "description": "Type",
            "enum": [
              "text",
              "number",
              "date",
              "select",
              "checkbox"
            ],
            "nullable": false,
            "type": "string"
          },
          "value": {
            "description": "Value",
            "nullable": true,
            "type": "string"
          }
        },
        "required": [
          "id",
          "value",
          "formatting",
          "description",
          "config",
          "name",
          "type",
          "required",
          "source",
          "source_mapping",
          "source_sync_type"
        ],
        "title": "DataField",
        "type": "object"
      },
      "DataFieldCreateOrUpdate": {
        "description": "Create or update data field schema",
        "properties": {
          "config": {
            "additionalProperties": false,
            "description": "Additional config for this data field. Contains `options` for `select`, or `label` for `checkbox`.",
            "nullable": false,
            "properties": {
              "label": {
                "nullable": true,
                "required": false,
                "type": "string"
              },
              "options": {
                "items": {
                  "type": "string"
                },
                "required": false,
                "type": "array"
              }
            },
            "type": "object"
          },
          "description": {
            "description": "Description",
            "nullable": true,
            "type": "string"
          },
          "formatting": {
            "additionalProperties": false,
            "description": "Formatting",
            "nullable": true,
            "properties": {
              "fractional": {
                "nullable": true,
                "type": "boolean"
              },
              "grouping": {
                "enum": [
                  "",
                  "dot",
                  "comma",
                  "space"
                ],
                "nullable": true,
                "type": "string"
              }
            },
            "type": "object"
          },
          "id": {
            "description": "Unique ID",
            "format": "uuid",
            "nullable": false,
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
            "type": "string"
          },
          "name": {
            "description": "Name",
            "nullable": false,
            "type": "string"
          },
          "required": {
            "description": "Whether this data field must be filled to send the document for signature",
            "type": "boolean"
          },
          "source": {
            "description": "Source of data for this data field",
            "enum": [
              "drafter_questionnaire",
              "ai",
              "salesforce"
            ],
            "nullable": true,
            "type": "string"
          },
          "source_mapping": {
            "description": "Integration data mapping for this data field. Revealed only when connected to the same integration instance.",
            "nullable": true,
            "type": "string"
          },
          "source_sync_type": {
            "description": "Integration sync mode for this data field. Revealed only when connected to the same integration instance.",
            "enum": [
              "downstream",
              "upstream",
              "bidirectional"
            ],
            "nullable": true,
            "type": "string"
          },
          "type": {
            "description": "Type",
            "enum": [
              "text",
              "number",
              "date",
              "select",
              "checkbox"
            ],
            "nullable": false,
            "type": "string"
          },
          "value": {
            "description": "Value",
            "nullable": true,
            "type": "string"
          }
        },
        "required": [
          "value",
          "name",
          "type"
        ],
        "title": "DataFieldCreateOrUpdate",
        "type": "object"
      },
      "DocumentCreateRequest": {
        "additionalProperties": false,
        "description": "Used to create document draft from a template",
        "properties": {
          "document": {
            "additionalProperties": false,
            "description": "Document parameters",
            "properties": {
              "attachments": {
                "description": "Document attachments",
                "items": {
                  "additionalProperties": false,
                  "description": "Document attachment",
                  "properties": {
                    "filename": {
                      "description": "Optional attachment name. We will use it when the user downloads the attachment, as well as display it next to the attachment in the app and in the PDF.\n",
                      "example": "Document attachment 1",
                      "nullable": true,
                      "type": "string"
                    },
                    "original": {
                      "description": "URL of the attachment",
                      "example": "https://example.com/image.png",
                      "format": "uri",
                      "type": "string"
                    },
                    "preview": {
                      "description": "If the original is a document, this field will hold an list URL with image\npreviews of each page\n",
                      "items": {
                        "description": "Preview URL",
                        "example": "https://example.com/preview.png",
                        "format": "url",
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "nullable": true,
                "type": "array"
              },
              "attachments_signed_separately": {
                "description": "Indicates if the attachments should be signed and sealed separately",
                "example": true,
                "type": "boolean"
              },
              "company_logo_url": {
                "description": "The URL of the logo shown in the contract",
                "format": "uri",
                "nullable": true,
                "type": "string"
              },
              "data_fields": {
                "description": "Data fields in the document",
                "items": {
                  "description": "Create or update data field schema",
                  "properties": {
                    "config": {
                      "additionalProperties": false,
                      "description": "Additional config for this data field. Contains `options` for `select`, or `label` for `checkbox`.",
                      "nullable": false,
                      "properties": {
                        "label": {
                          "nullable": true,
                          "required": false,
                          "type": "string"
                        },
                        "options": {
                          "items": {
                            "type": "string"
                          },
                          "required": false,
                          "type": "array"
                        }
                      },
                      "type": "object"
                    },
                    "description": {
                      "description": "Description",
                      "nullable": true,
                      "type": "string"
                    },
                    "formatting": {
                      "additionalProperties": false,
                      "description": "Formatting",
                      "nullable": true,
                      "properties": {
                        "fractional": {
                          "nullable": true,
                          "type": "boolean"
                        },
                        "grouping": {
                          "enum": [
                            "",
                            "dot",
                            "comma",
                            "space"
                          ],
                          "nullable": true,
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "id": {
                      "description": "Unique ID",
                      "format": "uuid",
                      "nullable": false,
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                      "type": "string"
                    },
                    "name": {
                      "description": "Name",
                      "nullable": false,
                      "type": "string"
                    },
                    "required": {
                      "description": "Whether this data field must be filled to send the document for signature",
                      "type": "boolean"
                    },
                    "source": {
                      "description": "Source of data for this data field",
                      "enum": [
                        "drafter_questionnaire",
                        "ai",
                        "salesforce"
                      ],
                      "nullable": true,
                      "type": "string"
                    },
                    "source_mapping": {
                      "description": "Integration data mapping for this data field. Revealed only when connected to the same integration instance.",
                      "nullable": true,
                      "type": "string"
                    },
                    "source_sync_type": {
                      "description": "Integration sync mode for this data field. Revealed only when connected to the same integration instance.",
                      "enum": [
                        "downstream",
                        "upstream",
                        "bidirectional"
                      ],
                      "nullable": true,
                      "type": "string"
                    },
                    "type": {
                      "description": "Type",
                      "enum": [
                        "text",
                        "number",
                        "date",
                        "select",
                        "checkbox"
                      ],
                      "nullable": false,
                      "type": "string"
                    },
                    "value": {
                      "description": "Value",
                      "nullable": true,
                      "type": "string"
                    }
                  },
                  "required": [
                    "value",
                    "name",
                    "type"
                  ],
                  "title": "DataFieldCreateOrUpdate",
                  "type": "object"
                },
                "type": "array"
              },
              "dynamic_tables": {
                "items": {
                  "additionalProperties": false,
                  "description": "Fill the data of the dynamic tables placeholders placed inside your template",
                  "properties": {
                    "attrs": {
                      "description": "Attributes of the dynamic table",
                      "properties": {
                        "columns": {
                          "description": "Column names",
                          "items": {
                            "description": "Column name",
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "id": {
                          "description": "Dynamic table ID",
                          "type": "string"
                        },
                        "rows": {
                          "description": "Data for the table rows",
                          "items": {
                            "description": "Table row",
                            "items": {
                              "description": "Cell value",
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "type": "array"
                        }
                      },
                      "required": [
                        "id",
                        "columns",
                        "rows"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "attrs"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "language": {
                "description": "Language",
                "example": "en",
                "nullable": true,
                "type": "string"
              },
              "message": {
                "additionalProperties": false,
                "properties": {
                  "content": {
                    "description": "Message content",
                    "example": "Hello!",
                    "type": "string"
                  }
                },
                "type": "object"
              },
              "parties": {
                "description": "Parties and signees",
                "items": {
                  "additionalProperties": false,
                  "description": "Party",
                  "properties": {
                    "address": {
                      "description": "Address",
                      "example": "123 Main Street",
                      "nullable": true,
                      "type": "string"
                    },
                    "id": {
                      "description": "Unique ID",
                      "format": "uuid",
                      "nullable": true,
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                      "type": "string"
                    },
                    "name": {
                      "description": "Name",
                      "example": "Jane Doe",
                      "nullable": true,
                      "type": "string"
                    },
                    "number": {
                      "description": "Company's VAT number or CVR",
                      "nullable": true,
                      "type": "string"
                    },
                    "reference": {
                      "description": "How the party will be referred to in the document",
                      "example": "Sender",
                      "nullable": true,
                      "type": "string"
                    },
                    "signees": {
                      "description": "Party's signees",
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "changes_requested_at": {
                            "description": "Date and time when the signee requested changes to the document",
                            "format": "date-time",
                            "nullable": true,
                            "readOnly": true,
                            "type": "string"
                          },
                          "email": {
                            "description": "Signee's email address",
                            "format": "email",
                            "nullable": true,
                            "type": "string"
                          },
                          "full_name": {
                            "description": "Signee's full name",
                            "example": "Jane Doe",
                            "nullable": true,
                            "type": "string"
                          },
                          "id": {
                            "description": "Unique ID",
                            "format": "uuid",
                            "nullable": true,
                            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                            "type": "string"
                          },
                          "opened_at": {
                            "description": "Date and time when the signee opened the document",
                            "format": "date-time",
                            "nullable": true,
                            "readOnly": true,
                            "type": "string"
                          },
                          "order": {
                            "description": "Signee's signing order. When the signing order mode is set to `grouped`, then this number represents the signee's group number.",
                            "minimum": 0,
                            "type": "integer"
                          },
                          "rejected_at": {
                            "description": "Date and time when the signee rejected the document",
                            "format": "date-time",
                            "nullable": true,
                            "readOnly": true,
                            "type": "string"
                          },
                          "signature_verification_methods": {
                            "description": "List of allowed signature types for the signee",
                            "example": [
                              "sms",
                              "basic",
                              "wet_signature"
                            ],
                            "items": {
                              "enum": [
                                "sms",
                                "basic",
                                "wet_signature",
                                "criipto_dk_mitid_substantial",
                                "criipto_dk_mitid_business",
                                "criipto_no_bankid",
                                "criipto_se_bankid_same_device",
                                "criipto_se_bankid_another_device",
                                "criipto_fi_bankid",
                                "criipto_fi_bankid_mobile"
                              ],
                              "type": "string"
                            },
                            "nullable": true,
                            "type": "array"
                          },
                          "signed_at": {
                            "description": "Date and time when the signee signed the document",
                            "format": "date-time",
                            "nullable": true,
                            "readOnly": true,
                            "type": "string"
                          },
                          "title": {
                            "description": "Signee's title",
                            "example": "Software Engineer",
                            "nullable": true,
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "type": {
                      "description": "Type",
                      "enum": [
                        "personal",
                        "company"
                      ],
                      "nullable": false,
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "type": "array"
              },
              "signing_order_mode": {
                "description": "The signing order mode. When it's set to grouped, each signee in `parties.signees`, should have the order field set to the group's number starting from 0.",
                "enum": [
                  "random",
                  "strict",
                  "grouped"
                ],
                "example": "strict",
                "type": "string"
              },
              "tags": {
                "description": "Document's tags",
                "items": {
                  "example": "tags",
                  "minLength": 1,
                  "type": "string"
                },
                "nullable": false,
                "type": "array"
              },
              "title": {
                "description": "Document title",
                "type": "string"
              },
              "to_be_signed_by": {
                "description": "Who should sign the document",
                "enum": [
                  "owner_and_others",
                  "others_only",
                  "owner_only"
                ],
                "example": "owner_only",
                "type": "string"
              },
              "version": {
                "description": "The version has to be provided on update and match the latest document's version.\n\nYou can get it from the response when you get a document by ID.\nIt is also available in the response from document create or update actions.\n",
                "format": "uuid",
                "nullable": false,
                "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                "type": "string"
              }
            },
            "title": "DocumentUpdateAttibutes",
            "type": "object"
          }
        },
        "title": "DocumentCreateRequest",
        "type": "object"
      },
      "DocumentIndexResponse": {
        "additionalProperties": false,
        "description": "Paginated list of documents",
        "properties": {
          "documents": {
            "items": {
              "additionalProperties": false,
              "description": "Preview of a document",
              "properties": {
                "active_task_count": {
                  "description": "Numbe

# --- truncated at 32 KB (264 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/contractbook/refs/heads/main/openapi/contractbook-openapi.json