Submit a Mission
POST /api/external/v1/missions
Submits a document for async processing. Returns 202 Accepted immediately. The mission executes in the background — retrieve results by polling or callback.
Request body
Required fields
| Field | Type | Description |
|---|---|---|
teamId | UUID | The MegaAgent team to execute the mission. Get available teams from GET /teams. |
missionType | string | What kind of review to run (see below). |
document | object | The document to review (see below). |
Optional fields
| Field | Type | Description |
|---|---|---|
context | object | Metadata that helps the agents focus their review. |
positionPackageId | UUID | Override the team's default playbook. Get available packages from GET /position-packages. |
callbackUrl | URL | Receive results via webhook instead of polling. |
externalRef | string (max 255) | Your own reference ID (e.g. a Monday.com item ID). Echoed back in all responses. |
Mission types
| Value | Description |
|---|---|
redline | Full contract review with tracked-change redlines and a findings report |
analysis | Risk analysis and findings report without redlines |
draft | Draft a contract from instructions |
research | Research a legal question or topic |
addendum | Draft an addendum to an existing contract |
Document encoding
The document object has three fields:
{
"base64": "<base64-encoded file content>",
"filename": "contract.docx",
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
}
Supported formats:
| Format | MIME type |
|---|---|
| DOCX | application/vnd.openxmlformats-officedocument.wordprocessingml.document |
application/pdf |
Size limit: 60 MB (after base64 encoding, which adds ~33% overhead — so keep source files under ~45 MB).
Context object
Providing context improves review quality significantly:
{
"counterparty": "Acme Corp",
"agreementType": "NDA",
"representingParty": "Our Client Inc",
"representingPartyRole": "disclosing_party",
"materiality": "significant",
"instructions": "Focus on IP assignment and non-compete clauses"
}
| Field | Description |
|---|---|
counterparty | Name of the other party |
agreementType | Type of contract (e.g. NDA, SaaS Agreement, Employment Contract) |
representingParty | Which party you represent |
representingPartyRole | Their role in the agreement |
materiality | routine, significant, or critical — affects agent depth and risk thresholds |
instructions | Free-text instructions for the agents |
Response
202 Accepted:
{
"success": true,
"mission": {
"id": "7f3a9c12-...",
"name": "Contract Review — Acme Corp",
"missionType": "redline",
"status": "pending",
"stage": "incoming"
},
"jobId": "abc123...",
"pollUrl": "/api/external/v1/missions/7f3a9c12-..."
}
Status lifecycle
pending → active → completed
↘ failed
| Status | Meaning |
|---|---|
pending | Queued, not yet started |
active | Agents are working on it |
completed | Review finished, results available |
failed | Review could not be completed |
The stage field provides finer-grained progress within each status (e.g. incoming, reviewing, redlining, done).
Full example
curl -X POST https://app.drafted.li/api/external/v1/missions \
-H "Authorization: Bearer dk_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"teamId": "550e8400-e29b-41d4-a716-446655440000",
"missionType": "redline",
"document": {
"base64": "UEsDBBQAAAAIAA==...",
"filename": "NDA_Acme.docx",
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
},
"context": {
"counterparty": "Acme Corp",
"agreementType": "NDA",
"materiality": "significant"
},
"callbackUrl": "https://your-system.com/webhooks/drafted",
"externalRef": "monday-item-12345"
}'