Pactly Public API (0.2.0)

Download OpenAPI specification:

The Pactly Public API provides programmatic access to contract lifecycle management capabilities, enabling integration with your existing systems. Key features include:

• Contract Management: Create, retrieve, update, and search contracts across your organization • Template Operations: Access and manage contract templates for consistent document generation • Document Generation: Generate contracts from templates with dynamic variable substitution • Text Extraction: Extract and analyze text content from contracts and documents • Workflow Automation: Trigger workflows and track contract lifecycle events

The API follows RESTful principles and returns JSON responses. All endpoints require authentication via API key.

Contracts

Operations related to contract management including creation, retrieval, updates, and text extraction

List contracts

List contracts across all three contract types, newest first.

Results are cursor-paginated: pass the cursor from a response back to fetch the next page and stop when hasMore is false. The cursor encodes the sort position and is opaque — do not build one.

Filters combine with AND. party and counterparty both narrow by the parties linked to a contract: party takes a party id from GET /v1/parties, counterparty matches a name and is the convenience form. Property values filter as property[<key>]=<value> using a key from GET /v1/properties; an unknown key is rejected rather than ignored.

Authorizations:
ApiKeyAuth
query Parameters
keyword
string

Match against contract name and reference

type
string
Enum: "template" "playbook" "external"

Restrict to one contract type

status
string

Comma-separated status codes: 1=Draft, 2=In Negotiation, 3=Pending Approval, 4=Pending Signature, 5=Executed, 6=Terminated. e.g. status=2,3,4 for everything in flight.

party
string^[0-9a-fA-F]{24}$

Only contracts linked to this party

counterparty
string

Only contracts linked to a party matching this name

partyRole
string
Enum: "counterparty" "signer" "counterparty_representative" "our_representative"

Narrow a party or counterparty filter to one role on the contract

category
string^[0-9a-fA-F]{24}$

Category id from GET /v1/categories

owner
string^[0-9a-fA-F]{24}$

User id of the contract owner

createdAfter
string <date-time>

Only contracts created after this date (ISO 8601)

createdBefore
string <date-time>

Only contracts created before this date (ISO 8601)

updatedAfter
string <date-time>

Only contracts updated after this date (ISO 8601)

updatedBefore
string <date-time>

Only contracts updated before this date (ISO 8601)

renewalAfter
string <date-time>

Renewal anchor on or after this date — with renewalBefore, this is the "expiring soon" query

renewalBefore
string <date-time>

Renewal anchor on or before this date

renewalState
string

Filter by renewal state

object

Filter by contract property value: property[<key>]=<value>, where <key> comes from GET /v1/properties. Values are coerced to the property's declared type; an unknown key or an operator in place of a value is rejected.

sort
string
Default: "createdAt"
Enum: "createdAt" "updatedAt" "renewalAnchorDate"

Sorting by renewalAnchorDate returns only contracts that have one

order
string
Default: "desc"
Enum: "asc" "desc"
cursor
string

Opaque cursor from a previous response

pagesize
integer [ 1 .. 200 ]
Default: 50

Page size (capped at 200)

Responses

Response samples

Content type
application/json
{
  • "contracts": [
    ],
  • "pagination": {
    }
}

Generate contract

Generate a new contract from a template.

values is a flat map keyed by the variable, valuemap and party ids from GET /v1/templates/{id}: a scalar for a variable, the chosen label (an array of labels for a multi-selection valuemap) for a valuemap, and an object of the declared attributes for a party. An unknown key, a wrong type, an unknown label or a missing required value is a 400 naming what is wrong. A value that is not supplied renders as [●].

options.persist (default true) decides whether Pactly keeps the contract. Persisted contracts are returned as a record you then fetch with GET /v1/contracts/{id}/download; ephemeral ones ("persist": false) keep nothing — no contract, no file, no audit event — and the document comes back base64-encoded in the response.

options.triggerWorkflows defaults to the value of persist and sends real email to real people, so turn it off for a bulk import. It cannot be enabled without persisting: a workflow has no contract to act on.

Authorizations:
ApiKeyAuth
Request Body schema: application/json
required
templateId
required
string^[0-9a-fA-F]{24}$

Template to generate from

contractName
string <= 256 characters
Default: "Pactly contract"

Name for the generated contract

object

Flat map keyed by the ids from GET /v1/templates/{id}. A variable takes a value of its declared valueType — a string for text (numbers are rejected, not coerced), a real boolean for boolean. A valuemap takes the chosen label — an array of labels when allowMultipleSelection is true, a single label when it is not. A party takes an object of its declared attributes, plus "type" ("entity" or "individual") when the template leaves the party type "unknown". Anything omitted renders as [●].

