Skip to main content

API Keys

API keys authenticate your AI application with the Vexrail API. Each key pair consists of a publishable key and a secret key.

Key Types

Key TypePrefixUsage
Publishable keypk_live_Identifies your project. Sent as the x-publishable-key header.
Secret keysk_live_Authenticates API requests. Sent as the x-secret-key header. Must be kept confidential.

Both keys are required for API calls. They are always generated as a pair and are linked together.

Prerequisites

Before you can generate API keys, you must:

  1. Have an activated publisher account.
  2. Have a project with a verified domain.

Generating a Key Pair

  1. Navigate to your project detail page.
  2. Click Manage API Keys or go to the Keys section.
  3. Click Generate API Key.
  4. Enter a name for the key pair (e.g., "Production", "Staging").
  5. The key pair is generated and displayed.
caution

The secret key is shown only once at the time of generation. Copy it immediately and store it securely. You will not be able to view the full secret key again. If you lose it, you will need to generate a new key pair.

Key Pair List

The API Keys page lists all your key pairs with:

  • Pair ID -- A unique identifier for the key pair.
  • Name -- The name you assigned when generating.
  • Publishable key -- The full publishable key (safe to expose in client-side code).
  • Secret key prefix -- Only the prefix of the secret key is shown for identification.
  • Status -- Whether the key pair is active.
  • Created -- When the key pair was generated.
  • Last used -- The last time the key pair was used to make an API call.

Security Best Practices

  • Never expose your secret key in client-side code, public repositories, or logs.
  • Use environment variables to store your secret key in your application.
  • Rotate keys periodically by generating a new pair and updating your application.
  • Use separate key pairs for different environments (production, staging, development).

Using Keys in API Calls

Include both keys as HTTP headers in every API request:

curl -X POST https://api.vexrail.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "x-publishable-key: pk_live_your_publishable_key" \
-H "x-secret-key: sk_live_your_secret_key" \
-d '{ ... }'

For SDK-specific integration guides, see the Integration section.