API Authentication

Authenticate with the OpsKitty REST API using Bearer tokens.

Plan requirement: API read access requires the Launch plan. API write access (create, update, delete) requires the Growth plan or above.

Getting a token

Authenticate by sending your credentials to the login endpoint. The response includes a JWT token you use in all subsequent requests.

curl -X POST https://api.opskitty.com/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"you@example.com","password":"your-password"}'

The response contains your token:

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "user": {
    "id": "usr_abc123",
    "email": "you@example.com"
  }
}

Using the token

Include the token in the Authorization header of every API request:

curl https://api.opskitty.com/v1/websites \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "X-Organization: my-org-slug"

Organization header

If your account belongs to multiple organizations, include the X-Organization header with your organization's slug to scope requests to the correct workspace. The slug is visible in your organization URL and settings.

Token expiry

Tokens have a limited lifetime. When a request returns 401 Unauthorized, re-authenticate to obtain a fresh token. For long-running scripts, implement token refresh logic by catching 401 responses and re-logging in.