{
  "openapi": "3.1.0",
  "info": {
    "title": "SemaLink API",
    "version": "1.0.0",
    "description": "Send SMS in Kenya, Tanzania and Uganda from your own systems. Authenticate with an API key as a bearer token; a sk_test_ key works in the sandbox, which sends nothing and costs nothing. Every error has the Error shape; every code is explained at https://docs.semalink.africa/errors. Scopes: balance:read, sender_ids:read, pricing:read, messages:send, messages:read, webhooks:manage."
  },
  "servers": [
    {
      "url": "https://api.semalink.africa/v1",
      "description": "Production"
    },
    {
      "url": "https://staging-api.semalink.africa/v1",
      "description": "Staging"
    }
  ],
  "tags": [
    {
      "name": "Account"
    },
    {
      "name": "Balance"
    },
    {
      "name": "Sender IDs"
    },
    {
      "name": "Pricing"
    },
    {
      "name": "Messages"
    },
    {
      "name": "Batches"
    },
    {
      "name": "Webhooks"
    },
    {
      "name": "Events"
    },
    {
      "name": "Meta"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key: sk_live_... for live, sk_test_... for the sandbox. Make one in the app: Developer > API keys."
      }
    },
    "schemas": {
      "Money": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "integer",
            "description": "In the currency's smallest unit: cents for KES.",
            "example": 80
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 code. Every organisation is in KES for now.",
            "example": "KES"
          },
          "display": {
            "type": "string",
            "description": "The amount written out, for showing to a person.",
            "example": "KES 0.80"
          }
        },
        "required": [
          "amount",
          "currency",
          "display"
        ],
        "description": "An amount of money."
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "authentication_error",
                  "permission_error",
                  "invalid_request_error",
                  "insufficient_balance",
                  "rate_limit_error",
                  "api_error"
                ],
                "description": "The kind of error; follows the HTTP status."
              },
              "code": {
                "type": "string",
                "description": "Which error, for your code to branch on.",
                "example": "parameter_missing"
              },
              "message": {
                "type": "string",
                "description": "What went wrong and how to fix it, for a person.",
                "example": "Missing required parameter: text."
              },
              "param": {
                "type": "string",
                "description": "The request parameter the error is about.",
                "example": "text"
              },
              "shortfall": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Money"
                  },
                  {
                    "description": "insufficient_balance: what a top-up must cover."
                  }
                ]
              },
              "next_window_at": {
                "type": "string",
                "description": "outside_sending_hours: when sending hours next open (ISO 8601)."
              },
              "characters": {
                "type": "integer",
                "description": "message_too_long: the text's length as SMS count it."
              },
              "max_characters": {
                "type": "integer",
                "description": "message_too_long: what one message holds."
              },
              "unsupported_characters": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "character": {
                      "type": "string"
                    },
                    "code_point": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "replacement": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "character",
                    "code_point",
                    "name",
                    "replacement"
                  ]
                },
                "description": "unsupported_characters: each one, with what to write instead."
              },
              "category": {
                "type": "string",
                "description": "content_blocked: the kind of content SemaLink does not carry."
              },
              "doc_url": {
                "type": "string",
                "example": "https://docs.semalink.africa/errors#parameter_missing"
              },
              "request_id": {
                "type": "string",
                "description": "Quote it to support.",
                "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
              }
            },
            "required": [
              "type",
              "code",
              "message",
              "doc_url",
              "request_id"
            ]
          }
        },
        "required": [
          "error"
        ],
        "description": "Every error answers in this shape."
      },
      "Message": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^msg_[0-9a-f]{32}$",
            "description": "The message's id.",
            "example": "msg_3b9f6c2a1d4e4f5a8b7c6d5e4f3a2b1c"
          },
          "object": {
            "type": "string",
            "enum": [
              "message"
            ]
          },
          "livemode": {
            "type": "boolean",
            "description": "false for a sandbox message, which reached no phone."
          },
          "to": {
            "type": "string",
            "description": "The number in E.164.",
            "example": "+254712345678"
          },
          "from": {
            "type": "string",
            "description": "The sender ID it came from.",
            "example": "GREENHILL"
          },
          "text": {
            "type": "string",
            "description": "The text as sent, the opt-out line of a promotion included.",
            "example": "Your order 1042 is ready for collection at Greenhill Shop, Moi Avenue. Call 0712 345 678."
          },
          "type": {
            "type": "string",
            "enum": [
              "service",
              "promotional"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "scheduled",
              "queued",
              "held",
              "sent",
              "delivered",
              "failed",
              "expired",
              "rejected",
              "cancelled"
            ],
            "description": "scheduled, then queued, then sent (handed to the network), then delivered, failed or expired (no report in 72 hours). held: waiting for a check by SemaLink. rejected: never sent (opted out since; not charged). cancelled: stopped before it went."
          },
          "network": {
            "type": [
              "string",
              "null"
            ],
            "description": "The network it went to, or its number belongs to.",
            "example": "safaricom"
          },
          "parts": {
            "type": "integer",
            "description": "The SMS it took; each is charged.",
            "example": 1
          },
          "encoding": {
            "type": "string",
            "enum": [
              "gsm7",
              "ucs2"
            ]
          },
          "cost": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "description": "What it costs: charged once it is sent, refunded when it never reached the network."
              }
            ]
          },
          "reference": {
            "type": [
              "string",
              "null"
            ],
            "example": "invoice-1042"
          },
          "batch": {
            "type": [
              "string",
              "null"
            ],
            "description": "The batch it was sent in (bat_...), or null for a single message.",
            "example": null
          },
          "send_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When it was scheduled for, or null when sent at once.",
            "example": null
          },
          "created_at": {
            "type": "string",
            "example": "2026-12-01T07:30:00.000Z"
          },
          "sent_at": {
            "type": [
              "string",
              "null"
            ],
            "example": "2026-12-01T07:30:02.000Z"
          },
          "delivered_at": {
            "type": [
              "string",
              "null"
            ],
            "example": "2026-12-01T07:30:06.000Z"
          },
          "failure": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "absent_subscriber",
                  "unknown_subscriber",
                  "inactive_subscriber",
                  "promotions_blocked",
                  "rejected_by_network",
                  "not_delivered",
                  "provider_error",
                  "no_delivery_report",
                  "opted_out",
                  "contact_removed",
                  "cancelled"
                ],
                "example": "absent_subscriber"
              },
              "message": {
                "type": "string",
                "example": "Phone off or unreachable"
              },
              "refunded": {
                "type": "boolean",
                "description": "Its cost was returned: it never reached the network.",
                "example": false
              }
            },
            "required": [
              "code",
              "message",
              "refunded"
            ],
            "description": "Why it wasn't delivered; null while it may still be, and once delivered."
          },
          "refunded": {
            "type": "boolean",
            "description": "Its cost was returned."
          }
        },
        "required": [
          "id",
          "object",
          "livemode",
          "to",
          "from",
          "text",
          "type",
          "status",
          "network",
          "parts",
          "encoding",
          "cost",
          "reference",
          "batch",
          "send_at",
          "created_at",
          "sent_at",
          "delivered_at",
          "failure",
          "refunded"
        ],
        "example": {
          "id": "msg_3b9f6c2a1d4e4f5a8b7c6d5e4f3a2b1c",
          "object": "message",
          "livemode": true,
          "to": "+254712345678",
          "from": "GREENHILL",
          "text": "Your order 1042 is ready for collection at Greenhill Shop, Moi Avenue. Call 0712 345 678.",
          "type": "service",
          "status": "delivered",
          "network": "safaricom",
          "parts": 1,
          "encoding": "gsm7",
          "cost": {
            "amount": 80,
            "currency": "KES",
            "display": "KES 0.80"
          },
          "reference": "invoice-1042",
          "batch": null,
          "send_at": null,
          "created_at": "2026-12-01T07:30:00.000Z",
          "sent_at": "2026-12-01T07:30:02.000Z",
          "delivered_at": "2026-12-01T07:30:06.000Z",
          "failure": null,
          "refunded": false
        }
      },
      "Batch": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^bat_[0-9a-f]{32}$",
            "description": "The batch's id.",
            "example": "bat_7a1c2e3f4b5d4c6e8f9a0b1c2d3e4f5a"
          },
          "object": {
            "type": "string",
            "enum": [
              "batch"
            ]
          },
          "livemode": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "enum": [
              "scheduled",
              "held",
              "sending",
              "completed",
              "cancelled",
              "failed"
            ],
            "description": "scheduled (waiting for send_at), held (a check by SemaLink), sending, completed (everything handed over; reports may still come), cancelled, or failed (it couldn't start: say the sender ID was suspended)."
          },
          "from": {
            "type": "string",
            "example": "GREENHILL"
          },
          "type": {
            "type": "string",
            "enum": [
              "service",
              "promotional"
            ]
          },
          "text": {
            "type": [
              "string",
              "null"
            ],
            "description": "The text every message has; null for a personalised batch.",
            "example": "Your order 1042 is ready for collection at Greenhill Shop, Moi Avenue. Call 0712 345 678."
          },
          "reference": {
            "type": [
              "string",
              "null"
            ],
            "example": "december-reminders"
          },
          "send_at": {
            "type": [
              "string",
              "null"
            ],
            "example": null
          },
          "created_at": {
            "type": "string",
            "example": "2026-12-01T07:30:00.000Z"
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ],
            "example": null
          },
          "totals": {
            "type": "object",
            "properties": {
              "recipients": {
                "type": "integer",
                "description": "Every number asked for."
              },
              "accepted": {
                "type": "integer",
                "description": "The messages made."
              },
              "rejected": {
                "type": "integer",
                "description": "Numbers refused at the request (never charged)."
              },
              "scheduled": {
                "type": "integer"
              },
              "queued": {
                "type": "integer"
              },
              "held": {
                "type": "integer"
              },
              "sent": {
                "type": "integer"
              },
              "delivered": {
                "type": "integer"
              },
              "failed": {
                "type": "integer"
              },
              "expired": {
                "type": "integer"
              },
              "cancelled": {
                "type": "integer"
              }
            },
            "required": [
              "recipients",
              "accepted",
              "rejected",
              "scheduled",
              "queued",
              "held",
              "sent",
              "delivered",
              "failed",
              "expired",
              "cancelled"
            ]
          },
          "cost": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "description": "What its messages cost: charged, or set aside until they go."
              }
            ]
          },
          "refunded": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "description": "What came back: messages cancelled or refused before reaching the network."
              }
            ]
          }
        },
        "required": [
          "id",
          "object",
          "livemode",
          "status",
          "from",
          "type",
          "text",
          "reference",
          "send_at",
          "created_at",
          "completed_at",
          "totals",
          "cost",
          "refunded"
        ],
        "example": {
          "id": "bat_7a1c2e3f4b5d4c6e8f9a0b1c2d3e4f5a",
          "object": "batch",
          "livemode": true,
          "status": "sending",
          "from": "GREENHILL",
          "type": "service",
          "text": "Your order 1042 is ready for collection at Greenhill Shop, Moi Avenue. Call 0712 345 678.",
          "reference": "december-reminders",
          "send_at": null,
          "created_at": "2026-12-01T07:30:00.000Z",
          "completed_at": null,
          "totals": {
            "recipients": 3,
            "accepted": 2,
            "rejected": 1,
            "scheduled": 0,
            "queued": 2,
            "held": 0,
            "sent": 0,
            "delivered": 0,
            "failed": 0,
            "expired": 0,
            "cancelled": 0
          },
          "cost": {
            "amount": 160,
            "currency": "KES",
            "display": "KES 1.60"
          },
          "refunded": {
            "amount": 0,
            "currency": "KES",
            "display": "KES 0.00"
          }
        }
      },
      "Event": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^evt_[0-9a-f]{32}$",
            "description": "The event's id: the same in every delivery of it (X-SemaLink-Event-Id).",
            "example": "evt_9d8c7b6a5f4e4d3c2b1a0f9e8d7c6b5a"
          },
          "object": {
            "type": "string",
            "enum": [
              "event"
            ]
          },
          "type": {
            "type": "string",
            "description": "One of message.sent, message.delivered, message.failed, sender_id.approved, sender_id.rejected, message.held, message.released, batch.completed.",
            "example": "message.delivered"
          },
          "livemode": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "description": "When it happened.",
            "example": "2026-12-01T07:30:06.000Z"
          },
          "data": {
            "type": "object",
            "properties": {
              "object": {
                "type": "object",
                "additionalProperties": {},
                "description": "The message, batch or sender ID as it was then."
              }
            },
            "required": [
              "object"
            ]
          }
        },
        "required": [
          "id",
          "object",
          "type",
          "livemode",
          "created_at",
          "data"
        ],
        "example": {
          "id": "evt_9d8c7b6a5f4e4d3c2b1a0f9e8d7c6b5a",
          "object": "event",
          "type": "message.delivered",
          "livemode": true,
          "created_at": "2026-12-01T07:30:06.000Z",
          "data": {
            "object": {
              "id": "msg_3b9f6c2a1d4e4f5a8b7c6d5e4f3a2b1c",
              "object": "message",
              "livemode": true,
              "to": "+254712345678",
              "from": "GREENHILL",
              "text": "Your order 1042 is ready for collection at Greenhill Shop, Moi Avenue. Call 0712 345 678.",
              "type": "service",
              "status": "delivered",
              "network": "safaricom",
              "parts": 1,
              "encoding": "gsm7",
              "cost": {
                "amount": 80,
                "currency": "KES",
                "display": "KES 0.80"
              },
              "reference": "invoice-1042",
              "batch": null,
              "send_at": null,
              "created_at": "2026-12-01T07:30:00.000Z",
              "sent_at": "2026-12-01T07:30:02.000Z",
              "delivered_at": "2026-12-01T07:30:06.000Z",
              "failure": null,
              "refunded": false
            }
          }
        }
      },
      "WebhookEndpoint": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^whe_[0-9a-f]{32}$",
            "description": "The endpoint's id.",
            "example": "whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b"
          },
          "object": {
            "type": "string",
            "enum": [
              "webhook_endpoint"
            ]
          },
          "livemode": {
            "type": "boolean",
            "description": "A live endpoint gets live events; a sandbox (test) one the sandbox's."
          },
          "url": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "enabled": {
            "type": "boolean"
          },
          "failing_since": {
            "type": [
              "string",
              "null"
            ],
            "description": "Deliveries have failed in a row since then; null while they succeed."
          },
          "created_at": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "object",
          "livemode",
          "url",
          "description",
          "events",
          "enabled",
          "failing_since",
          "created_at",
          "updated_at"
        ],
        "example": {
          "id": "whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b",
          "object": "webhook_endpoint",
          "livemode": true,
          "url": "https://greenhill.co.ke/semalink/events",
          "description": "Delivery reports for the billing server",
          "events": [
            "message.delivered",
            "message.failed"
          ],
          "enabled": true,
          "failing_since": null,
          "created_at": "2026-12-01T07:30:00.000Z",
          "updated_at": "2026-12-01T07:30:00.000Z"
        }
      },
      "Account": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "account"
            ]
          },
          "livemode": {
            "type": "boolean",
            "description": "true for a live key, false for a sandbox (test) key."
          },
          "organisation": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^org_[0-9a-f]{32}$",
                "description": "The organisation's id.",
                "example": "org_8c1f2a3b4d5e4f60a1b2c3d4e5f60718"
              },
              "name": {
                "type": "string",
                "example": "Greenhill Academy"
              },
              "country": {
                "type": "string",
                "example": "KE"
              },
              "status": {
                "type": "string",
                "enum": [
                  "active",
                  "pending",
                  "suspended"
                ],
                "description": "pending until SemaLink has verified the organisation."
              }
            },
            "required": [
              "id",
              "name",
              "country",
              "status"
            ]
          },
          "key": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^key_[0-9a-f]{32}$",
                "description": "The key's id.",
                "example": "key_2b7e151628ae4d2a9f1c3b5d7e9f0a1c"
              },
              "label": {
                "type": [
                  "string",
                  "null"
                ],
                "example": "Billing server"
              },
              "mode": {
                "type": "string",
                "enum": [
                  "live",
                  "test"
                ]
              },
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "balance:read",
                    "sender_ids:read",
                    "pricing:read",
                    "messages:send",
                    "messages:read",
                    "webhooks:manage"
                  ]
                }
              },
              "prefix": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The first 16 characters of the key.",
                "example": "sk_live_3f9a2c1b"
              },
              "allowed_ips": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Addresses the key works from; empty: any.",
                "example": [
                  "41.90.12.7"
                ]
              },
              "expires_at": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "When the key stops working; null: never.",
                "example": null
              }
            },
            "required": [
              "id",
              "label",
              "mode",
              "scopes",
              "prefix",
              "allowed_ips",
              "expires_at"
            ]
          },
          "readiness": {
            "type": "object",
            "properties": {
              "account_active": {
                "type": "boolean",
                "description": "SemaLink has verified the organisation."
              },
              "sender_id_approved": {
                "type": "boolean",
                "description": "At least one of its sender IDs is approved."
              },
              "balance_ok": {
                "type": "boolean",
                "description": "There is money to send with (for a sandbox key, the sandbox's virtual balance)."
              },
              "sending_enabled": {
                "type": "boolean",
                "description": "Sending is on at SemaLink and isn't paused for the organisation."
              }
            },
            "required": [
              "account_active",
              "sender_id_approved",
              "balance_ok",
              "sending_enabled"
            ],
            "description": "What live sending needs. All four true: the organisation's live keys can send."
          }
        },
        "required": [
          "object",
          "livemode",
          "organisation",
          "key",
          "readiness"
        ],
        "example": {
          "object": "account",
          "livemode": true,
          "organisation": {
            "id": "org_8c1f2a3b4d5e4f60a1b2c3d4e5f60718",
            "name": "Greenhill Academy",
            "country": "KE",
            "status": "active"
          },
          "key": {
            "id": "key_2b7e151628ae4d2a9f1c3b5d7e9f0a1c",
            "label": "Billing server",
            "mode": "live",
            "scopes": [
              "balance:read",
              "sender_ids:read",
              "pricing:read",
              "messages:send",
              "messages:read",
              "webhooks:manage"
            ],
            "prefix": "sk_live_3f9a2c1b",
            "allowed_ips": [],
            "expires_at": null
          },
          "readiness": {
            "account_active": true,
            "sender_id_approved": true,
            "balance_ok": true,
            "sending_enabled": true
          }
        }
      },
      "Balance": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "balance"
            ]
          },
          "livemode": {
            "type": "boolean"
          },
          "available": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "description": "What sending can use now, credit included."
              }
            ]
          },
          "reserved": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "description": "Set aside for messages scheduled or being sent."
              }
            ]
          }
        },
        "required": [
          "object",
          "livemode",
          "available",
          "reserved"
        ],
        "example": {
          "object": "balance",
          "livemode": true,
          "available": {
            "amount": 1250000,
            "currency": "KES",
            "display": "KES 12,500.00"
          },
          "reserved": {
            "amount": 4000,
            "currency": "KES",
            "display": "KES 40.00"
          }
        }
      },
      "SenderId": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^snd_[0-9a-f]{32}$",
            "description": "The sender ID's id.",
            "example": "snd_1f0c3a4b5c6d4e7f8a9b0c1d2e3f4a5b"
          },
          "object": {
            "type": "string",
            "enum": [
              "sender_id"
            ]
          },
          "name": {
            "type": "string",
            "description": "What recipients see as the sender.",
            "example": "GREENHILL"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "rejected",
              "suspended",
              "withdrawn"
            ],
            "description": "approved: it can send. suspended: it was approved, and has been stopped by SemaLink or the networks."
          },
          "country": {
            "type": [
              "string",
              "null"
            ],
            "example": "KE"
          },
          "networks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "network": {
                  "type": "string",
                  "example": "safaricom"
                },
                "status": {
                  "type": "string",
                  "description": "Its registration on that network: not_started, submitted, approved, rejected, suspended or released.",
                  "example": "approved"
                },
                "required": {
                  "type": "boolean",
                  "description": "Whether the sender ID needs this network before it is approved."
                }
              },
              "required": [
                "network",
                "status",
                "required"
              ]
            }
          },
          "created_at": {
            "type": "string",
            "example": "2026-12-01T07:30:00.000Z"
          }
        },
        "required": [
          "id",
          "object",
          "name",
          "status",
          "country",
          "networks",
          "created_at"
        ]
      },
      "SenderIdList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SenderId"
            }
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether there are more items after these."
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass as starting_after to get the next page; null on the last page."
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ],
        "example": {
          "object": "list",
          "data": [
            {
              "id": "snd_1f0c3a4b5c6d4e7f8a9b0c1d2e3f4a5b",
              "object": "sender_id",
              "name": "GREENHILL",
              "status": "approved",
              "country": "KE",
              "networks": [
                {
                  "network": "safaricom",
                  "status": "approved",
                  "required": true
                },
                {
                  "network": "airtel_ke",
                  "status": "approved",
                  "required": true
                }
              ],
              "created_at": "2026-12-01T07:30:00.000Z"
            }
          ],
          "has_more": false,
          "next_cursor": null
        }
      },
      "Price": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "price"
            ]
          },
          "country": {
            "type": "string",
            "example": "KE"
          },
          "price_per_sms": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "description": "One SMS (one part) to any network in the country."
              }
            ]
          }
        },
        "required": [
          "object",
          "country",
          "price_per_sms"
        ]
      },
      "PriceList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Price"
            }
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether there are more items after these."
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass as starting_after to get the next page; null on the last page."
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ],
        "example": {
          "object": "list",
          "data": [
            {
              "object": "price",
              "country": "KE",
              "price_per_sms": {
                "amount": 80,
                "currency": "KES",
                "display": "KES 0.80"
              }
            }
          ],
          "has_more": false,
          "next_cursor": null
        }
      },
      "Estimate": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "estimate"
            ]
          },
          "livemode": {
            "type": "boolean"
          },
          "type": {
            "type": "string",
            "enum": [
              "service",
              "promotional"
            ]
          },
          "country": {
            "type": [
              "string",
              "null"
            ],
            "description": "The organisation's country: where the message's rules (the opt-out line) and cost_per_message come from.",
            "example": "KE"
          },
          "message": {
            "type": "object",
            "properties": {
              "encoding": {
                "type": "string",
                "enum": [
                  "gsm7",
                  "ucs2"
                ],
                "description": "gsm7, the standard SMS alphabet. Special characters (ucs2) are not available yet."
              },
              "characters": {
                "type": "integer",
                "description": "Its length as SMS count it (some symbols count 2), the opt-out line included."
              },
              "characters_left": {
                "type": "integer",
                "description": "How many more fit in max_parts; 0 when it is too long."
              },
              "parts": {
                "type": "integer",
                "description": "The SMS it takes. Each part is charged."
              },
              "max_parts": {
                "type": "integer",
                "description": "The most parts a message may have: 1 for now."
              },
              "fits": {
                "type": "boolean",
                "description": "It can be sent as it is: within max_parts and only standard characters. When false, nothing is priced."
              },
              "problems": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": [
                        "message_too_long",
                        "unsupported_characters"
                      ]
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "message"
                  ]
                },
                "description": "Why it can't be sent as it is; empty when it fits.",
                "example": []
              },
              "unsupported_characters": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "character": {
                      "type": "string",
                      "example": "é"
                    },
                    "code_point": {
                      "type": "string",
                      "example": "U+00E9"
                    },
                    "name": {
                      "type": "string",
                      "example": "accented letter"
                    },
                    "replacement": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "What to write instead ('' removes it); null when there is no safe one.",
                      "example": "e"
                    }
                  },
                  "required": [
                    "character",
                    "code_point",
                    "name",
                    "replacement"
                  ]
                },
                "description": "Characters outside the SMS alphabet, which stop it from being sent."
              },
              "footer": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The opt-out line added at the end, if any.",
                "example": null
              }
            },
            "required": [
              "encoding",
              "characters",
              "characters_left",
              "parts",
              "max_parts",
              "fits",
              "problems",
              "unsupported_characters",
              "footer"
            ]
          },
          "cost_per_message": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "type": "null"
              }
            ],
            "description": "What one copy costs in the organisation's country; null when it isn't priced, or the message doesn't fit."
          },
          "recipients": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "input": {
                  "type": "string",
                  "description": "The number as you sent it.",
                  "example": "0722000111"
                },
                "to": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The number in E.164, or null when it is not a number.",
                  "example": "+254722000111"
                },
                "valid": {
                  "type": "boolean",
                  "description": "It would be sent to."
                },
                "country": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "example": "KE"
                },
                "network": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The network its prefix belongs to, when known.",
                  "example": "safaricom"
                },
                "cost": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Money"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "null when the number would not be sent, or the message doesn't fit."
                },
                "rejection": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": [
                        "invalid_number",
                        "unsupported_country",
                        "duplicate_in_request",
                        "no_price"
                      ]
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "message"
                  ],
                  "description": "Why it would not be sent; null when valid."
                }
              },
              "required": [
                "input",
                "to",
                "valid",
                "country",
                "network",
                "cost",
                "rejection"
              ]
            },
            "description": "One per number in `to`, in order; empty without `to`."
          },
          "totals": {
            "type": "object",
            "properties": {
              "recipients": {
                "type": "integer"
              },
              "valid": {
                "type": "integer"
              },
              "rejected": {
                "type": "integer"
              },
              "sms": {
                "type": "integer",
                "description": "Parts times valid recipients: what is charged."
              },
              "cost": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/Money"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "The valid recipients' cost; null when the message doesn't fit."
              }
            },
            "required": [
              "recipients",
              "valid",
              "rejected",
              "sms",
              "cost"
            ]
          }
        },
        "required": [
          "object",
          "livemode",
          "type",
          "country",
          "message",
          "cost_per_message",
          "recipients",
          "totals"
        ],
        "example": {
          "object": "estimate",
          "livemode": true,
          "type": "service",
          "country": "KE",
          "message": {
            "encoding": "gsm7",
            "characters": 95,
            "characters_left": 65,
            "parts": 1,
            "max_parts": 1,
            "fits": true,
            "problems": [],
            "unsupported_characters": [],
            "footer": null
          },
          "cost_per_message": {
            "amount": 80,
            "currency": "KES",
            "display": "KES 0.80"
          },
          "recipients": [
            {
              "input": "+254712345678",
              "to": "+254712345678",
              "valid": true,
              "country": "KE",
              "network": "safaricom",
              "cost": {
                "amount": 80,
                "currency": "KES",
                "display": "KES 0.80"
              },
              "rejection": null
            },
            {
              "input": "0722000111",
              "to": "+254722000111",
              "valid": true,
              "country": "KE",
              "network": "safaricom",
              "cost": {
                "amount": 80,
                "currency": "KES",
                "display": "KES 0.80"
              },
              "rejection": null
            }
          ],
          "totals": {
            "recipients": 2,
            "valid": 2,
            "rejected": 0,
            "sms": 2,
            "cost": {
              "amount": 160,
              "currency": "KES",
              "display": "KES 1.60"
            }
          }
        }
      },
      "EstimateRequest": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string",
            "maxLength": 5000,
            "description": "The message.",
            "example": "Dear parent, the school closes for the holiday on Friday 5 December at 12:00. Greenhill Academy"
          },
          "to": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              },
              {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "minItems": 1,
                "maxItems": 1000
              }
            ],
            "description": "Who it would go to: one number or up to 1,000, in E.164 (+254712345678) or a local form (0712345678).",
            "example": [
              "+254712345678",
              "0722000111"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "service",
              "promotional"
            ],
            "default": "service",
            "description": "promotional adds the opt-out line in Kenya (STOP*456*9*5#), which counts in the length."
          }
        },
        "required": [
          "text"
        ],
        "additionalProperties": false
      },
      "SendMessageRequest": {
        "type": "object",
        "properties": {
          "to": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "The number: E.164 (+254712345678) or a Kenyan local form (0712345678).",
            "example": "+254712345678"
          },
          "text": {
            "type": "string",
            "maxLength": 5000,
            "description": "The message: one SMS (160 standard characters) for now.",
            "example": "Your order 1042 is ready for collection at Greenhill Shop, Moi Avenue. Call 0712 345 678."
          },
          "from": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "The sender ID the message comes from: its name (GREENHILL) or its id (snd_...). Live: an approved one. Sandbox: any of yours, whatever its status, or SANDBOX.",
            "example": "GREENHILL"
          },
          "type": {
            "type": "string",
            "enum": [
              "service",
              "promotional"
            ],
            "default": "service",
            "description": "service (the default) for transactional messages; promotional for marketing, which adds the opt-out line in Kenya (STOP*456*9*5#) and may only go 07:00-19:00 East Africa Time."
          },
          "reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Your own reference (an invoice or order number), returned on the message and in its events. Not checked for uniqueness.",
            "example": "invoice-1042"
          },
          "send_at": {
            "type": "string",
            "format": "date-time",
            "description": "Send later: 5 minutes to 90 days from now (ISO 8601). Leave it out to send now.",
            "example": "2026-12-05T06:00:00.000Z"
          }
        },
        "required": [
          "to",
          "text",
          "from"
        ],
        "additionalProperties": false
      },
      "BatchCreated": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Batch"
          },
          {
            "type": "object",
            "properties": {
              "recipients": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "index": {
                      "type": "integer",
                      "description": "Its place in `to` or `messages`, from 0."
                    },
                    "input": {
                      "type": "string",
                      "description": "The number as you sent it.",
                      "example": "0722000111"
                    },
                    "to": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "In E.164; null when it is not a number.",
                      "example": "+254722000111"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "accepted",
                        "rejected"
                      ]
                    },
                    "message": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The message's id when accepted.",
                      "example": "msg_3b9f6c2a1d4e4f5a8b7c6d5e4f3a2b1c"
                    },
                    "rejection": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "invalid_number",
                            "unsupported_country",
                            "duplicate_in_request",
                            "no_price",
                            "opted_out"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "index",
                    "input",
                    "to",
                    "status",
                    "message",
                    "rejection"
                  ]
                },
                "description": "One per number asked for, in order: accepted (with its message) or rejected and why."
              }
            },
            "required": [
              "recipients"
            ]
          }
        ],
        "example": {
          "id": "bat_7a1c2e3f4b5d4c6e8f9a0b1c2d3e4f5a",
          "object": "batch",
          "livemode": true,
          "status": "sending",
          "from": "GREENHILL",
          "type": "service",
          "text": "Your order 1042 is ready for collection at Greenhill Shop, Moi Avenue. Call 0712 345 678.",
          "reference": "december-reminders",
          "send_at": null,
          "created_at": "2026-12-01T07:30:00.000Z",
          "completed_at": null,
          "totals": {
            "recipients": 3,
            "accepted": 2,
            "rejected": 1,
            "scheduled": 0,
            "queued": 2,
            "held": 0,
            "sent": 0,
            "delivered": 0,
            "failed": 0,
            "expired": 0,
            "cancelled": 0
          },
          "cost": {
            "amount": 160,
            "currency": "KES",
            "display": "KES 1.60"
          },
          "refunded": {
            "amount": 0,
            "currency": "KES",
            "display": "KES 0.00"
          },
          "recipients": [
            {
              "index": 0,
              "input": "+254712345678",
              "to": "+254712345678",
              "status": "accepted",
              "message": "msg_3b9f6c2a1d4e4f5a8b7c6d5e4f3a2b1c",
              "rejection": null
            },
            {
              "index": 1,
              "input": "0722000111",
              "to": "+254722000111",
              "status": "accepted",
              "message": "msg_4c0a7d3b2e5f4a6b9c8d7e6f5a4b3c2d",
              "rejection": null
            },
            {
              "index": 2,
              "input": "0712 34",
              "to": null,
              "status": "rejected",
              "message": null,
              "rejection": {
                "code": "invalid_number",
                "message": "This number is too short."
              }
            }
          ]
        }
      },
      "BatchRequest": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "The sender ID the message comes from: its name (GREENHILL) or its id (snd_...). Live: an approved one. Sandbox: any of yours, whatever its status, or SANDBOX.",
            "example": "GREENHILL"
          },
          "type": {
            "type": "string",
            "enum": [
              "service",
              "promotional"
            ],
            "default": "service",
            "description": "service (the default) for transactional messages; promotional for marketing, which adds the opt-out line in Kenya (STOP*456*9*5#) and may only go 07:00-19:00 East Africa Time."
          },
          "text": {
            "type": "string",
            "maxLength": 5000,
            "description": "The text every number in `to` gets. Leave it out with `messages`.",
            "example": "Your order 1042 is ready for collection at Greenhill Shop, Moi Avenue. Call 0712 345 678."
          },
          "to": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "minItems": 1,
            "maxItems": 1000,
            "description": "Up to 1,000 numbers, each sent `text`.",
            "example": [
              "+254712345678",
              "0722000111"
            ]
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "to": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "example": "+254712345678"
                },
                "text": {
                  "type": "string",
                  "maxLength": 5000,
                  "example": "Hi Amina, your order 1042 is ready. Greenhill Shop, 0712 345 678."
                },
                "reference": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128,
                  "description": "Your own reference (an invoice or order number), returned on the message and in its events. Not checked for uniqueness.",
                  "example": "invoice-1042"
                }
              },
              "required": [
                "to",
                "text"
              ],
              "additionalProperties": false
            },
            "minItems": 1,
            "maxItems": 1000,
            "description": "Personalised: up to 1,000 {to, text, reference}, each with its own text. Instead of `text` and `to`."
          },
          "reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Your reference for the batch, on the batch object.",
            "example": "invoice-1042"
          },
          "send_at": {
            "type": "string",
            "format": "date-time",
            "description": "Send later: 5 minutes to 90 days from now (ISO 8601). Leave it out to send now.",
            "example": "2026-12-05T06:00:00.000Z"
          }
        },
        "required": [
          "from"
        ],
        "additionalProperties": false
      },
      "MessageList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Message"
            }
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether there are more items after these."
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass as starting_after to get the next page; null on the last page."
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ],
        "example": {
          "object": "list",
          "data": [
            {
              "id": "msg_3b9f6c2a1d4e4f5a8b7c6d5e4f3a2b1c",
              "object": "message",
              "livemode": true,
              "to": "+254712345678",
              "from": "GREENHILL",
              "text": "Your order 1042 is ready for collection at Greenhill Shop, Moi Avenue. Call 0712 345 678.",
              "type": "service",
              "status": "delivered",
              "network": "safaricom",
              "parts": 1,
              "encoding": "gsm7",
              "cost": {
                "amount": 80,
                "currency": "KES",
                "display": "KES 0.80"
              },
              "reference": "invoice-1042",
              "batch": null,
              "send_at": null,
              "created_at": "2026-12-01T07:30:00.000Z",
              "sent_at": "2026-12-01T07:30:02.000Z",
              "delivered_at": "2026-12-01T07:30:06.000Z",
              "failure": null,
              "refunded": false
            }
          ],
          "has_more": true,
          "next_cursor": "msg_3b9f6c2a1d4e4f5a8b7c6d5e4f3a2b1c"
        }
      },
      "MessageWithHistory": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Message"
          },
          {
            "type": "object",
            "properties": {
              "status_history": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "scheduled",
                        "queued",
                        "held",
                        "sent",
                        "delivered",
                        "failed",
                        "expired",
                        "rejected",
                        "cancelled"
                      ]
                    },
                    "at": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "status",
                    "at"
                  ]
                },
                "description": "Each status it has had, the oldest first."
              }
            },
            "required": [
              "status_history"
            ]
          }
        ],
        "example": {
          "id": "msg_3b9f6c2a1d4e4f5a8b7c6d5e4f3a2b1c",
          "object": "message",
          "livemode": true,
          "to": "+254712345678",
          "from": "GREENHILL",
          "text": "Your order 1042 is ready for collection at Greenhill Shop, Moi Avenue. Call 0712 345 678.",
          "type": "service",
          "status": "delivered",
          "network": "safaricom",
          "parts": 1,
          "encoding": "gsm7",
          "cost": {
            "amount": 80,
            "currency": "KES",
            "display": "KES 0.80"
          },
          "reference": "invoice-1042",
          "batch": null,
          "send_at": null,
          "created_at": "2026-12-01T07:30:00.000Z",
          "sent_at": "2026-12-01T07:30:02.000Z",
          "delivered_at": "2026-12-01T07:30:06.000Z",
          "failure": null,
          "refunded": false,
          "status_history": [
            {
              "status": "queued",
              "at": "2026-12-01T07:30:00.000Z"
            },
            {
              "status": "sent",
              "at": "2026-12-01T07:30:02.000Z"
            },
            {
              "status": "delivered",
              "at": "2026-12-01T07:30:06.000Z"
            }
          ]
        }
      },
      "WebhookEndpointList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEndpoint"
            }
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether there are more items after these."
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass as starting_after to get the next page; null on the last page."
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ],
        "example": {
          "object": "list",
          "data": [
            {
              "id": "whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b",
              "object": "webhook_endpoint",
              "livemode": true,
              "url": "https://greenhill.co.ke/semalink/events",
              "description": "Delivery reports for the billing server",
              "events": [
                "message.delivered",
                "message.failed"
              ],
              "enabled": true,
              "failing_since": null,
              "created_at": "2026-12-01T07:30:00.000Z",
              "updated_at": "2026-12-01T07:30:00.000Z"
            }
          ],
          "has_more": false,
          "next_cursor": null
        }
      },
      "WebhookEndpointCreated": {
        "allOf": [
          {
            "$ref": "#/components/schemas/WebhookEndpoint"
          },
          {
            "type": "object",
            "properties": {
              "secret": {
                "type": "string",
                "description": "The signing secret, shown this once.",
                "example": "whsec_2f7a9c1e4b6d8f0a3c5e7b9d1f3a5c7e9b1d3f5a7c9e1b3d"
              }
            },
            "required": [
              "secret"
            ]
          }
        ],
        "example": {
          "id": "whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b",
          "object": "webhook_endpoint",
          "livemode": true,
          "url": "https://greenhill.co.ke/semalink/events",
          "description": "Delivery reports for the billing server",
          "events": [
            "message.delivered",
            "message.failed"
          ],
          "enabled": true,
          "failing_since": null,
          "created_at": "2026-12-01T07:30:00.000Z",
          "updated_at": "2026-12-01T07:30:00.000Z",
          "secret": "whsec_2f7a9c1e4b6d8f0a3c5e7b9d1f3a5c7e9b1d3f5a7c9e1b3d"
        }
      },
      "CreateWebhookRequest": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 500,
            "format": "uri",
            "description": "Where events are posted: a public https:// address.",
            "example": "https://greenhill.co.ke/semalink/events"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "message.sent",
                "message.delivered",
                "message.failed",
                "campaign.completed",
                "sender_id.approved",
                "sender_id.rejected",
                "message.held",
                "message.released",
                "batch.completed"
              ]
            },
            "minItems": 1,
            "example": [
              "message.delivered",
              "message.failed"
            ]
          },
          "description": {
            "type": "string",
            "maxLength": 200,
            "example": "Delivery reports for the billing server"
          }
        },
        "required": [
          "url",
          "events"
        ],
        "additionalProperties": false
      },
      "UpdateWebhookRequest": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 500,
            "format": "uri",
            "description": "Where events are posted: a public https:// address.",
            "example": "https://greenhill.co.ke/semalink/events"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "message.sent",
                "message.delivered",
                "message.failed",
                "campaign.completed",
                "sender_id.approved",
                "sender_id.rejected",
                "message.held",
                "message.released",
                "batch.completed"
              ]
            },
            "minItems": 1,
            "example": [
              "message.delivered",
              "message.failed"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200
          },
          "enabled": {
            "type": "boolean",
            "description": "false stops deliveries (what was waiting is cancelled); true starts them again."
          }
        },
        "additionalProperties": false
      },
      "WebhookEndpointDeleted": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b"
          },
          "object": {
            "type": "string",
            "enum": [
              "webhook_endpoint"
            ]
          },
          "deleted": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "id",
          "object",
          "deleted"
        ]
      },
      "WebhookTest": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "webhook_test"
            ]
          },
          "event": {
            "type": "string",
            "description": "The test event sent (type webhook.test).",
            "example": "evt_9d8c7b6a5f4e4d3c2b1a0f9e8d7c6b5a"
          },
          "success": {
            "type": "boolean",
            "description": "The endpoint answered 2xx."
          },
          "status_code": {
            "type": [
              "integer",
              "null"
            ],
            "example": 200
          },
          "error": {
            "type": [
              "string",
              "null"
            ],
            "example": null
          },
          "duration_ms": {
            "type": [
              "integer",
              "null"
            ],
            "example": 184
          }
        },
        "required": [
          "object",
          "event",
          "success",
          "status_code",
          "error",
          "duration_ms"
        ],
        "example": {
          "object": "webhook_test",
          "event": "evt_9d8c7b6a5f4e4d3c2b1a0f9e8d7c6b5a",
          "success": true,
          "status_code": 200,
          "error": null,
          "duration_ms": 184
        }
      }
    },
    "parameters": {}
  },
  "paths": {
    "/account": {
      "get": {
        "operationId": "getAccount",
        "tags": [
          "Account"
        ],
        "summary": "Get the account",
        "description": "The organisation and the key making the request, and whether live sending is ready.\n\nAny key can call it, whatever its scopes.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-semalink-scope": "any",
        "responses": {
          "200": {
            "description": "The account.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_api_key": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "invalid_api_key",
                        "message": "This API key isn't one we know. Check it was copied whole, or make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_api_key",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_revoked": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_revoked",
                        "message": "This API key was revoked. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_revoked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_expired": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_expired",
                        "message": "This API key expired on 2026-12-31T21:00:00.000Z. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_expired",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key can't be used for this request.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "ip_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "ip_not_allowed",
                        "message": "This API key can't be used from 196.201.214.10: it isn't on the key's list of allowed addresses.",
                        "doc_url": "https://docs.semalink.africa/errors#ip_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "browser_requests_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "browser_requests_not_allowed",
                        "message": "The SemaLink API is for servers: requests from a browser (with an Origin header) are refused.",
                        "doc_url": "https://docs.semalink.africa/errors#browser_requests_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "api_blocked": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "api_blocked",
                        "message": "SemaLink has paused API access for this account. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#api_blocked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "account_suspended": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "account_suspended",
                        "message": "This organisation is suspended, so its API keys can't be used. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#account_suspended",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait for Retry-After seconds.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "value": {
                      "error": {
                        "type": "rate_limit_error",
                        "code": "rate_limited",
                        "message": "Too many requests with this key. Retry after 1 second.",
                        "doc_url": "https://docs.semalink.africa/errors#rate_limited",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong at SemaLink.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "internal_error",
                        "message": "Something went wrong on SemaLink's side. Try again; if it keeps happening, contact support and quote the request id.",
                        "doc_url": "https://docs.semalink.africa/errors#internal_error",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request took more than 30 seconds and was stopped.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_timeout": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "request_timeout",
                        "message": "The request took too long and was stopped. Retry it with the same Idempotency-Key: it never runs twice.",
                        "doc_url": "https://docs.semalink.africa/errors#request_timeout",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/balance": {
      "get": {
        "operationId": "getBalance",
        "tags": [
          "Balance"
        ],
        "summary": "Get the balance",
        "description": "What sending can use now and what is set aside. A sandbox key sees the sandbox's virtual KES 10,000.00.\n\nNeeds the `balance:read` scope.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-semalink-scope": "balance:read",
        "responses": {
          "200": {
            "description": "The balance.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Balance"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_api_key": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "invalid_api_key",
                        "message": "This API key isn't one we know. Check it was copied whole, or make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_api_key",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_revoked": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_revoked",
                        "message": "This API key was revoked. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_revoked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_expired": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_expired",
                        "message": "This API key expired on 2026-12-31T21:00:00.000Z. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_expired",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key can't be used for this request.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_missing": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "scope_missing",
                        "message": "This API key doesn't have the balance:read scope this request needs.",
                        "doc_url": "https://docs.semalink.africa/errors#scope_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "ip_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "ip_not_allowed",
                        "message": "This API key can't be used from 196.201.214.10: it isn't on the key's list of allowed addresses.",
                        "doc_url": "https://docs.semalink.africa/errors#ip_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "browser_requests_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "browser_requests_not_allowed",
                        "message": "The SemaLink API is for servers: requests from a browser (with an Origin header) are refused.",
                        "doc_url": "https://docs.semalink.africa/errors#browser_requests_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "api_blocked": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "api_blocked",
                        "message": "SemaLink has paused API access for this account. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#api_blocked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "account_suspended": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "account_suspended",
                        "message": "This organisation is suspended, so its API keys can't be used. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#account_suspended",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait for Retry-After seconds.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "value": {
                      "error": {
                        "type": "rate_limit_error",
                        "code": "rate_limited",
                        "message": "Too many requests with this key. Retry after 1 second.",
                        "doc_url": "https://docs.semalink.africa/errors#rate_limited",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong at SemaLink.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "internal_error",
                        "message": "Something went wrong on SemaLink's side. Try again; if it keeps happening, contact support and quote the request id.",
                        "doc_url": "https://docs.semalink.africa/errors#internal_error",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request took more than 30 seconds and was stopped.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_timeout": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "request_timeout",
                        "message": "The request took too long and was stopped. Retry it with the same Idempotency-Key: it never runs twice.",
                        "doc_url": "https://docs.semalink.africa/errors#request_timeout",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/sender-ids": {
      "get": {
        "operationId": "listSenderIds",
        "tags": [
          "Sender IDs"
        ],
        "summary": "List sender IDs",
        "description": "The organisation's sender IDs, the newest first, each with its registration on each network.\n\nNeeds the `sender_ids:read` scope.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-semalink-scope": "sender_ids:read",
        "responses": {
          "200": {
            "description": "The sender IDs.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SenderIdList"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_api_key": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "invalid_api_key",
                        "message": "This API key isn't one we know. Check it was copied whole, or make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_api_key",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_revoked": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_revoked",
                        "message": "This API key was revoked. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_revoked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_expired": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_expired",
                        "message": "This API key expired on 2026-12-31T21:00:00.000Z. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_expired",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key can't be used for this request.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_missing": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "scope_missing",
                        "message": "This API key doesn't have the sender_ids:read scope this request needs.",
                        "doc_url": "https://docs.semalink.africa/errors#scope_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "ip_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "ip_not_allowed",
                        "message": "This API key can't be used from 196.201.214.10: it isn't on the key's list of allowed addresses.",
                        "doc_url": "https://docs.semalink.africa/errors#ip_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "browser_requests_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "browser_requests_not_allowed",
                        "message": "The SemaLink API is for servers: requests from a browser (with an Origin header) are refused.",
                        "doc_url": "https://docs.semalink.africa/errors#browser_requests_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "api_blocked": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "api_blocked",
                        "message": "SemaLink has paused API access for this account. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#api_blocked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "account_suspended": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "account_suspended",
                        "message": "This organisation is suspended, so its API keys can't be used. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#account_suspended",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait for Retry-After seconds.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "value": {
                      "error": {
                        "type": "rate_limit_error",
                        "code": "rate_limited",
                        "message": "Too many requests with this key. Retry after 1 second.",
                        "doc_url": "https://docs.semalink.africa/errors#rate_limited",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong at SemaLink.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "internal_error",
                        "message": "Something went wrong on SemaLink's side. Try again; if it keeps happening, contact support and quote the request id.",
                        "doc_url": "https://docs.semalink.africa/errors#internal_error",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request took more than 30 seconds and was stopped.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_timeout": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "request_timeout",
                        "message": "The request took too long and was stopped. Retry it with the same Idempotency-Key: it never runs twice.",
                        "doc_url": "https://docs.semalink.africa/errors#request_timeout",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/pricing": {
      "get": {
        "operationId": "listPrices",
        "tags": [
          "Pricing"
        ],
        "summary": "List prices",
        "description": "The price of one SMS in each country the organisation can send to. Every network in a country costs the same.\n\nNeeds the `pricing:read` scope.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-semalink-scope": "pricing:read",
        "responses": {
          "200": {
            "description": "The prices.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PriceList"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_api_key": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "invalid_api_key",
                        "message": "This API key isn't one we know. Check it was copied whole, or make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_api_key",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_revoked": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_revoked",
                        "message": "This API key was revoked. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_revoked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_expired": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_expired",
                        "message": "This API key expired on 2026-12-31T21:00:00.000Z. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_expired",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key can't be used for this request.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_missing": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "scope_missing",
                        "message": "This API key doesn't have the pricing:read scope this request needs.",
                        "doc_url": "https://docs.semalink.africa/errors#scope_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "ip_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "ip_not_allowed",
                        "message": "This API key can't be used from 196.201.214.10: it isn't on the key's list of allowed addresses.",
                        "doc_url": "https://docs.semalink.africa/errors#ip_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "browser_requests_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "browser_requests_not_allowed",
                        "message": "The SemaLink API is for servers: requests from a browser (with an Origin header) are refused.",
                        "doc_url": "https://docs.semalink.africa/errors#browser_requests_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "api_blocked": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "api_blocked",
                        "message": "SemaLink has paused API access for this account. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#api_blocked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "account_suspended": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "account_suspended",
                        "message": "This organisation is suspended, so its API keys can't be used. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#account_suspended",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait for Retry-After seconds.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "value": {
                      "error": {
                        "type": "rate_limit_error",
                        "code": "rate_limited",
                        "message": "Too many requests with this key. Retry after 1 second.",
                        "doc_url": "https://docs.semalink.africa/errors#rate_limited",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong at SemaLink.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "internal_error",
                        "message": "Something went wrong on SemaLink's side. Try again; if it keeps happening, contact support and quote the request id.",
                        "doc_url": "https://docs.semalink.africa/errors#internal_error",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request took more than 30 seconds and was stopped.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_timeout": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "request_timeout",
                        "message": "The request took too long and was stopped. Retry it with the same Idempotency-Key: it never runs twice.",
                        "doc_url": "https://docs.semalink.africa/errors#request_timeout",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/messages/estimate": {
      "post": {
        "operationId": "estimateMessage",
        "tags": [
          "Messages"
        ],
        "summary": "Estimate a message",
        "description": "How long a message is, whether it can be sent as it is, and what it costs for each number. Sends nothing; a sandbox key gets the same answer as a live one. One SMS (160 standard characters) per message for now: a message that does not fit has fits false, says why in message.problems, and is not priced (every cost null). Each 100 numbers count as one more request against the rate limit. An Idempotency-Key is accepted and not kept: an estimate changes nothing, so a retry simply estimates again.\n\nNeeds the `messages:send` scope.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-semalink-scope": "messages:send",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Accepted (1 to 255 characters) and ignored: an estimate changes nothing."
            },
            "required": false,
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EstimateRequest"
              },
              "example": {
                "text": "Dear parent, the school closes for the holiday on Friday 5 December at 12:00. Greenhill Academy",
                "to": [
                  "+254712345678",
                  "0722000111"
                ],
                "type": "service"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The estimate.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Estimate"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or wrong.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "parameter_missing": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "parameter_missing",
                        "message": "Missing required parameter: text.",
                        "param": "text",
                        "doc_url": "https://docs.semalink.africa/errors#parameter_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "parameter_invalid": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "parameter_invalid",
                        "message": "Invalid to: give a phone number, or a list of 1 to 1,000 of them.",
                        "param": "to",
                        "doc_url": "https://docs.semalink.africa/errors#parameter_invalid",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "parameter_unknown": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "parameter_unknown",
                        "message": "Unknown parameter: message.",
                        "param": "message",
                        "doc_url": "https://docs.semalink.africa/errors#parameter_unknown",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "invalid_json": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "invalid_json",
                        "message": "The body isn't valid JSON.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_json",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "idempotency_key_invalid": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "idempotency_key_invalid",
                        "message": "An Idempotency-Key is 1 to 255 characters.",
                        "doc_url": "https://docs.semalink.africa/errors#idempotency_key_invalid",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_api_key": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "invalid_api_key",
                        "message": "This API key isn't one we know. Check it was copied whole, or make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_api_key",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_revoked": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_revoked",
                        "message": "This API key was revoked. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_revoked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_expired": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_expired",
                        "message": "This API key expired on 2026-12-31T21:00:00.000Z. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_expired",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key can't be used for this request.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_missing": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "scope_missing",
                        "message": "This API key doesn't have the messages:send scope this request needs.",
                        "doc_url": "https://docs.semalink.africa/errors#scope_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "ip_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "ip_not_allowed",
                        "message": "This API key can't be used from 196.201.214.10: it isn't on the key's list of allowed addresses.",
                        "doc_url": "https://docs.semalink.africa/errors#ip_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "browser_requests_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "browser_requests_not_allowed",
                        "message": "The SemaLink API is for servers: requests from a browser (with an Origin header) are refused.",
                        "doc_url": "https://docs.semalink.africa/errors#browser_requests_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "api_blocked": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "api_blocked",
                        "message": "SemaLink has paused API access for this account. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#api_blocked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "account_suspended": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "account_suspended",
                        "message": "This organisation is suspended, so its API keys can't be used. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#account_suspended",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MB.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_too_large": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "request_too_large",
                        "message": "The body is too large.",
                        "doc_url": "https://docs.semalink.africa/errors#request_too_large",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unsupported_media_type": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "unsupported_media_type",
                        "message": "Send the body as JSON, with Content-Type: application/json.",
                        "doc_url": "https://docs.semalink.africa/errors#unsupported_media_type",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait for Retry-After seconds.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "value": {
                      "error": {
                        "type": "rate_limit_error",
                        "code": "rate_limited",
                        "message": "Too many requests with this key. Retry after 1 second.",
                        "doc_url": "https://docs.semalink.africa/errors#rate_limited",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong at SemaLink.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "internal_error",
                        "message": "Something went wrong on SemaLink's side. Try again; if it keeps happening, contact support and quote the request id.",
                        "doc_url": "https://docs.semalink.africa/errors#internal_error",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request took more than 30 seconds and was stopped.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_timeout": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "request_timeout",
                        "message": "The request took too long and was stopped. Retry it with the same Idempotency-Key: it never runs twice.",
                        "doc_url": "https://docs.semalink.africa/errors#request_timeout",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/messages": {
      "post": {
        "operationId": "sendMessage",
        "tags": [
          "Messages"
        ],
        "summary": "Send a message",
        "description": "Sends one message to one number, now or at send_at. A sandbox key plays the message out with no phone reached and nothing charged (the magic numbers in the sandbox guide set its outcome). Live: the same rules as the app (one SMS of standard characters, an approved sender ID, opt-outs, sending hours, review holds, the daily limit), charged when the network takes it and refunded when it refuses it. Retry safely with an Idempotency-Key.\n\nNeeds the `messages:send` scope.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-semalink-scope": "messages:send",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Any unique string (a UUID): a retry with the same key and body within 24 hours gets the first answer, with Idempotent-Replayed: true.",
              "example": "6f1c1a52-6a0b-4d7e-9a43-3f1f9c2d8b10"
            },
            "required": false,
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendMessageRequest"
              },
              "example": {
                "to": "+254712345678",
                "text": "Your order 1042 is ready for collection at Greenhill Shop, Moi Avenue. Call 0712 345 678.",
                "from": "GREENHILL",
                "type": "service",
                "reference": "invoice-1042"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted: the message, queued (or scheduled, or held for a check).",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Message"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or wrong.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "parameter_missing": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "parameter_missing",
                        "message": "Missing required parameter: from.",
                        "param": "from",
                        "doc_url": "https://docs.semalink.africa/errors#parameter_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "parameter_invalid": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "parameter_invalid",
                        "message": "Invalid send_at: choose a time at least 5 minutes from now, or leave it out to send now.",
                        "param": "send_at",
                        "doc_url": "https://docs.semalink.africa/errors#parameter_invalid",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "parameter_unknown": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "parameter_unknown",
                        "message": "Unknown parameter: sender.",
                        "param": "sender",
                        "doc_url": "https://docs.semalink.africa/errors#parameter_unknown",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "invalid_json": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "invalid_json",
                        "message": "The body isn't valid JSON.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_json",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "idempotency_key_invalid": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "idempotency_key_invalid",
                        "message": "An Idempotency-Key is 1 to 255 characters.",
                        "doc_url": "https://docs.semalink.africa/errors#idempotency_key_invalid",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_api_key": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "invalid_api_key",
                        "message": "This API key isn't one we know. Check it was copied whole, or make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_api_key",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_revoked": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_revoked",
                        "message": "This API key was revoked. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_revoked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_expired": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_expired",
                        "message": "This API key expired on 2026-12-31T21:00:00.000Z. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_expired",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "The balance is too low for the send.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "insufficient_balance": {
                    "value": {
                      "error": {
                        "type": "insufficient_balance",
                        "code": "insufficient_balance",
                        "message": "The balance is KES 40.00 short of this send's KES 800.00. Top up, then send again.",
                        "shortfall": {
                          "amount": 4000,
                          "currency": "KES",
                          "display": "KES 40.00"
                        },
                        "doc_url": "https://docs.semalink.africa/errors#insufficient_balance",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The organisation can't send now.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_missing": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "scope_missing",
                        "message": "This API key doesn't have the messages:send scope this request needs.",
                        "doc_url": "https://docs.semalink.africa/errors#scope_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "ip_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "ip_not_allowed",
                        "message": "This API key can't be used from 196.201.214.10: it isn't on the key's list of allowed addresses.",
                        "doc_url": "https://docs.semalink.africa/errors#ip_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "browser_requests_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "browser_requests_not_allowed",
                        "message": "The SemaLink API is for servers: requests from a browser (with an Origin header) are refused.",
                        "doc_url": "https://docs.semalink.africa/errors#browser_requests_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "api_blocked": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "api_blocked",
                        "message": "SemaLink has paused API access for this account. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#api_blocked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "account_suspended": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "account_suspended",
                        "message": "This organisation is suspended, so its API keys can't be used. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#account_suspended",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "sending_paused": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "sending_paused",
                        "message": "SemaLink has paused sending on this account. Reply to our email or contact support to sort it out.",
                        "doc_url": "https://docs.semalink.africa/errors#sending_paused",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "account_not_active": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "account_not_active",
                        "message": "This account isn't active yet, so it can't send messages",
                        "doc_url": "https://docs.semalink.africa/errors#account_not_active",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Sending is off, or the Idempotency-Key was used with another request or is still running.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "sending_disabled": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "sending_disabled",
                        "message": "Sending is switched off for now, so nothing was sent",
                        "doc_url": "https://docs.semalink.africa/errors#sending_disabled",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "idempotency_key_reused": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was already used with a different request. Use a new key for a new request.",
                        "doc_url": "https://docs.semalink.africa/errors#idempotency_key_reused",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "idempotency_key_in_use": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "idempotency_key_in_use",
                        "message": "A request with this Idempotency-Key is still running. Retry when it has finished.",
                        "doc_url": "https://docs.semalink.africa/errors#idempotency_key_in_use",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "idempotency_answer_unavailable": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "idempotency_answer_unavailable",
                        "message": "This request already ran (it answered 202), but its answer was too large to keep. Look up what it made instead of retrying.",
                        "doc_url": "https://docs.semalink.africa/errors#idempotency_answer_unavailable",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MB.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_too_large": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "request_too_large",
                        "message": "The body is too large.",
                        "doc_url": "https://docs.semalink.africa/errors#request_too_large",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unsupported_media_type": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "unsupported_media_type",
                        "message": "Send the body as JSON, with Content-Type: application/json.",
                        "doc_url": "https://docs.semalink.africa/errors#unsupported_media_type",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "The send can't go as asked: nothing was sent or charged.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "message_too_long": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "message_too_long",
                        "message": "The text is 172 characters: one SMS holds 160. Shorten it by 12.",
                        "param": "text",
                        "characters": 172,
                        "max_characters": 160,
                        "doc_url": "https://docs.semalink.africa/errors#message_too_long",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "unsupported_characters": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "unsupported_characters",
                        "message": "The text has characters outside the SMS alphabet: ā (U+0101). Replace or remove them.",
                        "param": "text",
                        "unsupported_characters": [
                          {
                            "character": "ā",
                            "code_point": "U+0101",
                            "name": "accented letter",
                            "replacement": "a"
                          }
                        ],
                        "doc_url": "https://docs.semalink.africa/errors#unsupported_characters",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "sender_id_not_approved": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "sender_id_not_approved",
                        "message": "GREENHILL isn't approved to send yet. Send from an approved sender ID.",
                        "param": "from",
                        "doc_url": "https://docs.semalink.africa/errors#sender_id_not_approved",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "outside_sending_hours": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "outside_sending_hours",
                        "message": "Promotions to Kenya go between 07:00 and 19:00 East Africa Time. The next opening is 2026-12-02T04:00:00.000Z: send then, or pass it as send_at.",
                        "param": "type",
                        "next_window_at": "2026-12-02T04:00:00.000Z",
                        "doc_url": "https://docs.semalink.africa/errors#outside_sending_hours",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "promotional_not_available": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "promotional_not_available",
                        "message": "Promotions to Tanzania aren't available yet. Send it as a service message if it is one.",
                        "param": "type",
                        "doc_url": "https://docs.semalink.africa/errors#promotional_not_available",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "daily_limit_reached": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "daily_limit_reached",
                        "message": "Your account can send 1,000 messages a day. You've sent 990 today, so this send of 20 is over by 10. Send it tomorrow, or to fewer people.",
                        "doc_url": "https://docs.semalink.africa/errors#daily_limit_reached",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "content_blocked": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "content_blocked",
                        "message": "SemaLink can't send this message as it is: its content is of a kind we don't carry. Contact support if you think this is wrong.",
                        "param": "text",
                        "category": "betting",
                        "doc_url": "https://docs.semalink.africa/errors#content_blocked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "invalid_number": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "invalid_number",
                        "message": "This number is too short.",
                        "param": "to",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_number",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "opted_out": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "opted_out",
                        "message": "This number opted out of your messages.",
                        "param": "to",
                        "doc_url": "https://docs.semalink.africa/errors#opted_out",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "unsupported_country": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "unsupported_country",
                        "message": "GREENHILL sends to Kenya only.",
                        "param": "to",
                        "doc_url": "https://docs.semalink.africa/errors#unsupported_country",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait for Retry-After seconds.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "value": {
                      "error": {
                        "type": "rate_limit_error",
                        "code": "rate_limited",
                        "message": "Too many requests with this key. Retry after 1 second.",
                        "doc_url": "https://docs.semalink.africa/errors#rate_limited",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong at SemaLink.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "internal_error",
                        "message": "Something went wrong on SemaLink's side. Try again; if it keeps happening, contact support and quote the request id.",
                        "doc_url": "https://docs.semalink.africa/errors#internal_error",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request took more than 30 seconds and was stopped.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_timeout": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "request_timeout",
                        "message": "The request took too long and was stopped. Retry it with the same Idempotency-Key: it never runs twice.",
                        "doc_url": "https://docs.semalink.africa/errors#request_timeout",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listMessages",
        "tags": [
          "Messages"
        ],
        "summary": "List messages",
        "description": "The organisation's messages, the newest first (sent from the app or the API; a sandbox key's are the sandbox's), filtered by status, number, batch, reference, sender ID and when they were made. Page with starting_after.\n\nNeeds the `messages:read` scope.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-semalink-scope": "messages:read",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20,
              "description": "1 to 100; 20 when left out.",
              "example": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 64,
              "description": "A page's next_cursor: the messages after it.",
              "example": "msg_3b9f6c2a1d4e4f5a8b7c6d5e4f3a2b1c"
            },
            "required": false,
            "name": "starting_after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "scheduled",
                "queued",
                "held",
                "sent",
                "delivered",
                "failed",
                "expired",
                "rejected",
                "cancelled"
              ]
            },
            "required": false,
            "name": "status",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Messages to this number.",
              "example": "+254712345678"
            },
            "required": false,
            "name": "to",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 64,
              "description": "Messages of this batch (bat_...).",
              "example": "bat_7a1c2e3f4b5d4c6e8f9a0b1c2d3e4f5a"
            },
            "required": false,
            "name": "batch",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 128,
              "example": "invoice-1042"
            },
            "required": false,
            "name": "reference",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 64,
              "description": "Messages from this sender ID (its name).",
              "example": "GREENHILL"
            },
            "required": false,
            "name": "sender_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "Made at or after this time.",
              "example": "2026-12-01T00:00:00.000Z"
            },
            "required": false,
            "name": "created[gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "Made at or before this time.",
              "example": "2026-12-31T23:59:59.000Z"
            },
            "required": false,
            "name": "created[lte]",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of messages.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageList"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or wrong.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "parameter_missing": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "parameter_missing",
                        "message": "Missing required parameter: from.",
                        "param": "from",
                        "doc_url": "https://docs.semalink.africa/errors#parameter_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "parameter_invalid": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "parameter_invalid",
                        "message": "Invalid send_at: choose a time at least 5 minutes from now, or leave it out to send now.",
                        "param": "send_at",
                        "doc_url": "https://docs.semalink.africa/errors#parameter_invalid",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "parameter_unknown": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "parameter_unknown",
                        "message": "Unknown parameter: sender.",
                        "param": "sender",
                        "doc_url": "https://docs.semalink.africa/errors#parameter_unknown",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "invalid_json": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "invalid_json",
                        "message": "The body isn't valid JSON.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_json",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_api_key": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "invalid_api_key",
                        "message": "This API key isn't one we know. Check it was copied whole, or make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_api_key",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_revoked": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_revoked",
                        "message": "This API key was revoked. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_revoked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_expired": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_expired",
                        "message": "This API key expired on 2026-12-31T21:00:00.000Z. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_expired",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key can't be used for this request.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_missing": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "scope_missing",
                        "message": "This API key doesn't have the messages:read scope this request needs.",
                        "doc_url": "https://docs.semalink.africa/errors#scope_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "ip_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "ip_not_allowed",
                        "message": "This API key can't be used from 196.201.214.10: it isn't on the key's list of allowed addresses.",
                        "doc_url": "https://docs.semalink.africa/errors#ip_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "browser_requests_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "browser_requests_not_allowed",
                        "message": "The SemaLink API is for servers: requests from a browser (with an Origin header) are refused.",
                        "doc_url": "https://docs.semalink.africa/errors#browser_requests_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "api_blocked": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "api_blocked",
                        "message": "SemaLink has paused API access for this account. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#api_blocked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "account_suspended": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "account_suspended",
                        "message": "This organisation is suspended, so its API keys can't be used. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#account_suspended",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait for Retry-After seconds.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "value": {
                      "error": {
                        "type": "rate_limit_error",
                        "code": "rate_limited",
                        "message": "Too many requests with this key. Retry after 1 second.",
                        "doc_url": "https://docs.semalink.africa/errors#rate_limited",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong at SemaLink.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "internal_error",
                        "message": "Something went wrong on SemaLink's side. Try again; if it keeps happening, contact support and quote the request id.",
                        "doc_url": "https://docs.semalink.africa/errors#internal_error",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request took more than 30 seconds and was stopped.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_timeout": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "request_timeout",
                        "message": "The request took too long and was stopped. Retry it with the same Idempotency-Key: it never runs twice.",
                        "doc_url": "https://docs.semalink.africa/errors#request_timeout",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/batches": {
      "post": {
        "operationId": "sendBatch",
        "tags": [
          "Batches"
        ],
        "summary": "Send a batch",
        "description": "Sends to up to 1,000 numbers: the same text to every number in `to`, or a personalised text each in `messages`. Each number is accepted (with its message) or rejected and why (invalid_number, unsupported_country, opted_out, duplicate_in_request, no_price), never charged when rejected. Optional send_at; a scheduled batch can be cancelled.\n\nNeeds the `messages:send` scope.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-semalink-scope": "messages:send",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Any unique string (a UUID): a retry with the same key and body within 24 hours gets the first answer, with Idempotent-Replayed: true.",
              "example": "6f1c1a52-6a0b-4d7e-9a43-3f1f9c2d8b10"
            },
            "required": false,
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchRequest"
              },
              "example": {
                "from": "GREENHILL",
                "type": "service",
                "text": "Your order 1042 is ready for collection at Greenhill Shop, Moi Avenue. Call 0712 345 678.",
                "to": [
                  "+254712345678",
                  "0722000111",
                  "0712 34"
                ],
                "reference": "december-reminders"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted: the batch, and each recipient accepted or rejected.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchCreated"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or wrong.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "parameter_missing": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "parameter_missing",
                        "message": "Missing required parameter: from.",
                        "param": "from",
                        "doc_url": "https://docs.semalink.africa/errors#parameter_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "parameter_invalid": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "parameter_invalid",
                        "message": "Invalid send_at: choose a time at least 5 minutes from now, or leave it out to send now.",
                        "param": "send_at",
                        "doc_url": "https://docs.semalink.africa/errors#parameter_invalid",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "parameter_unknown": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "parameter_unknown",
                        "message": "Unknown parameter: sender.",
                        "param": "sender",
                        "doc_url": "https://docs.semalink.africa/errors#parameter_unknown",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "invalid_json": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "invalid_json",
                        "message": "The body isn't valid JSON.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_json",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "idempotency_key_invalid": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "idempotency_key_invalid",
                        "message": "An Idempotency-Key is 1 to 255 characters.",
                        "doc_url": "https://docs.semalink.africa/errors#idempotency_key_invalid",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_api_key": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "invalid_api_key",
                        "message": "This API key isn't one we know. Check it was copied whole, or make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_api_key",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_revoked": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_revoked",
                        "message": "This API key was revoked. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_revoked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_expired": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_expired",
                        "message": "This API key expired on 2026-12-31T21:00:00.000Z. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_expired",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "The balance is too low for the send.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "insufficient_balance": {
                    "value": {
                      "error": {
                        "type": "insufficient_balance",
                        "code": "insufficient_balance",
                        "message": "The balance is KES 40.00 short of this send's KES 800.00. Top up, then send again.",
                        "shortfall": {
                          "amount": 4000,
                          "currency": "KES",
                          "display": "KES 40.00"
                        },
                        "doc_url": "https://docs.semalink.africa/errors#insufficient_balance",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The organisation can't send now.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_missing": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "scope_missing",
                        "message": "This API key doesn't have the messages:send scope this request needs.",
                        "doc_url": "https://docs.semalink.africa/errors#scope_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "ip_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "ip_not_allowed",
                        "message": "This API key can't be used from 196.201.214.10: it isn't on the key's list of allowed addresses.",
                        "doc_url": "https://docs.semalink.africa/errors#ip_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "browser_requests_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "browser_requests_not_allowed",
                        "message": "The SemaLink API is for servers: requests from a browser (with an Origin header) are refused.",
                        "doc_url": "https://docs.semalink.africa/errors#browser_requests_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "api_blocked": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "api_blocked",
                        "message": "SemaLink has paused API access for this account. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#api_blocked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "account_suspended": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "account_suspended",
                        "message": "This organisation is suspended, so its API keys can't be used. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#account_suspended",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "sending_paused": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "sending_paused",
                        "message": "SemaLink has paused sending on this account. Reply to our email or contact support to sort it out.",
                        "doc_url": "https://docs.semalink.africa/errors#sending_paused",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "account_not_active": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "account_not_active",
                        "message": "This account isn't active yet, so it can't send messages",
                        "doc_url": "https://docs.semalink.africa/errors#account_not_active",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Sending is off, or the Idempotency-Key was used with another request or is still running.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "sending_disabled": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "sending_disabled",
                        "message": "Sending is switched off for now, so nothing was sent",
                        "doc_url": "https://docs.semalink.africa/errors#sending_disabled",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "idempotency_key_reused": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was already used with a different request. Use a new key for a new request.",
                        "doc_url": "https://docs.semalink.africa/errors#idempotency_key_reused",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "idempotency_key_in_use": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "idempotency_key_in_use",
                        "message": "A request with this Idempotency-Key is still running. Retry when it has finished.",
                        "doc_url": "https://docs.semalink.africa/errors#idempotency_key_in_use",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "idempotency_answer_unavailable": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "idempotency_answer_unavailable",
                        "message": "This request already ran (it answered 202), but its answer was too large to keep. Look up what it made instead of retrying.",
                        "doc_url": "https://docs.semalink.africa/errors#idempotency_answer_unavailable",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MB.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_too_large": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "request_too_large",
                        "message": "The body is too large.",
                        "doc_url": "https://docs.semalink.africa/errors#request_too_large",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unsupported_media_type": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "unsupported_media_type",
                        "message": "Send the body as JSON, with Content-Type: application/json.",
                        "doc_url": "https://docs.semalink.africa/errors#unsupported_media_type",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "The send can't go as asked: nothing was sent or charged.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "message_too_long": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "message_too_long",
                        "message": "The text is 172 characters: one SMS holds 160. Shorten it by 12.",
                        "param": "text",
                        "characters": 172,
                        "max_characters": 160,
                        "doc_url": "https://docs.semalink.africa/errors#message_too_long",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "unsupported_characters": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "unsupported_characters",
                        "message": "The text has characters outside the SMS alphabet: ā (U+0101). Replace or remove them.",
                        "param": "text",
                        "unsupported_characters": [
                          {
                            "character": "ā",
                            "code_point": "U+0101",
                            "name": "accented letter",
                            "replacement": "a"
                          }
                        ],
                        "doc_url": "https://docs.semalink.africa/errors#unsupported_characters",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "sender_id_not_approved": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "sender_id_not_approved",
                        "message": "GREENHILL isn't approved to send yet. Send from an approved sender ID.",
                        "param": "from",
                        "doc_url": "https://docs.semalink.africa/errors#sender_id_not_approved",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "outside_sending_hours": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "outside_sending_hours",
                        "message": "Promotions to Kenya go between 07:00 and 19:00 East Africa Time. The next opening is 2026-12-02T04:00:00.000Z: send then, or pass it as send_at.",
                        "param": "type",
                        "next_window_at": "2026-12-02T04:00:00.000Z",
                        "doc_url": "https://docs.semalink.africa/errors#outside_sending_hours",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "promotional_not_available": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "promotional_not_available",
                        "message": "Promotions to Tanzania aren't available yet. Send it as a service message if it is one.",
                        "param": "type",
                        "doc_url": "https://docs.semalink.africa/errors#promotional_not_available",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "daily_limit_reached": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "daily_limit_reached",
                        "message": "Your account can send 1,000 messages a day. You've sent 990 today, so this send of 20 is over by 10. Send it tomorrow, or to fewer people.",
                        "doc_url": "https://docs.semalink.africa/errors#daily_limit_reached",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "content_blocked": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "content_blocked",
                        "message": "SemaLink can't send this message as it is: its content is of a kind we don't carry. Contact support if you think this is wrong.",
                        "param": "text",
                        "category": "betting",
                        "doc_url": "https://docs.semalink.africa/errors#content_blocked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "no_valid_recipients": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "no_valid_recipients",
                        "message": "None of the numbers can be sent to: each is rejected. POST /v1/messages/estimate says why for each.",
                        "param": "to",
                        "doc_url": "https://docs.semalink.africa/errors#no_valid_recipients",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait for Retry-After seconds.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "value": {
                      "error": {
                        "type": "rate_limit_error",
                        "code": "rate_limited",
                        "message": "Too many requests with this key. Retry after 1 second.",
                        "doc_url": "https://docs.semalink.africa/errors#rate_limited",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong at SemaLink.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "internal_error",
                        "message": "Something went wrong on SemaLink's side. Try again; if it keeps happening, contact support and quote the request id.",
                        "doc_url": "https://docs.semalink.africa/errors#internal_error",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request took more than 30 seconds and was stopped.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_timeout": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "request_timeout",
                        "message": "The request took too long and was stopped. Retry it with the same Idempotency-Key: it never runs twice.",
                        "doc_url": "https://docs.semalink.africa/errors#request_timeout",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/messages/{id}": {
      "get": {
        "operationId": "getMessage",
        "tags": [
          "Messages"
        ],
        "summary": "Get a message",
        "description": "One message, with each status it has had.\n\nNeeds the `messages:read` scope.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-semalink-scope": "messages:read",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The msg_... id.",
              "example": "msg_3b9f6c2a1d4e4f5a8b7c6d5e4f3a2b1c"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The message.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageWithHistory"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_api_key": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "invalid_api_key",
                        "message": "This API key isn't one we know. Check it was copied whole, or make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_api_key",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_revoked": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_revoked",
                        "message": "This API key was revoked. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_revoked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_expired": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_expired",
                        "message": "This API key expired on 2026-12-31T21:00:00.000Z. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_expired",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key can't be used for this request.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_missing": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "scope_missing",
                        "message": "This API key doesn't have the messages:read scope this request needs.",
                        "doc_url": "https://docs.semalink.africa/errors#scope_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "ip_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "ip_not_allowed",
                        "message": "This API key can't be used from 196.201.214.10: it isn't on the key's list of allowed addresses.",
                        "doc_url": "https://docs.semalink.africa/errors#ip_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "browser_requests_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "browser_requests_not_allowed",
                        "message": "The SemaLink API is for servers: requests from a browser (with an Origin header) are refused.",
                        "doc_url": "https://docs.semalink.africa/errors#browser_requests_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "api_blocked": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "api_blocked",
                        "message": "SemaLink has paused API access for this account. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#api_blocked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "account_suspended": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "account_suspended",
                        "message": "This organisation is suspended, so its API keys can't be used. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#account_suspended",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No such message for this key.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "resource_not_found": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "resource_not_found",
                        "message": "There's no message msg_3b9f6c2a1d4e4f5a8b7c6d5e4f3a2b1c for this key.",
                        "param": "id",
                        "doc_url": "https://docs.semalink.africa/errors#resource_not_found",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait for Retry-After seconds.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "value": {
                      "error": {
                        "type": "rate_limit_error",
                        "code": "rate_limited",
                        "message": "Too many requests with this key. Retry after 1 second.",
                        "doc_url": "https://docs.semalink.africa/errors#rate_limited",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong at SemaLink.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "internal_error",
                        "message": "Something went wrong on SemaLink's side. Try again; if it keeps happening, contact support and quote the request id.",
                        "doc_url": "https://docs.semalink.africa/errors#internal_error",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request took more than 30 seconds and was stopped.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_timeout": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "request_timeout",
                        "message": "The request took too long and was stopped. Retry it with the same Idempotency-Key: it never runs twice.",
                        "doc_url": "https://docs.semalink.africa/errors#request_timeout",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/batches/{id}": {
      "get": {
        "operationId": "getBatch",
        "tags": [
          "Batches"
        ],
        "summary": "Get a batch",
        "description": "A batch with its messages counted by status, its cost and what came back. Its messages: GET /v1/messages?batch=.\n\nNeeds the `messages:read` scope.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-semalink-scope": "messages:read",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The bat_... id.",
              "example": "bat_7a1c2e3f4b5d4c6e8f9a0b1c2d3e4f5a"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The batch.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_api_key": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "invalid_api_key",
                        "message": "This API key isn't one we know. Check it was copied whole, or make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_api_key",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_revoked": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_revoked",
                        "message": "This API key was revoked. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_revoked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_expired": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_expired",
                        "message": "This API key expired on 2026-12-31T21:00:00.000Z. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_expired",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key can't be used for this request.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_missing": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "scope_missing",
                        "message": "This API key doesn't have the messages:read scope this request needs.",
                        "doc_url": "https://docs.semalink.africa/errors#scope_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "ip_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "ip_not_allowed",
                        "message": "This API key can't be used from 196.201.214.10: it isn't on the key's list of allowed addresses.",
                        "doc_url": "https://docs.semalink.africa/errors#ip_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "browser_requests_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "browser_requests_not_allowed",
                        "message": "The SemaLink API is for servers: requests from a browser (with an Origin header) are refused.",
                        "doc_url": "https://docs.semalink.africa/errors#browser_requests_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "api_blocked": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "api_blocked",
                        "message": "SemaLink has paused API access for this account. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#api_blocked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "account_suspended": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "account_suspended",
                        "message": "This organisation is suspended, so its API keys can't be used. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#account_suspended",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No such batch for this key.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "resource_not_found": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "resource_not_found",
                        "message": "There's no batch bat_7a1c2e3f4b5d4c6e8f9a0b1c2d3e4f5a for this key.",
                        "param": "id",
                        "doc_url": "https://docs.semalink.africa/errors#resource_not_found",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait for Retry-After seconds.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "value": {
                      "error": {
                        "type": "rate_limit_error",
                        "code": "rate_limited",
                        "message": "Too many requests with this key. Retry after 1 second.",
                        "doc_url": "https://docs.semalink.africa/errors#rate_limited",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong at SemaLink.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "internal_error",
                        "message": "Something went wrong on SemaLink's side. Try again; if it keeps happening, contact support and quote the request id.",
                        "doc_url": "https://docs.semalink.africa/errors#internal_error",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request took more than 30 seconds and was stopped.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_timeout": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "request_timeout",
                        "message": "The request took too long and was stopped. Retry it with the same Idempotency-Key: it never runs twice.",
                        "doc_url": "https://docs.semalink.africa/errors#request_timeout",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/batches/{id}/cancel": {
      "post": {
        "operationId": "cancelBatch",
        "tags": [
          "Batches"
        ],
        "summary": "Cancel a scheduled batch",
        "description": "Cancels a batch that hasn't started (scheduled, or held for a check); what was set aside for it comes back at once. A cancelled batch answers as it is.\n\nNeeds the `messages:send` scope.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-semalink-scope": "messages:send",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The bat_... id.",
              "example": "bat_7a1c2e3f4b5d4c6e8f9a0b1c2d3e4f5a"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Any unique string (a UUID): a retry with the same key and body within 24 hours gets the first answer, with Idempotent-Replayed: true.",
              "example": "6f1c1a52-6a0b-4d7e-9a43-3f1f9c2d8b10"
            },
            "required": false,
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The cancelled batch.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            }
          },
          "400": {
            "description": "The request is malformed.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_json": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "invalid_json",
                        "message": "The body isn't valid JSON.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_json",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "idempotency_key_invalid": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "idempotency_key_invalid",
                        "message": "An Idempotency-Key is 1 to 255 characters.",
                        "doc_url": "https://docs.semalink.africa/errors#idempotency_key_invalid",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_api_key": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "invalid_api_key",
                        "message": "This API key isn't one we know. Check it was copied whole, or make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_api_key",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_revoked": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_revoked",
                        "message": "This API key was revoked. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_revoked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_expired": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_expired",
                        "message": "This API key expired on 2026-12-31T21:00:00.000Z. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_expired",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key can't be used for this request.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_missing": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "scope_missing",
                        "message": "This API key doesn't have the messages:send scope this request needs.",
                        "doc_url": "https://docs.semalink.africa/errors#scope_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "ip_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "ip_not_allowed",
                        "message": "This API key can't be used from 196.201.214.10: it isn't on the key's list of allowed addresses.",
                        "doc_url": "https://docs.semalink.africa/errors#ip_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "browser_requests_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "browser_requests_not_allowed",
                        "message": "The SemaLink API is for servers: requests from a browser (with an Origin header) are refused.",
                        "doc_url": "https://docs.semalink.africa/errors#browser_requests_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "api_blocked": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "api_blocked",
                        "message": "SemaLink has paused API access for this account. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#api_blocked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "account_suspended": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "account_suspended",
                        "message": "This organisation is suspended, so its API keys can't be used. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#account_suspended",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No such batch for this key.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "resource_not_found": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "resource_not_found",
                        "message": "There's no batch bat_7a1c2e3f4b5d4c6e8f9a0b1c2d3e4f5a for this key.",
                        "param": "id",
                        "doc_url": "https://docs.semalink.africa/errors#resource_not_found",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "It has started, or the Idempotency-Key was reused.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "batch_not_cancellable": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "batch_not_cancellable",
                        "message": "This batch is sending: only a scheduled batch can be cancelled.",
                        "doc_url": "https://docs.semalink.africa/errors#batch_not_cancellable",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "idempotency_key_reused": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was already used with a different request. Use a new key for a new request.",
                        "doc_url": "https://docs.semalink.africa/errors#idempotency_key_reused",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "idempotency_key_in_use": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "idempotency_key_in_use",
                        "message": "A request with this Idempotency-Key is still running. Retry when it has finished.",
                        "doc_url": "https://docs.semalink.africa/errors#idempotency_key_in_use",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "idempotency_answer_unavailable": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "idempotency_answer_unavailable",
                        "message": "This request already ran (it answered 202), but its answer was too large to keep. Look up what it made instead of retrying.",
                        "doc_url": "https://docs.semalink.africa/errors#idempotency_answer_unavailable",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MB.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_too_large": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "request_too_large",
                        "message": "The body is too large.",
                        "doc_url": "https://docs.semalink.africa/errors#request_too_large",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unsupported_media_type": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "unsupported_media_type",
                        "message": "Send the body as JSON, with Content-Type: application/json.",
                        "doc_url": "https://docs.semalink.africa/errors#unsupported_media_type",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait for Retry-After seconds.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "value": {
                      "error": {
                        "type": "rate_limit_error",
                        "code": "rate_limited",
                        "message": "Too many requests with this key. Retry after 1 second.",
                        "doc_url": "https://docs.semalink.africa/errors#rate_limited",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong at SemaLink.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "internal_error",
                        "message": "Something went wrong on SemaLink's side. Try again; if it keeps happening, contact support and quote the request id.",
                        "doc_url": "https://docs.semalink.africa/errors#internal_error",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request took more than 30 seconds and was stopped.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_timeout": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "request_timeout",
                        "message": "The request took too long and was stopped. Retry it with the same Idempotency-Key: it never runs twice.",
                        "doc_url": "https://docs.semalink.africa/errors#request_timeout",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/events/{id}": {
      "get": {
        "operationId": "getEvent",
        "tags": [
          "Events"
        ],
        "summary": "Get an event",
        "description": "An event as it was delivered (to check a webhook you received, or to replay one), for 30 days. A live key reads live events, a sandbox key the sandbox's.\n\nNeeds the `webhooks:manage` scope.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-semalink-scope": "webhooks:manage",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The evt_... id.",
              "example": "evt_9d8c7b6a5f4e4d3c2b1a0f9e8d7c6b5a"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The event.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Event"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_api_key": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "invalid_api_key",
                        "message": "This API key isn't one we know. Check it was copied whole, or make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_api_key",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_revoked": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_revoked",
                        "message": "This API key was revoked. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_revoked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_expired": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_expired",
                        "message": "This API key expired on 2026-12-31T21:00:00.000Z. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_expired",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key can't be used for this request.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_missing": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "scope_missing",
                        "message": "This API key doesn't have the webhooks:manage scope this request needs.",
                        "doc_url": "https://docs.semalink.africa/errors#scope_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "ip_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "ip_not_allowed",
                        "message": "This API key can't be used from 196.201.214.10: it isn't on the key's list of allowed addresses.",
                        "doc_url": "https://docs.semalink.africa/errors#ip_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "browser_requests_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "browser_requests_not_allowed",
                        "message": "The SemaLink API is for servers: requests from a browser (with an Origin header) are refused.",
                        "doc_url": "https://docs.semalink.africa/errors#browser_requests_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "api_blocked": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "api_blocked",
                        "message": "SemaLink has paused API access for this account. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#api_blocked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "account_suspended": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "account_suspended",
                        "message": "This organisation is suspended, so its API keys can't be used. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#account_suspended",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No such event for this key.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "resource_not_found": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "resource_not_found",
                        "message": "There's no event evt_9d8c7b6a5f4e4d3c2b1a0f9e8d7c6b5a for this key.",
                        "param": "id",
                        "doc_url": "https://docs.semalink.africa/errors#resource_not_found",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait for Retry-After seconds.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "value": {
                      "error": {
                        "type": "rate_limit_error",
                        "code": "rate_limited",
                        "message": "Too many requests with this key. Retry after 1 second.",
                        "doc_url": "https://docs.semalink.africa/errors#rate_limited",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong at SemaLink.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "internal_error",
                        "message": "Something went wrong on SemaLink's side. Try again; if it keeps happening, contact support and quote the request id.",
                        "doc_url": "https://docs.semalink.africa/errors#internal_error",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request took more than 30 seconds and was stopped.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_timeout": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "request_timeout",
                        "message": "The request took too long and was stopped. Retry it with the same Idempotency-Key: it never runs twice.",
                        "doc_url": "https://docs.semalink.africa/errors#request_timeout",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/webhooks": {
      "get": {
        "operationId": "listWebhooks",
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhook endpoints",
        "description": "A live key manages the live endpoints; a sandbox key the test ones, which get the sandbox's events.\n\nNeeds the `webhooks:manage` scope.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-semalink-scope": "webhooks:manage",
        "responses": {
          "200": {
            "description": "The endpoints.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointList"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_api_key": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "invalid_api_key",
                        "message": "This API key isn't one we know. Check it was copied whole, or make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_api_key",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_revoked": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_revoked",
                        "message": "This API key was revoked. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_revoked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_expired": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_expired",
                        "message": "This API key expired on 2026-12-31T21:00:00.000Z. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_expired",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key can't be used for this request.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_missing": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "scope_missing",
                        "message": "This API key doesn't have the webhooks:manage scope this request needs.",
                        "doc_url": "https://docs.semalink.africa/errors#scope_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "ip_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "ip_not_allowed",
                        "message": "This API key can't be used from 196.201.214.10: it isn't on the key's list of allowed addresses.",
                        "doc_url": "https://docs.semalink.africa/errors#ip_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "browser_requests_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "browser_requests_not_allowed",
                        "message": "The SemaLink API is for servers: requests from a browser (with an Origin header) are refused.",
                        "doc_url": "https://docs.semalink.africa/errors#browser_requests_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "api_blocked": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "api_blocked",
                        "message": "SemaLink has paused API access for this account. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#api_blocked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "account_suspended": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "account_suspended",
                        "message": "This organisation is suspended, so its API keys can't be used. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#account_suspended",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait for Retry-After seconds.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "value": {
                      "error": {
                        "type": "rate_limit_error",
                        "code": "rate_limited",
                        "message": "Too many requests with this key. Retry after 1 second.",
                        "doc_url": "https://docs.semalink.africa/errors#rate_limited",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong at SemaLink.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "internal_error",
                        "message": "Something went wrong on SemaLink's side. Try again; if it keeps happening, contact support and quote the request id.",
                        "doc_url": "https://docs.semalink.africa/errors#internal_error",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request took more than 30 seconds and was stopped.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_timeout": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "request_timeout",
                        "message": "The request took too long and was stopped. Retry it with the same Idempotency-Key: it never runs twice.",
                        "doc_url": "https://docs.semalink.africa/errors#request_timeout",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Create a webhook endpoint",
        "description": "A live key manages the live endpoints; a sandbox key the test ones, which get the sandbox's events. The signing secret is shown this once. Each delivery is signed: X-SemaLink-Signature-256 is t=<unix time>,v1=<hex HMAC-SHA256 of \"<t>.<body>\" with the secret>; refuse one older than 5 minutes.\n\nNeeds the `webhooks:manage` scope.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-semalink-scope": "webhooks:manage",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Any unique string (a UUID): a retry with the same key and body within 24 hours gets the first answer, with Idempotent-Replayed: true.",
              "example": "6f1c1a52-6a0b-4d7e-9a43-3f1f9c2d8b10"
            },
            "required": false,
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebhookRequest"
              },
              "example": {
                "url": "https://greenhill.co.ke/semalink/events",
                "events": [
                  "message.delivered",
                  "message.failed"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created, with its secret.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointCreated"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or wrong.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "parameter_missing": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "parameter_missing",
                        "message": "Missing required parameter: from.",
                        "param": "from",
                        "doc_url": "https://docs.semalink.africa/errors#parameter_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "parameter_invalid": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "parameter_invalid",
                        "message": "Invalid send_at: choose a time at least 5 minutes from now, or leave it out to send now.",
                        "param": "send_at",
                        "doc_url": "https://docs.semalink.africa/errors#parameter_invalid",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "parameter_unknown": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "parameter_unknown",
                        "message": "Unknown parameter: sender.",
                        "param": "sender",
                        "doc_url": "https://docs.semalink.africa/errors#parameter_unknown",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "invalid_json": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "invalid_json",
                        "message": "The body isn't valid JSON.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_json",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "idempotency_key_invalid": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "idempotency_key_invalid",
                        "message": "An Idempotency-Key is 1 to 255 characters.",
                        "doc_url": "https://docs.semalink.africa/errors#idempotency_key_invalid",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_api_key": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "invalid_api_key",
                        "message": "This API key isn't one we know. Check it was copied whole, or make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_api_key",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_revoked": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_revoked",
                        "message": "This API key was revoked. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_revoked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_expired": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_expired",
                        "message": "This API key expired on 2026-12-31T21:00:00.000Z. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_expired",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key can't be used for this request.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_missing": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "scope_missing",
                        "message": "This API key doesn't have the webhooks:manage scope this request needs.",
                        "doc_url": "https://docs.semalink.africa/errors#scope_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "ip_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "ip_not_allowed",
                        "message": "This API key can't be used from 196.201.214.10: it isn't on the key's list of allowed addresses.",
                        "doc_url": "https://docs.semalink.africa/errors#ip_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "browser_requests_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "browser_requests_not_allowed",
                        "message": "The SemaLink API is for servers: requests from a browser (with an Origin header) are refused.",
                        "doc_url": "https://docs.semalink.africa/errors#browser_requests_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "api_blocked": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "api_blocked",
                        "message": "SemaLink has paused API access for this account. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#api_blocked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "account_suspended": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "account_suspended",
                        "message": "This organisation is suspended, so its API keys can't be used. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#account_suspended",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The Idempotency-Key was used with another request, or that request is still running.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "idempotency_key_reused": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was already used with a different request. Use a new key for a new request.",
                        "doc_url": "https://docs.semalink.africa/errors#idempotency_key_reused",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "idempotency_key_in_use": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "idempotency_key_in_use",
                        "message": "A request with this Idempotency-Key is still running. Retry when it has finished.",
                        "doc_url": "https://docs.semalink.africa/errors#idempotency_key_in_use",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "idempotency_answer_unavailable": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "idempotency_answer_unavailable",
                        "message": "This request already ran (it answered 202), but its answer was too large to keep. Look up what it made instead of retrying.",
                        "doc_url": "https://docs.semalink.africa/errors#idempotency_answer_unavailable",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MB.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_too_large": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "request_too_large",
                        "message": "The body is too large.",
                        "doc_url": "https://docs.semalink.africa/errors#request_too_large",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unsupported_media_type": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "unsupported_media_type",
                        "message": "Send the body as JSON, with Content-Type: application/json.",
                        "doc_url": "https://docs.semalink.africa/errors#unsupported_media_type",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "The URL can't be delivered to.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "url_not_https": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "url_not_https",
                        "message": "Webhooks must use https. Use a URL that starts with https://.",
                        "doc_url": "https://docs.semalink.africa/errors#url_not_https",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "url_private_address": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "url_private_address",
                        "message": "intranet.local points at a private network address, which SemaLink can't deliver to. Use a public address.",
                        "doc_url": "https://docs.semalink.africa/errors#url_private_address",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many webhook changes and tests for the organisation.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "value": {
                      "error": {
                        "type": "rate_limit_error",
                        "code": "rate_limited",
                        "message": "Too many webhook changes and tests for this organisation: 20 a minute. Retry after 3 seconds.",
                        "doc_url": "https://docs.semalink.africa/errors#rate_limited",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong at SemaLink.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "internal_error",
                        "message": "Something went wrong on SemaLink's side. Try again; if it keeps happening, contact support and quote the request id.",
                        "doc_url": "https://docs.semalink.africa/errors#internal_error",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request took more than 30 seconds and was stopped.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_timeout": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "request_timeout",
                        "message": "The request took too long and was stopped. Retry it with the same Idempotency-Key: it never runs twice.",
                        "doc_url": "https://docs.semalink.africa/errors#request_timeout",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/webhooks/{id}": {
      "get": {
        "operationId": "getWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Get a webhook endpoint",
        "description": "A live key manages the live endpoints; a sandbox key the test ones, which get the sandbox's events.\n\nNeeds the `webhooks:manage` scope.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-semalink-scope": "webhooks:manage",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The whe_... id.",
              "example": "whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The endpoint.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_api_key": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "invalid_api_key",
                        "message": "This API key isn't one we know. Check it was copied whole, or make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_api_key",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_revoked": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_revoked",
                        "message": "This API key was revoked. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_revoked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_expired": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_expired",
                        "message": "This API key expired on 2026-12-31T21:00:00.000Z. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_expired",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key can't be used for this request.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_missing": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "scope_missing",
                        "message": "This API key doesn't have the webhooks:manage scope this request needs.",
                        "doc_url": "https://docs.semalink.africa/errors#scope_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "ip_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "ip_not_allowed",
                        "message": "This API key can't be used from 196.201.214.10: it isn't on the key's list of allowed addresses.",
                        "doc_url": "https://docs.semalink.africa/errors#ip_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "browser_requests_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "browser_requests_not_allowed",
                        "message": "The SemaLink API is for servers: requests from a browser (with an Origin header) are refused.",
                        "doc_url": "https://docs.semalink.africa/errors#browser_requests_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "api_blocked": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "api_blocked",
                        "message": "SemaLink has paused API access for this account. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#api_blocked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "account_suspended": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "account_suspended",
                        "message": "This organisation is suspended, so its API keys can't be used. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#account_suspended",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No such webhook endpoint for this key.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "resource_not_found": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "resource_not_found",
                        "message": "There's no webhook endpoint whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b for this key.",
                        "param": "id",
                        "doc_url": "https://docs.semalink.africa/errors#resource_not_found",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait for Retry-After seconds.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "value": {
                      "error": {
                        "type": "rate_limit_error",
                        "code": "rate_limited",
                        "message": "Too many requests with this key. Retry after 1 second.",
                        "doc_url": "https://docs.semalink.africa/errors#rate_limited",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong at SemaLink.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "internal_error",
                        "message": "Something went wrong on SemaLink's side. Try again; if it keeps happening, contact support and quote the request id.",
                        "doc_url": "https://docs.semalink.africa/errors#internal_error",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request took more than 30 seconds and was stopped.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_timeout": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "request_timeout",
                        "message": "The request took too long and was stopped. Retry it with the same Idempotency-Key: it never runs twice.",
                        "doc_url": "https://docs.semalink.africa/errors#request_timeout",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Update a webhook endpoint",
        "description": "Its URL, events, description, or enabled (false stops deliveries and cancels what was waiting).\n\nNeeds the `webhooks:manage` scope.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-semalink-scope": "webhooks:manage",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The whe_... id.",
              "example": "whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWebhookRequest"
              },
              "example": {
                "events": [
                  "message.sent",
                  "message.delivered",
                  "message.failed"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The endpoint.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or wrong.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "parameter_missing": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "parameter_missing",
                        "message": "Missing required parameter: from.",
                        "param": "from",
                        "doc_url": "https://docs.semalink.africa/errors#parameter_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "parameter_invalid": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "parameter_invalid",
                        "message": "Invalid send_at: choose a time at least 5 minutes from now, or leave it out to send now.",
                        "param": "send_at",
                        "doc_url": "https://docs.semalink.africa/errors#parameter_invalid",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "parameter_unknown": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "parameter_unknown",
                        "message": "Unknown parameter: sender.",
                        "param": "sender",
                        "doc_url": "https://docs.semalink.africa/errors#parameter_unknown",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "invalid_json": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "invalid_json",
                        "message": "The body isn't valid JSON.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_json",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "idempotency_key_invalid": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "idempotency_key_invalid",
                        "message": "An Idempotency-Key is 1 to 255 characters.",
                        "doc_url": "https://docs.semalink.africa/errors#idempotency_key_invalid",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_api_key": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "invalid_api_key",
                        "message": "This API key isn't one we know. Check it was copied whole, or make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_api_key",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_revoked": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_revoked",
                        "message": "This API key was revoked. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_revoked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_expired": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_expired",
                        "message": "This API key expired on 2026-12-31T21:00:00.000Z. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_expired",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key can't be used for this request.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_missing": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "scope_missing",
                        "message": "This API key doesn't have the webhooks:manage scope this request needs.",
                        "doc_url": "https://docs.semalink.africa/errors#scope_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "ip_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "ip_not_allowed",
                        "message": "This API key can't be used from 196.201.214.10: it isn't on the key's list of allowed addresses.",
                        "doc_url": "https://docs.semalink.africa/errors#ip_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "browser_requests_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "browser_requests_not_allowed",
                        "message": "The SemaLink API is for servers: requests from a browser (with an Origin header) are refused.",
                        "doc_url": "https://docs.semalink.africa/errors#browser_requests_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "api_blocked": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "api_blocked",
                        "message": "SemaLink has paused API access for this account. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#api_blocked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "account_suspended": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "account_suspended",
                        "message": "This organisation is suspended, so its API keys can't be used. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#account_suspended",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No such webhook endpoint for this key.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "resource_not_found": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "resource_not_found",
                        "message": "There's no webhook endpoint whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b for this key.",
                        "param": "id",
                        "doc_url": "https://docs.semalink.africa/errors#resource_not_found",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MB.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_too_large": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "request_too_large",
                        "message": "The body is too large.",
                        "doc_url": "https://docs.semalink.africa/errors#request_too_large",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unsupported_media_type": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "unsupported_media_type",
                        "message": "Send the body as JSON, with Content-Type: application/json.",
                        "doc_url": "https://docs.semalink.africa/errors#unsupported_media_type",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "The URL can't be delivered to.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "url_not_https": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "url_not_https",
                        "message": "Webhooks must use https. Use a URL that starts with https://.",
                        "doc_url": "https://docs.semalink.africa/errors#url_not_https",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "url_private_address": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "url_private_address",
                        "message": "intranet.local points at a private network address, which SemaLink can't deliver to. Use a public address.",
                        "doc_url": "https://docs.semalink.africa/errors#url_private_address",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many webhook changes and tests for the organisation.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "value": {
                      "error": {
                        "type": "rate_limit_error",
                        "code": "rate_limited",
                        "message": "Too many webhook changes and tests for this organisation: 20 a minute. Retry after 3 seconds.",
                        "doc_url": "https://docs.semalink.africa/errors#rate_limited",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong at SemaLink.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "internal_error",
                        "message": "Something went wrong on SemaLink's side. Try again; if it keeps happening, contact support and quote the request id.",
                        "doc_url": "https://docs.semalink.africa/errors#internal_error",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request took more than 30 seconds and was stopped.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_timeout": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "request_timeout",
                        "message": "The request took too long and was stopped. Retry it with the same Idempotency-Key: it never runs twice.",
                        "doc_url": "https://docs.semalink.africa/errors#request_timeout",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete a webhook endpoint",
        "description": "It gets nothing more, and what was waiting for it goes.\n\nNeeds the `webhooks:manage` scope.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-semalink-scope": "webhooks:manage",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The whe_... id.",
              "example": "whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointDeleted"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_api_key": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "invalid_api_key",
                        "message": "This API key isn't one we know. Check it was copied whole, or make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_api_key",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_revoked": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_revoked",
                        "message": "This API key was revoked. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_revoked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_expired": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_expired",
                        "message": "This API key expired on 2026-12-31T21:00:00.000Z. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_expired",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key can't be used for this request.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_missing": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "scope_missing",
                        "message": "This API key doesn't have the webhooks:manage scope this request needs.",
                        "doc_url": "https://docs.semalink.africa/errors#scope_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "ip_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "ip_not_allowed",
                        "message": "This API key can't be used from 196.201.214.10: it isn't on the key's list of allowed addresses.",
                        "doc_url": "https://docs.semalink.africa/errors#ip_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "browser_requests_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "browser_requests_not_allowed",
                        "message": "The SemaLink API is for servers: requests from a browser (with an Origin header) are refused.",
                        "doc_url": "https://docs.semalink.africa/errors#browser_requests_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "api_blocked": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "api_blocked",
                        "message": "SemaLink has paused API access for this account. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#api_blocked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "account_suspended": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "account_suspended",
                        "message": "This organisation is suspended, so its API keys can't be used. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#account_suspended",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No such webhook endpoint for this key.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "resource_not_found": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "resource_not_found",
                        "message": "There's no webhook endpoint whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b for this key.",
                        "param": "id",
                        "doc_url": "https://docs.semalink.africa/errors#resource_not_found",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: wait for Retry-After seconds.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "value": {
                      "error": {
                        "type": "rate_limit_error",
                        "code": "rate_limited",
                        "message": "Too many requests with this key. Retry after 1 second.",
                        "doc_url": "https://docs.semalink.africa/errors#rate_limited",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong at SemaLink.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "internal_error",
                        "message": "Something went wrong on SemaLink's side. Try again; if it keeps happening, contact support and quote the request id.",
                        "doc_url": "https://docs.semalink.africa/errors#internal_error",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request took more than 30 seconds and was stopped.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_timeout": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "request_timeout",
                        "message": "The request took too long and was stopped. Retry it with the same Idempotency-Key: it never runs twice.",
                        "doc_url": "https://docs.semalink.africa/errors#request_timeout",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/webhooks/{id}/test": {
      "post": {
        "operationId": "testWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Send a test event",
        "description": "Posts one webhook.test event now, signed as every delivery is, and says how the endpoint answered. Never retried.\n\nNeeds the `webhooks:manage` scope.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-semalink-scope": "webhooks:manage",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The whe_... id.",
              "example": "whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Any unique string (a UUID): a retry with the same key and body within 24 hours gets the first answer, with Idempotent-Replayed: true.",
              "example": "6f1c1a52-6a0b-4d7e-9a43-3f1f9c2d8b10"
            },
            "required": false,
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "How the endpoint answered.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookTest"
                }
              }
            }
          },
          "400": {
            "description": "The request is malformed.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_json": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "invalid_json",
                        "message": "The body isn't valid JSON.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_json",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "idempotency_key_invalid": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "idempotency_key_invalid",
                        "message": "An Idempotency-Key is 1 to 255 characters.",
                        "doc_url": "https://docs.semalink.africa/errors#idempotency_key_invalid",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_api_key": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "invalid_api_key",
                        "message": "This API key isn't one we know. Check it was copied whole, or make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#invalid_api_key",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_revoked": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_revoked",
                        "message": "This API key was revoked. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_revoked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "key_expired": {
                    "value": {
                      "error": {
                        "type": "authentication_error",
                        "code": "key_expired",
                        "message": "This API key expired on 2026-12-31T21:00:00.000Z. Make a new one in Developer > API keys.",
                        "doc_url": "https://docs.semalink.africa/errors#key_expired",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key can't be used for this request.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_missing": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "scope_missing",
                        "message": "This API key doesn't have the webhooks:manage scope this request needs.",
                        "doc_url": "https://docs.semalink.africa/errors#scope_missing",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "ip_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "ip_not_allowed",
                        "message": "This API key can't be used from 196.201.214.10: it isn't on the key's list of allowed addresses.",
                        "doc_url": "https://docs.semalink.africa/errors#ip_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "browser_requests_not_allowed": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "browser_requests_not_allowed",
                        "message": "The SemaLink API is for servers: requests from a browser (with an Origin header) are refused.",
                        "doc_url": "https://docs.semalink.africa/errors#browser_requests_not_allowed",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "api_blocked": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "api_blocked",
                        "message": "SemaLink has paused API access for this account. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#api_blocked",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "account_suspended": {
                    "value": {
                      "error": {
                        "type": "permission_error",
                        "code": "account_suspended",
                        "message": "This organisation is suspended, so its API keys can't be used. Contact SemaLink support.",
                        "doc_url": "https://docs.semalink.africa/errors#account_suspended",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No such webhook endpoint for this key.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "resource_not_found": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "resource_not_found",
                        "message": "There's no webhook endpoint whe_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b for this key.",
                        "param": "id",
                        "doc_url": "https://docs.semalink.africa/errors#resource_not_found",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The Idempotency-Key was used with another request, or that request is still running.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "idempotency_key_reused": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was already used with a different request. Use a new key for a new request.",
                        "doc_url": "https://docs.semalink.africa/errors#idempotency_key_reused",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "idempotency_key_in_use": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "idempotency_key_in_use",
                        "message": "A request with this Idempotency-Key is still running. Retry when it has finished.",
                        "doc_url": "https://docs.semalink.africa/errors#idempotency_key_in_use",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  },
                  "idempotency_answer_unavailable": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "idempotency_answer_unavailable",
                        "message": "This request already ran (it answered 202), but its answer was too large to keep. Look up what it made instead of retrying.",
                        "doc_url": "https://docs.semalink.africa/errors#idempotency_answer_unavailable",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MB.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_too_large": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "request_too_large",
                        "message": "The body is too large.",
                        "doc_url": "https://docs.semalink.africa/errors#request_too_large",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unsupported_media_type": {
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "unsupported_media_type",
                        "message": "Send the body as JSON, with Content-Type: application/json.",
                        "doc_url": "https://docs.semalink.africa/errors#unsupported_media_type",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many webhook changes and tests for the organisation.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "value": {
                      "error": {
                        "type": "rate_limit_error",
                        "code": "rate_limited",
                        "message": "Too many webhook changes and tests for this organisation: 20 a minute. Retry after 3 seconds.",
                        "doc_url": "https://docs.semalink.africa/errors#rate_limited",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong at SemaLink.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "internal_error",
                        "message": "Something went wrong on SemaLink's side. Try again; if it keeps happening, contact support and quote the request id.",
                        "doc_url": "https://docs.semalink.africa/errors#internal_error",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request took more than 30 seconds and was stopped.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "request_timeout": {
                    "value": {
                      "error": {
                        "type": "api_error",
                        "code": "request_timeout",
                        "message": "The request took too long and was stopped. Retry it with the same Idempotency-Key: it never runs twice.",
                        "doc_url": "https://docs.semalink.africa/errors#request_timeout",
                        "request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "operationId": "getOpenApi",
        "tags": [
          "Meta"
        ],
        "security": [],
        "summary": "Get this document",
        "description": "The OpenAPI 3.1 description of the API. No key needed, and the only route a browser may call (any origin, without credentials).",
        "x-semalink-scope": "none",
        "responses": {
          "200": {
            "description": "The OpenAPI document.",
            "headers": {
              "Request-Id": {
                "description": "This request's id. Quote it to support.",
                "schema": {
                  "type": "string",
                  "example": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
                }
              },
              "RateLimit-Limit": {
                "description": "The rate limit bucket's size: the most requests at once.",
                "schema": {
                  "type": "integer",
                  "example": 40
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the bucket now.",
                "schema": {
                  "type": "integer",
                  "example": 39
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the bucket is full again.",
                "schema": {
                  "type": "integer",
                  "example": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {}
}
