API Keys

Create and manage API keys for authenticating with the Txtly API.

Create API Key

POST
/v1/api-keys

Create a new API key for your account. The full key is returned only at creation time.

Important

Save your API key immediately after creation. You won't be able to view the full key again. If you lose it, you'll need to delete and create a new one.

Parameters

ParameterTypeDescription
namerequiredstringDescriptive name for the key
permissionstringPermission level: full_access or sending_access
domain_idstringRestrict key to a specific domain (optional)

Example Request

curl -X POST https://api.txtly.io/v1/api-keys \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production Server",
    "permission": "sending_access"
  }'

Example Response

{
  "id": "key_abc123xyz789",
  "name": "Production Server",
  "key": "tx_live_abc123xyz789def456ghi789jkl012mno345",
  "key_prefix": "tx_live_abc123...",
  "permission": "sending_access",
  "domain_id": null,
  "created_at": "2026-03-21T10:30:00Z"
}

List API Keys

GET
/v1/api-keys

List all API keys for your account. Full keys are not shown for security reasons.

Example Response

{
  "keys": [
    {
      "id": "key_abc123xyz789",
      "name": "Production Server",
      "key_prefix": "tx_live_abc123...",
      "permission": "sending_access",
      "domain_id": null,
      "created_at": "2026-03-21T10:30:00Z",
      "last_used_at": "2026-03-21T10:45:00Z"
    },
    {
      "id": "key_def456uvw789",
      "name": "Development",
      "key_prefix": "tx_test_def456...",
      "permission": "full_access",
      "domain_id": "domain_abc123xyz789",
      "created_at": "2026-03-20T15:00:00Z",
      "last_used_at": "2026-03-21T09:30:00Z"
    }
  ]
}

Delete API Key

DELETE
/v1/api-keys/{id}

Delete an API key. This action cannot be undone.

Path Parameters

ParameterTypeDescription
idrequiredstringAPI key ID

Example Request

curl -X DELETE https://api.txtly.io/v1/api-keys/key_abc123xyz789 \
  -H "Authorization: Bearer YOUR_API_KEY"

Permissions

API keys support two levels of permissions to help you follow the principle of least privilege.

Permission Levels

  • sending_accessCan only send emails, send broadcasts, and retrieve email/broadcast information. Cannot create domains, manage contacts, or access account settings.
  • full_accessFull access to all API endpoints including domains, contacts, segments, templates, webhooks, and workflows.

Using API Keys

Include your API key in the Authorization header of your requests using Bearer authentication.

curl https://api.txtly.io/v1/emails \
  -H "Authorization: Bearer tx_live_your_api_key_here"