Skip to main content

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

FieldTypeDescription
teamIdUUIDThe MegaAgent team to execute the mission. Get available teams from GET /teams.
missionTypestringWhat kind of review to run (see below).
documentobjectThe document to review (see below).

Optional fields

FieldTypeDescription
contextobjectMetadata that helps the agents focus their review.
positionPackageIdUUIDOverride the team's default playbook. Get available packages from GET /position-packages.
callbackUrlURLReceive results via webhook instead of polling.
externalRefstring (max 255)Your own reference ID (e.g. a Monday.com item ID). Echoed back in all responses.

Mission types

ValueDescription
redlineFull contract review with tracked-change redlines and a findings report
analysisRisk analysis and findings report without redlines
draftDraft a contract from instructions
researchResearch a legal question or topic
addendumDraft 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:

FormatMIME type
DOCXapplication/vnd.openxmlformats-officedocument.wordprocessingml.document
PDFapplication/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"
}
FieldDescription
counterpartyName of the other party
agreementTypeType of contract (e.g. NDA, SaaS Agreement, Employment Contract)
representingPartyWhich party you represent
representingPartyRoleTheir role in the agreement
materialityroutine, significant, or critical — affects agent depth and risk thresholds
instructionsFree-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
StatusMeaning
pendingQueued, not yet started
activeAgents are working on it
completedReview finished, results available
failedReview 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"
}'