Skip to main content
POST
/
api-keys
curl -X POST https://app.trypost.it/api/api-keys \
  -H "Authorization: Bearer tp_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "CI/CD Pipeline",
    "expires_at": "2025-12-31"
  }'
{
  "token": {
    "id": "a7b8c9d0-e1f2-3a4b-5c6d-7e8f9a0b1c2d",
    "name": "CI/CD Pipeline",
    "key_hint": "tp_xyz9876543210...",
    "status": "active",
    "last_used_at": null,
    "expires_at": "2025-12-31 00:00:00",
    "created_at": "2025-01-14 12:00:00"
  },
  "plain_token": "tp_xyz9876543210abcdef1234567890abcdef1234567890ab"
}

Request

name
string
required
The API key name. Maximum 255 characters.
expires_at
string
Optional expiration date. Must be a future date. Format: Y-m-d or Y-m-d H:i:s.

Response

Returns the created API key with the plain text token. The token is only shown once and cannot be retrieved later.
Copy the plain_token immediately after creation. TryPost stores a hash of your API key, not the key itself. If you lose it, you’ll need to create a new one.
curl -X POST https://app.trypost.it/api/api-keys \
  -H "Authorization: Bearer tp_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "CI/CD Pipeline",
    "expires_at": "2025-12-31"
  }'
{
  "token": {
    "id": "a7b8c9d0-e1f2-3a4b-5c6d-7e8f9a0b1c2d",
    "name": "CI/CD Pipeline",
    "key_hint": "tp_xyz9876543210...",
    "status": "active",
    "last_used_at": null,
    "expires_at": "2025-12-31 00:00:00",
    "created_at": "2025-01-14 12:00:00"
  },
  "plain_token": "tp_xyz9876543210abcdef1234567890abcdef1234567890ab"
}