Documentation
Browse documentation

API keys

Create, inspect and revoke the secret credentials used to access an account.
View as Markdown

API keys grant server-side access to every API resource owned by their account. Keep them out of browser code, mobile applications, source control and public documentation.

The secret is returned only when a key is created. It is null when the same key is retrieved or listed later. Store a newly created secret before discarding the response; FiscalRail cannot reveal it again.

An API key can create and revoke other keys, including itself. Use the dashboard to create the first key or recover access if all keys are revoked.

The API Key object

Properties
id string
Opaque identifier for an API key.
object string
String identifying this as an API Key object. Always api_key.
live boolean
True when the object belongs to the live environment; false for test data.
account string
Account this key authenticates as.
name string
Human-readable label describing where the key is used.
suffix string
Last four characters used to identify the key safely.
secret string or null
Full secret returned only during creation; null on every later response.
created_at string
When the API key was created.
API Key object
{
  "id": "acct_key_14Vxtqg6oXpAY5WdWoq4wW",
  "object": "api_key",
  "live": true,
  "account": "acct_14Vxtqg2nwvPR75TpsGH8N",
  "name": "Production server",
  "suffix": "4wW7",
  "secret": "ak_11111111111111111111111111111111111111111111",
  "created_at": "2026-08-10T09:30:00Z"
}

Create an API key

POST/v1/api-keys

Creates an API key. The secret is returned by this operation only and cannot be retrieved later.

Request body
name string required
Human-readable label describing where the key will be used.
Example request
curl --request POST \
  'https://api.fiscalrail.com/v1/api-keys' \
  --header "Authorization: Bearer ak_test_..."
Example response — 201
{
  "id": "acct_key_14Vxtqg6oXpAY5WdWoq4wW",
  "object": "api_key",
  "live": true,
  "account": "acct_14Vxtqg2nwvPR75TpsGH8N",
  "name": "Production server",
  "suffix": "4wW7",
  "secret": "ak_11111111111111111111111111111111111111111111",
  "created_at": "2026-08-10T09:30:00Z"
}

Retrieve an API key

GET/v1/api-keys/{id}

Returns API key metadata. The secret is always null after creation.

Path parameters
id string required
The opaque ID of the API key.
Responses

200 An API Key object. JSON

Example request
curl --request GET \
  'https://api.fiscalrail.com/v1/api-keys/acct_key_14Vxtqg6oXpAY5WdWoq4wW' \
  --header "Authorization: Bearer ak_test_..."
Example response — 200
{
  "id": "acct_key_14Vxtqg6oXpAY5WdWoq4wW",
  "object": "api_key",
  "live": true,
  "account": "acct_14Vxtqg2nwvPR75TpsGH8N",
  "name": "Production server",
  "suffix": "4wW7",
  "secret": "ak_11111111111111111111111111111111111111111111",
  "created_at": "2026-08-10T09:30:00Z"
}

Revoke an API key

DELETE/v1/api-keys/{id}

Permanently revokes an API key. Revoking the key used for this request takes effect immediately after the response.

Path parameters
id string required
The opaque ID of the API key.
Responses

204 The API key was revoked. The response has no body.

Example request
curl --request DELETE \
  'https://api.fiscalrail.com/v1/api-keys/acct_key_14Vxtqg6oXpAY5WdWoq4wW' \
  --header "Authorization: Bearer ak_test_..."

List API keys

GET/v1/api-keys

Returns API keys in reverse chronological ID order. Stored keys never expose their secret.

Query parameters
limit integer
Maximum number of resources to return. Defaults to 25.
starting_after string
Return API keys older than this API key ID. Cannot be combined with ending_before.
ending_before string
Return API keys newer than this API key ID. Cannot be combined with starting_after.
Responses

200 A list of API Key objects. JSON

Example request
curl --request GET \
  'https://api.fiscalrail.com/v1/api-keys?limit=25' \
  --header "Authorization: Bearer ak_test_..."
Example response — 200
{
  "object": "list",
  "has_more": null,
  "data": [
    {
      "id": "acct_key_14Vxtqg6oXpAY5WdWoq4wW",
      "object": "api_key",
      "live": true,
      "account": "acct_14Vxtqg2nwvPR75TpsGH8N",
      "name": "Production server",
      "suffix": "4wW7",
      "secret": "ak_11111111111111111111111111111111111111111111",
      "created_at": "2026-08-10T09:30:00Z"
    }
  ]
}