object

Responses

Request samples

Content type
application/json
{
  • "templateId": "string",
  • "contractName": "Pactly contract",
  • "values": {
    },
  • "options": {
    }
}

Response samples

Content type
application/json
Example
{
  • "persisted": true,
  • "id": "string",
  • "name": "string",
  • "reference": "string",
  • "template": "string",
  • "company": "string",
  • "createdAt": "2019-08-24T14:15:22Z",
  • "effectiveDate": "2019-08-24T14:15:22Z",
  • "values": { }
}

Get contract details

Retrieve detailed information about a specific contract including all properties, metadata, and status information.

Authorizations:
ApiKeyAuth
path Parameters
id
required
string

Route pattern variable id

Responses

Response samples

Content type
application/json
{
  • "id": "507f1f77bcf86cd799439011",
  • "type": "template",
  • "name": "Software License Agreement - Acme Corp",
  • "reference": "SLA-2024-001",
  • "status": "executed",
  • "createdAt": "2024-01-15T10:30:00Z",
  • "updatedAt": "2024-01-20T14:45:00Z",
  • "finalizedAt": "2024-01-20T14:45:00Z",
  • "executedAt": "2024-01-20T15:00:00Z",
  • "executionMethod": "docusign",
  • "archived": false,
  • "deleted": false,
  • "aborted": false,
  • "final": true,
  • "hubRequestStatus": "completed",
  • "properties": {
    },
  • "user": "507f1f77bcf86cd799439012",
  • "template": "507f1f77bcf86cd799439013"
}

Extract contract text

Extract and return the full text content of a contract. Useful for search, analysis, and AI processing.

Authorizations:
ApiKeyAuth
path Parameters
id
required
string^[0-9a-fA-F]{24}$

Contract ID (MongoDB ObjectId format)

Responses

Response samples

Content type
application/json
{
  • "contractId": "507f1f77bcf86cd799439011",
  • "name": "Software License Agreement - Acme Corp",
  • "text": [
    ]
}

Download contract

Download a contract file by ID

Authorizations:
ApiKeyAuth
path Parameters
id
required
string^[0-9a-fA-F]{24}$

Contract ID (MongoDB ObjectId format)

Responses

Response samples

Content type
application/json
{
  • "error": "Bad Request",
  • "message": "Invalid contract ID format"
}

Templates

Manage contract templates that serve as the foundation for generating new contracts

List all templates

Retrieve all available contract templates that can be used to create new contracts.

Authorizations:
ApiKeyAuth

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get template details

Retrieve detailed information about a specific template including variables and value mappings.

Authorizations:
ApiKeyAuth
path Parameters
id
required
string^[0-9a-fA-F]{24}$

Template ID (MongoDB ObjectId format)

Responses

Response samples

Content type
application/json
{
  • "id": "507f1f77bcf86cd799439013",
  • "name": "Software License Agreement Template",
  • "version": "2.1.0",
  • "description": "Standard template for software licensing agreements with customizable terms",
  • "createdAt": "2023-06-15T08:00:00Z",
  • "variables": [
    ],
  • "valuemaps": [
    ],
  • "parties": [
    ]
}

Emails

Email-related operations

List contract emails

List all emails associated with contracts (for AI training)

Authorizations:
ApiKeyAuth
query Parameters
pagesize
integer
Default: 100

Number of emails to return

cursor
string

Cursor for pagination

contractType
string
Enum: "template" "playbook" "external"

Filter by contract type

contractId
string

Filter by specific contract ID

sender
string

Filter by sender email

dateFrom
string <date>

Filter emails from this date

dateTo
string <date>

Filter emails until this date

Responses

Response samples

Content type
application/json
{
  • "emails": [
    ],
  • "pagination": {
    }
}

Properties

Contract property definitions that define the metadata fields available on contracts

List property definitions

Retrieve all contract property definitions available to the company, including system default properties.

Authorizations:
ApiKeyAuth

Responses

Response samples

Content type
application/json
{
  • "properties": [
    ]
}

Get property definition

Retrieve a single property definition by its ID or unique key.

Authorizations:
ApiKeyAuth
path Parameters
idOrKey
required
string

Property ID (MongoDB ObjectId) or property key

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "key": "string",
  • "label": "string",
  • "description": "string",
  • "type": "string",
  • "options": { },
  • "group": "string",
  • "subGroup": "string",
  • "sortOrder": 0,
  • "isDefault": true,
  • "manualOnly": true
}

Categories

Contract categories used to classify and organize contracts

List categories

Retrieve all contract categories available to the company, including system default categories.

Authorizations:
ApiKeyAuth

Responses

Response samples

