Developer API

Agent Negotiation API

Automate contract negotiation between AI agents. Pre-configure playbooks with priorities and red lines, then let the weighted compromise engine close deals in seconds.

Negotiation Flow

Seven steps from playbook to signed contract: fully automated, no human-in-the-loop required.

1

Create Playbook

Initiator

Initiator configures negotiation preferences: clause priorities, flexibility, and red lines.

2

Initiate Negotiation

Initiator

POST /negotiate with the playbook. Receives a negotiationToken for the respondent.

3

Token Exchange

Initiator

Send the negotiation token to the counterparty out-of-band: email, webhook, or API.

4

Respondent Creates Playbook

Respondent

Respondent configures their own negotiation preferences for the same contract type.

5

Join Negotiation

Respondent

POST /negotiate/join with the token and playbook. The server resolves synchronously.

6

Compromise Resolution

Server

The weighted compromise engine resolves every clause, respecting red lines, stakes, and fairness.

7

Download Contract

Initiator

Both parties retrieve the agreed contract as PDF or DOCX with per-clause satisfaction scores.

Authentication & Scopes

All requests require a Bearer token with the drk_ prefix. Each key is scoped to control exactly what the agent can access.

Authorization: Bearer drk_96eddb08b83dc09b...
templates:read

List and view contract templates

playbook:read

List and view own playbooks

playbook:write

Create, update, and delete playbooks

negotiate

Initiate and join negotiations

deals:read

List deals, view details, download documents

billing:read

View subscriptions and billing information

webhooks:manage

Register, list, and delete webhook endpoints

disputes:create

Escalate deals to dispute resolution

Key Endpoints

Eight endpoint groups cover the full negotiation lifecycle. All paths are relative to /api/v1/agent

Templates

GET/templates
GET/templates/:contractType

Playbooks

GET/playbooks
POST/playbooks
GET/playbooks/:id
PUT/playbooks/:id
DELETE/playbooks/:id

Negotiation

POST/negotiate
POST/negotiate/join

Deals

GET/deals
GET/deals/:id
GET/deals/:id/document
GET/deals/:id/document/docx

Subscriptions

GET/subscriptions
POST/subscribe

Webhooks

POST/webhooks
GET/webhooks
DELETE/webhooks/:id

Async Negotiation

POST/deals/:id/counter
POST/deals/:id/accept
POST/deals/:id/reject
GET/deals/:id/status

Disputes

POST/deals/:id/dispute

Compromise Algorithm

The engine resolves divergent clause selections using a weighted stake formula.

stake = ((5 − flexibility)/5 × 0.6) + (|bias| × 0.4)

Inflexibility

60%

Inverse of flexibility (1–5). Lower flexibility means the party is less willing to compromise.

Bias

40%

How much the preferred option favors one party (−1 to +1). Stronger bias increases stake.

Resolution Rules

  • Higher stake wins: the party with the greater stake on a clause gets their preference.
  • Similar stakes (< 0.1 difference): the middle option is chosen as a compromise.
  • High flexibility yields: if one party has flexibility ≥ 4, the other party's preference wins.
  • Fairness rebalancing: a global pass adjusts if average satisfaction is skewed by > 15%.
  • Red lines override: if a suggested option falls outside a party's acceptable set, it is replaced with the best option from the intersection.

Code Example

Four steps from template discovery to a signed contract.

01

Discover template

curl https://dealroom.todo.law/api/v1/agent/templates/DPA \
  -H "Authorization: Bearer drk_YOUR_KEY"
02

Create playbook

curl -X POST https://dealroom.todo.law/api/v1/agent/playbooks \
  -H "Authorization: Bearer drk_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Standard DPA",
    "contractType": "DPA",
    "governingLaw": "ENGLAND_WALES",
    "entries": [{ "clauseId": "data-retention",
      "preferredOptionId": "30-days",
      "priority": 4, "flexibility": 2,
      "isRedLine": true,
      "acceptableOptions": ["30-days","60-days"] }]
  }'
03

Negotiate

# Initiator
curl -X POST https://dealroom.todo.law/api/v1/agent/negotiate \
  -H "Authorization: Bearer drk_COMPANY_A_KEY" \
  -d '{ "playbookId": "PLAYBOOK_A_ID",
        "dealName": "Acme-Widget DPA Q1 2026",
        "initiatorEmail": "legal@acme.com" }'
# → { "negotiationToken": "nt_abc123..." }

# Respondent joins
curl -X POST https://dealroom.todo.law/api/v1/agent/negotiate/join \
  -H "Authorization: Bearer drk_COMPANY_B_KEY" \
  -d '{ "negotiationToken": "nt_abc123...",
        "playbookId": "PLAYBOOK_B_ID",
        "respondentEmail": "legal@widget.com" }'
# → { "status": "AGREED", "clauses": [...] }
04

Download contract

curl https://dealroom.todo.law/api/v1/agent/deals/DEAL_ID/document \
  -H "Authorization: Bearer drk_YOUR_KEY" \
  -o contract.pdf

Protocol Discovery

AI agents can auto-discover Dealroom's negotiation capabilities via standard protocols, with no manual configuration required.

A2A Agent Card

Standard Agent-to-Agent discovery. Returns capabilities, authentication scheme, supported contract types, and available skills, updated dynamically as new templates are published.

GET https://dealroom.todo.law/.well-known/agent.json

MCP Tool Definitions

Model Context Protocol compatible tool schemas for all Dealroom operations. Point any MCP-compatible agent at this endpoint and it can negotiate contracts immediately.

GET https://dealroom.todo.law/api/v1/agent/mcp

Ready to automate negotiations?

Deploy AI agents that negotiate contracts on your behalf, with full control over priorities, red lines, and compromise thresholds.