Documentation menu

API reference

Logs

Every authenticated request to the API is logged: who called what, when, and with which result. Use the log to debug integrations and to audit key usage.

Both endpoints need a full-access key whose creator holds the API controls privilege in the console. They can also return the common errors listed in the overview.

Libraries and CLI
Endpoint Node.js Python CLI
GET /logslogs.listlogs.listtsmart logs list
GET /logs/{id}logs.getlogs.gettsmart logs get

What is logged

One entry per request made with a valid key of your company, including requests that were then refused (for example for a missing permission or the rate limit). Requests refused before a key is accepted (a missing or invalid key, tsmartSend turned off, a caller address that is not allowed) and requests to unknown paths or with an unsupported method are not logged. Only the method, path, status, error name and user agent are kept, never request or response bodies, and entries are deleted after 30 days. An entry is written right after the response, so it can appear a moment later.

GET /logs

Lists the requests of the last 30 days, newest first.

Permission: full access; the key's creator needs the API controls privilege.

Query

Name Type Description
limit integer 1 to 100, default 20.
after string A log id: return older entries.
before string A log id: return newer entries. Use either after or before.

Request

cURL
curl "https://send.tsmart.ai/logs?limit=2" \
  -H "Authorization: Bearer $TSMART_API_KEY"

Response

200 OK
{
  "object": "list",
  "has_more": true,
  "data": [
    {
      "id": "9a1b2c3d-4e5f-4a6b-8c7d-0e1f2a3b4c5d",
      "created_at": "2026-10-12 09:15:02.638091+00",
      "endpoint": "/emails",
      "method": "POST",
      "response_status": 200,
      "user_agent": "tsmart-node/1.1.1"
    },
    {
      "id": "1f2e3d4c-5b6a-4978-8695-a4b3c2d1e0f9",
      "created_at": "2026-10-12 09:14:58.190274+00",
      "endpoint": "/emails",
      "method": "POST",
      "response_status": 403,
      "user_agent": "tsmart-cli/1.1.0"
    }
  ]
}
Name Type Description
id string Log entry id (UUID).
created_at string When the request was answered.
endpoint string The path that was called, without the query string.
method string The HTTP method.
response_status integer The HTTP status of the response.
user_agent string | null The caller's User-Agent header (up to 300 characters); null when none was sent.

Errors

StatusNameWhen
401restricted_api_keyA sending-access key.
403invalid_permissionThe key's creator lacks the API controls privilege.
422validation_errorlimit out of range, both after and before, or an invalid cursor.

GET /logs/{id}

Returns one log entry, with the error name of a failed request.

Permission: full access; the key's creator needs the API controls privilege.

Path

Name Type Description
id required string The log entry id.

Request

cURL
curl https://send.tsmart.ai/logs/1f2e3d4c-5b6a-4978-8695-a4b3c2d1e0f9 \
  -H "Authorization: Bearer $TSMART_API_KEY"

Response

200 OK
{
  "object": "log",
  "id": "1f2e3d4c-5b6a-4978-8695-a4b3c2d1e0f9",
  "created_at": "2026-10-12 09:14:58.190274+00",
  "endpoint": "/emails",
  "method": "POST",
  "response_status": 403,
  "error": "domain_not_verified",
  "user_agent": "tsmart-cli/1.1.0"
}

The fields are those of the list plus object (always "log") and error: the name of the error response for a status of 400 or more, otherwise null.

Errors

StatusNameWhen
401restricted_api_keyA sending-access key.
403invalid_permissionThe key's creator lacks the API controls privilege.
404not_foundNo log entry with this id in your company ("Log not found").