Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.offloadapi.com/llms.txt

Use this file to discover all available pages before exploring further.

Endpoint

POST /cases

Purpose

Creates a case, stores it with status: "CREATED", and queues async processing for the initial outreach.

Authentication

x-api-key: your-api-key

Request Body

Top-Level Fields

FieldTypeRequiredNotes
channelEMAIL | SMSYesThe schema accepts both values, but the implemented workflow is email-based. Use EMAIL.
goalobjectYesMust include objective.
counterpartyobjectYesMust include address and name.
senderPersonaobjectYesMust include name.
clientReferenceIdstringNoYour own identifier for joining Offload cases back to your records.
constraintsstring[]NoFree-form instructions passed into the worker prompts.
maxAttemptsintegerNoDefaults to 3. This is the number of automated follow-up attempts after the initial outreach.
followUpDelayHoursintegerNoDefaults to 72. Must be a positive integer.
resultSchemaobjectNoExpected to be JSON Schema-shaped, but only validated as a generic object.
clientWebhookUrlstringNoMust be a valid URL. Offload sends async events here if present.
metadataobjectNoOpaque JSON echoed in webhook payloads.

goal

FieldTypeRequiredNotes
objectivestringYesPlain-language outcome you want Offload to reach.
knowledgestring | objectNoExtra context the worker can use while writing and evaluating messages.

counterparty

FieldTypeRequiredNotes
addressstringYesCurrent implementation uses this as the email recipient.
namestringYesHuman-readable name used in the workflow.
companystringNoOptional extra context.
timezonestringNoOptional extra context.
customDataobjectNoString-to-string map only.

senderPersona

FieldTypeRequiredNotes
namestringYesSender name used in prompts.
rolestringNoOptional role or title.
companystringNoOptional company name.
tonestringNoOptional tone guidance.

Example Request

curl -X POST "$OFFLOAD_BASE_URL/cases" \
  -H "Content-Type: application/json" \
  -H "x-api-key: $OFFLOAD_API_KEY" \
  -d '{
    "clientReferenceId": "vendor_2048",
    "channel": "EMAIL",
    "maxAttempts": 3,
    "followUpDelayHours": 72,
    "goal": {
      "objective": "Collect a signed W-9 from the vendor",
      "knowledge": {
        "vendorName": "Northstar Supplies",
        "reason": "AP onboarding"
      }
    },
    "counterparty": {
      "address": "ap@northstar.example",
      "name": "Maya Chen",
      "company": "Northstar Supplies",
      "timezone": "America/Los_Angeles",
      "customData": {
        "vendorId": "vendor_2048"
      }
    },
    "senderPersona": {
      "name": "Avery",
      "role": "Accounts Payable",
      "company": "Example Corp",
      "tone": "friendly, concise"
    },
    "constraints": [
      "Email only"
    ],
    "resultSchema": {
      "type": "object",
      "properties": {
        "signedW9Received": { "type": "boolean" },
        "receivedAt": { "type": "string" }
      },
      "required": ["signedW9Received"]
    },
    "clientWebhookUrl": "https://your-app.example/webhooks/offload",
    "metadata": {
      "vendorId": "vendor_2048"
    }
  }'

Successful Response

{
  "ok": true,
  "data": {
    "caseId": "4fc5904d-0e44-4ed3-aa57-c4a47ad0ae4f"
  }
}

What Happens Next

After the API returns 201:
  1. the case exists in storage
  2. an internal CASE_CREATED event is queued
  3. the worker later drafts and sends the initial outreach
  4. if that send succeeds, the case moves to RUNNING

Errors

StatusCodeMeaning
400INVALID_REQUESTMalformed JSON or validation failure
401UNAUTHORIZEDMissing or invalid API key
403FORBIDDENAPI key exists but is not active
429USAGE_LIMIT_REACHEDMonthly case cap reached for the current UTC month
500INTERNAL_ERRORPersistence or queueing failed
API Gateway also applies route throttling. A platform-generated throttling response may also be 429, but it may not use the standard JSON envelope.