Sendabrief logoSendabrief

API Documentation

The Sendabrief REST API lets you manage SOPs programmatically, create, read, update, and delete SOPs from any language or tool. It's available on the Agency plan.

You need an API key to use this API. Generate one in your settings →

Authentication

Every request must include an Authorization header with a Bearer token:

Authorization: Bearer sb_your_api_key_here

API keys are scoped to a workspace and carry Agency-plan permissions. Keys are shown only once when created, store them securely (e.g. an environment variable). You can revoke a key at any time from Settings → API.

Base URL

https://sendabrief.com/api/v1

All endpoints are relative to this base URL.

Rate limiting

Each API key is limited to 100 requests per 60-second window (sliding). Every response includes the following headers:

HeaderDescription
X-RateLimit-LimitMaximum requests allowed per window (100)
X-RateLimit-RemainingRequests remaining in the current window
X-RateLimit-ResetUnix timestamp (ms) when the window resets

When the limit is exceeded, the API returns 429 Too Many Requests with error code RATE_LIMITED.

CORS

All API endpoints support cross-origin requests from any origin. The API returns the following CORS headers:

Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PATCH, DELETE, OPTIONS
Access-Control-Allow-Headers: Authorization, Content-Type

Preflight OPTIONS requests are handled automatically on all routes.

Errors

All errors follow a consistent JSON shape:

{
  "error": "Human-readable message",
  "code":  "MACHINE_READABLE_CODE"
}

Use the code field for programmatic error handling:

CodeStatusMeaning
MISSING_AUTH401No Authorization header was sent.
INVALID_KEY_FORMAT401Key does not start with sb_ or is the wrong length.
INVALID_API_KEY401Key not found in database or has been revoked.
KEY_REVOKED401Key exists but was explicitly revoked.
PLAN_REQUIRED403The workspace is not on the Agency plan.
RATE_LIMITED429More than 100 requests in the last 60 seconds.
NOT_FOUND404The requested resource does not exist in this workspace.
VALIDATION_ERROR400The request body failed validation.
INTERNAL_ERROR500Unexpected server error.
GET/sops

List SOPs

Returns a paginated list of all SOPs in your workspace, ordered by last-updated descending.

Query parameters

ParameterTypeRequiredDescription
pageintegerNoPage number (default: 1)
limitintegerNoResults per page, 1–100 (default: 20)

Response

{
  "data": [
    {
      "id": "uuid",
      "title": "Onboard a new client",
      "trigger": "When a contract is signed",
      "steps": [{ "order": 1, "text": "Send welcome email", "role": "Account Manager" }],
      "roles": ["Account Manager"],
      "notes": null,
      "input_type": "transcript",
      "created_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-01T00:00:00Z"
    }
  ],
  "meta": {
    "page": 1,
    "limit": 20,
    "total": 42,
    "totalPages": 3
  }
}

Error codes

StatusCodeReason
401MISSING_AUTHNo Authorization header provided
401INVALID_API_KEYKey not found or revoked
403PLAN_REQUIREDWorkspace is not on the Agency plan
429RATE_LIMITED100 req/min exceeded

Example

curl -X GET "https://sendabrief.com/api/v1/sops" \
  -H "Authorization: Bearer sb_your_key_here"
POST/sops

Create a SOP

Creates a new SOP from structured JSON. Does not use AI generation, steps are stored exactly as provided.

Request body

{
  "title": "Onboard a new client",          // required
  "steps": [                                 // required, non-empty
    { "text": "Send welcome email", "role": "Account Manager" },
    { "text": "Schedule kickoff call" }
  ],
  "trigger": "When a contract is signed",   // optional
  "roles": ["Account Manager"],             // optional
  "notes": "Free-text notes",               // optional
  "input_type": "transcript"                // optional: transcript | audio | chat
}

Response

{
  "data": {
    "id": "uuid",
    "title": "Onboard a new client",
    "trigger": "When a contract is signed",
    "steps": [
      { "order": 1, "text": "Send welcome email", "role": "Account Manager" },
      { "order": 2, "text": "Schedule kickoff call", "role": null }
    ],
    "roles": ["Account Manager"],
    "notes": null,
    "input_type": "transcript",
    "created_at": "2024-01-01T00:00:00Z",
    "updated_at": "2024-01-01T00:00:00Z"
  }
}

Error codes

StatusCodeReason
400VALIDATION_ERRORtitle missing, steps empty, or steps[n].text missing
401INVALID_API_KEYKey not found or revoked
403PLAN_REQUIREDAgency plan required
429RATE_LIMITED100 req/min exceeded

Example

curl -X POST "https://sendabrief.com/api/v1/sops" \
  -H "Authorization: Bearer sb_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"title":"My SOP","steps":[{"text":"First step"}]}'
GET/sops/:id

Get a SOP

Fetches a single SOP by its UUID. The SOP must belong to the authenticated workspace.

Response

{
  "data": {
    "id": "uuid",
    "title": "Onboard a new client",
    "trigger": "When a contract is signed",
    "steps": [
      { "order": 1, "text": "Send welcome email", "role": "Account Manager" }
    ],
    "roles": ["Account Manager"],
    "notes": null,
    "input_type": "transcript",
    "created_at": "2024-01-01T00:00:00Z",
    "updated_at": "2024-01-01T00:00:00Z"
  }
}

Error codes

StatusCodeReason
401INVALID_API_KEYKey not found or revoked
404NOT_FOUNDSOP does not exist or belongs to a different workspace

Example

curl -X GET "https://sendabrief.com/api/v1/sops/<sop-id>" \
  -H "Authorization: Bearer sb_your_key_here"
PATCH/sops/:id

Update a SOP

Partially updates a SOP. Only the fields you include are changed, omit any field to leave it unchanged.

Request body

{
  "title": "Updated title",           // optional
  "trigger": "New trigger text",      // optional, pass null to clear
  "steps": [                          // optional, replaces all steps
    { "text": "Updated step one", "role": "Manager" }
  ],
  "roles": ["Manager"],               // optional, replaces roles array
  "notes": "Updated notes"            // optional, pass null to clear
}

Response

{
  "data": {
    "id": "uuid",
    "title": "Updated title",
    ...
  }
}

Error codes

StatusCodeReason
400VALIDATION_ERRORRequest body empty, or a provided field is invalid
401INVALID_API_KEYKey not found or revoked
404NOT_FOUNDSOP does not exist in this workspace

Example

curl -X PATCH "https://sendabrief.com/api/v1/sops/<sop-id>" \
  -H "Authorization: Bearer sb_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"title":"Updated title"}'
DELETE/sops/:id

Delete a SOP

Permanently deletes a SOP. This action cannot be undone.

Response

{
  "deleted": true,
  "id": "uuid"
}

Error codes

StatusCodeReason
401INVALID_API_KEYKey not found or revoked
404NOT_FOUNDSOP does not exist in this workspace

Example

curl -X DELETE "https://sendabrief.com/api/v1/sops/<sop-id>" \
  -H "Authorization: Bearer sb_your_key_here"