Charter Boats API

Authentication

Learn how to authenticate with the Charter Boats API

API Key Authentication

The Charter Boats API uses API keys to authenticate requests. Include your API key in the X-API-Key header with every request.

curl https://charter.boats/api/boats \
  -H "X-API-Key: cb_live_abc123..."

Getting an API Key

Any registered user can generate an API key from the dashboard:

  1. Log in to charter.boats
  2. Go to Dashboard → Settings → API
  3. Click Generate API Key
  4. Copy and save your key (it is only shown once)

Your API key will look like: cb_live_ followed by 32 characters.

Regenerating Your Key

If your key is compromised, you can regenerate it from the same settings page. This will immediately invalidate your old key.

Security Best Practices

Never expose your API key in client-side code, public repositories, or anywhere it could be accessed by unauthorized parties.

Recommendations

DoDon't
Store API keys in environment variablesCommit API keys to version control
Use server-side code to make API callsInclude keys in client-side JavaScript
Rotate keys periodicallyShare keys across different applications
Use different keys for dev and production

Error Responses

401 Unauthorized

Returned when the API key is missing or invalid:

{
  "statusCode": 401,
  "message": "API key required. Include X-API-Key header."
}
{
  "statusCode": 401,
  "message": "Invalid API key"
}

On this page