Content type
application/json
{
  • "categories": [
    ]
}

Parties

List parties

List the parties (counterparties, entities and individuals) in the contact book. Excludes parties still awaiting confirmation — an AI-extracted party a person has not accepted is a suggestion, not a counterparty — and soft-deleted parties.

keyword matches the normalised search string, so "ASTAR" finds "A*STAR". Results are cursor-paginated: pass the cursor from a response back to fetch the next page, and stop when hasMore is false. A cursor is opaque and must not be constructed by hand.

Authorizations:
ApiKeyAuth
query Parameters
keyword
string

Match against party names, entity names and abbreviations

isEntity
boolean

true returns only organisations, false only individuals; omit for both

isInternal
boolean

true returns only your own entities, false only external counterparties

parent
string^[0-9a-fA-F]{24}$

Return the children of this party — the way to walk a corporate group

cursor
string

Opaque cursor from a previous response

pagesize
integer [ 1 .. 200 ]
Default: 50

Page size (capped at 200)

order
string
Default: "desc"
Enum: "asc" "desc"

Sort direction on creation date

Responses

Response samples

Content type
application/json
{
  • "parties": [
    ],
  • "pagination": {
    }
}

List party attributes

The custom attribute definitions for parties. A party carries its values in customAttributes keyed by the key returned here, the same way a contract pairs its property values with GET /v1/properties.

Authorizations:
ApiKeyAuth

Responses

Response samples

Content type
application/json
{
  • "partyAttributes": [
    ]
}

Get party

Get a single party by id.

Authorizations:
ApiKeyAuth
path Parameters
id
required
string^[0-9a-fA-F]{24}$

Party ID (MongoDB ObjectId format)

Responses

Response samples

Content type
application/json
{
  • "party": {
    }
}

Clauses

List clauses

List the clause library — the pre-approved language an agent should propose instead of drafting its own.

Visibility follows the key owner: an admin key sees the whole library, a grouped user sees their groups, and a key owned by a lite user is refused, because lite users have no Clause Bank.

Authorizations:
ApiKeyAuth
query Parameters
tag
string

Filter by tag

cursor
string

Opaque cursor from a previous response

pagesize
integer [ 1 .. 200 ]
Default: 50
order
string
Default: "desc"
Enum: "asc" "desc"

Responses

Response samples

Content type
application/json
{
  • "clauses": [
    ],
  • "pagination": {
    }
}

Playbooks

List playbooks

List the playbooks in force — your negotiation positions as structured data. Returns your own playbooks and any Pactly-provided default you have not switched off; isDefault tells them apart. Only production versions are returned, because a draft is not policy.

Positions are omitted here; fetch one playbook to get them.

Authorizations:
ApiKeyAuth
query Parameters
cursor
string

Opaque cursor from a previous response

pagesize
integer [ 1 .. 200 ]
Default: 50
order
string
Default: "desc"
Enum: "asc" "desc"

Responses

Response samples

Content type
application/json
{
  • "playbooks": [
    ],
  • "pagination": {
    }
}

Get playbook

A playbook with its positions: keywords, fallback language, and what a missing clause means for each position (ifNotFound).

Positions still awaiting human confirmation are excluded — an AI-suggested position is not policy until someone accepts it — and counted in unconfirmedPositionCount. Position notes are limited to drafting guidance; internal rationale and escalation routing are not published.

Authorizations:
ApiKeyAuth
path Parameters
id
required
string^[0-9a-fA-F]{24}$

Playbook ID (MongoDB ObjectId format)

Responses

Response samples

Content type
application/json
{
  • "playbook": {
    }
}

Match a document against a playbook

Report which playbook position keywords appear in a document, and where.

This is keyword matching, not a compliance review. It returns no verdict on whether a position is met — deciding that is a separate AI evaluation. Use the matches, each position's fallback language and its ifNotFound setting to reach your own conclusion.

Send paragraphs as an array of strings, exactly the shape GET /v1/contracts/{id}/text returns. Nothing is persisted: no review, no round, no change to the contract.

Authorizations:
ApiKeyAuth
path Parameters
id
required
string^[0-9a-fA-F]{24}$

Playbook ID (MongoDB ObjectId format)

Request Body schema: application/json
required
paragraphs
required
Array of strings <= 5000 items

The document text, one entry per paragraph

Responses

Request samples

Content type
application/json
{
  • "paragraphs": [
    ]
}

Response samples

Content type
application/json
{
  • "playbook": {
    },
  • "positions": [
    ]
}

Test endpoint

Test endpoint to test API connectivity and authentication

Authorizations:
ApiKeyAuth

Responses

Response samples

Content type
application/json
{
  • "message": "string"
}