Senlo

API v1 overview

The management API for coding agents and scripts - keys, errors, test sends, idempotency, pages.

API v1 manages one project's templates, triggers and automations under /api/v1/. It is what the Senlo MCP server and coding agents use; any script can call it too. Sending stays on /api/triggered and /api/events.

The full reference is generated from the code: /api/v1/openapi.json.

Building an agent or a script that writes content? Start with GET /api/v1/guide (public): the rules of the design document and the automation export in prose, their JSON Schemas, every block type with a valid starting value, every automation step type, and examples that pass the API's checks. It is the same text Senlo's own AI uses.

Keys

Every request needs an API key with the manage permission (see Authentication):

Authorization: Bearer snl_your_api_key
Senlo-Client: my-script/1.0

Senlo-Client is optional: a label for your client that shows in the audit log and in template history. A key acts on its own project only. GET /api/v1/me shows which one, and is the quickest way to check a connection.

Responses

Success is { "data": ... }. A failure is:

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "design.rows[0].columns[0].blocks[1].props.href: Invalid url",
    "hint": "Fix the fields listed in issues and send the request again.",
    "issues": [
      { "path": "design.rows[0].columns[0].blocks[1].props.href", "code": "invalid_string", "message": "Invalid url" }
    ],
    "requestId": "req_7f3c..."
  }
}
  • hint says what to do next; it is written so a coding agent can fix the request on its own.
  • issues lists every invalid field with its full path (at most 20; issueCount counts them all).
  • requestId is also in the X-Request-Id header of every response. Quote it when asking for support.
StatuscodeWhen
400VALIDATION_ERRORThe body or a parameter is invalid.
400UNKNOWN_FIELDThe body has a field the operation does not take (often a typo).
401UNAUTHORIZEDNo key, or a wrong one.
402QUOTA_EXCEEDEDCloud: a plan limit is reached.
403PERMISSION_REQUIREDThe key has no manage permission.
403RECIPIENT_NOT_ALLOWEDA test send to an address outside the organization (below).
404NOT_FOUNDNo such record in the key's project.
409IDEMPOTENCY_KEY_REUSED, IDEMPOTENCY_IN_PROGRESSSee Idempotency below.
409NOT_PUBLISHABLEAn automation cannot run as it is; details.reasons lists why.
429RATE_LIMITEDMore than 300 requests a minute for this key; wait Retry-After seconds.
502PROVIDER_ERRORThe email provider refused a test send; its reason is in the message.
500INTERNAL_ERRORSomething failed on Senlo's side; retry with backoff.

Checking without saving

Creating and changing operations take ?dryRun=true: the request is checked exactly as it would be, nothing is stored, and a valid one answers { "data": { "valid": true, "warnings": [] } }.

Test sends

Only to your organization

Test emails through the API go only to members of the project's organization. On a self-hosted instance that is the project owner's address. Any other address is refused with 403 RECIPIENT_NOT_ALLOWED, and details.allowed lists the addresses that work. An agent therefore cannot mail your customers or strangers. Test sends from the editor are not limited.

A test is a real send through the project's provider: it counts toward the plan like any email.

Idempotency

Creating operations take an Idempotency-Key header (any unique string up to 255 characters, such as a UUID):

  • the same key with the same body within 24 hours answers with the first response, with Idempotent-Replayed: true, and creates nothing twice;
  • the same key with another body is 409 IDEMPOTENCY_KEY_REUSED;
  • while the first request is still running, a retry gets 409 IDEMPOTENCY_IN_PROGRESS with Retry-After: 1;
  • only successful answers are kept: after an error, fix the request and send it again with the same key.

Pages

Lists answer { "data": { "items": [...], "nextCursor": "..." } }, newest first. Pass ?cursor=<nextCursor> for the next page and ?limit= (1 to 100, default 50) for its size. nextCursor is null on the last page.

Edit this page on GitHub