Getting started
View as Markdown

Authentication

Create and use API keys, understand the organization and scopes a key covers, and handle authentication errors.

Last updated

Every request to the Victoria AI API is authenticated with an API key, sent as a Bearer token. A key belongs to one organization, and every request made with it reads and writes that organization's data.

Create a key

In the Victoria AI app, open Settings → API Keys and generate a key. Organization owners and admins can manage keys.

  • Keys start with vk_.
  • The full key is shown once, when you generate it. Victoria AI stores only a hash of the key, so it can't be shown again. Copy it into a secret manager or your deployment's environment variables straight away.
  • Give each integration its own key, so you can revoke one without breaking the others.

Send the key

Put the key in the Authorization header of every request, after the word Bearer and a single space:

curl https://api.versionseven.ai/v1/auth/verify \
  -H "Authorization: Bearer $VICTORIA_API_KEY"

GET /v1/auth/verify needs no scope and returns the organization the key belongs to, which makes it a quick way to check a key.

Keep keys on your server. Don't put them in browser code or mobile apps, where anyone can read them.

Organizations

A key only ever sees its own organization's data. An ID that belongs to another organization is treated as if it doesn't exist:

  • In the path, it answers a not-found error, such as 404 LEAD_NOT_FOUND.
  • In a request body, such as the stage_id of a deal, it answers 400, such as 400 INVALID_STAGE.

Neither response confirms that the ID exists somewhere else.

Scopes

Each endpoint requires a scope, made of a resource family and an access level.

FamilyCovers
leadsLeads and their campaign enrolments
campaignsCampaigns, sequences, analytics, queues, webhooks and reference data
crmPipelines and deals
accountsConnected sender accounts

The level is read or write, and write includes read: a key with leads:write can also call endpoints that need leads:read. A key without the scope an endpoint needs answers 403 INSUFFICIENT_SCOPE.

Keys generated in the Victoria AI app today have every scope, so they can call every endpoint.

EndpointRequired scope
GET/v1/auth/verifyNone
GET/v1/accountsaccounts:read
POST/v1/accounts/connect-linkaccounts:write
POST/v1/leadsleads:write
GET/v1/leadsleads:read
GET/v1/leads/{lead_id}leads:read
PATCH/v1/leads/{lead_id}leads:write
DEL/v1/leads/{lead_id}leads:write
GET/v1/campaignscampaigns:read
POST/v1/campaignscampaigns:write
GET/v1/campaigns/{campaign_id}campaigns:read
PATCH/v1/campaigns/{campaign_id}campaigns:write
PUT/v1/campaigns/{campaign_id}/sequencecampaigns:write
PATCH/v1/campaigns/{campaign_id}/sequence/steps/{step_id}campaigns:write
GET/v1/campaigns/{campaign_id}/analysiscampaigns:read
GET/v1/campaigns/{campaign_id}/queuecampaigns:read
GET/v1/campaigns/{campaign_id}/preflightcampaigns:read
PUT/v1/campaigns/{campaign_id}/senderscampaigns:write
GET/v1/campaigns/{campaign_id}/ai-fieldscampaigns:read
POST/v1/campaigns/{campaign_id}/ai-fieldscampaigns:write
PATCH/v1/campaigns/{campaign_id}/ai-fields/{field_id}campaigns:write
GET/v1/campaigns/{campaign_id}/respondercampaigns:read
PATCH/v1/campaigns/{campaign_id}/respondercampaigns:write
POST/v1/campaigns/{campaign_id}/previewcampaigns:read
GET/v1/campaigns/{campaign_id}/bookingscampaigns:read
POST/v1/campaigns/{campaign_id}/ab-testingcampaigns:write
POST/v1/campaigns/{campaign_id}/ab-testing/promotecampaigns:write
GET/v1/campaigns/{campaign_id}/daily-statscampaigns:read
GET/v1/campaigns/{campaign_id}/step-funnelcampaigns:read
GET/v1/campaigns/{campaign_id}/senders/breakdowncampaigns:read
GET/v1/campaigns/{campaign_id}/personalization-qualitycampaigns:read
GET/v1/campaigns/{campaign_id}/ab-cohortscampaigns:read
GET/v1/campaigns/{campaign_id}/webhookscampaigns:read
POST/v1/campaigns/{campaign_id}/webhookscampaigns:write
DEL/v1/campaigns/{campaign_id}/webhooks/{webhook_id}campaigns:write
POST/v1/campaigns/{campaign_id}/webhooks/{webhook_id}/secretcampaigns:write
GET/v1/crm/pipelinescrm:read
GET/v1/crm/pipelines/{pipeline_id}crm:read
PATCH/v1/crm/pipelines/{pipeline_id}crm:write
GET/v1/crm/dealscrm:read
POST/v1/crm/dealscrm:write
GET/v1/crm/deals/{deal_id}crm:read
PATCH/v1/crm/deals/{deal_id}crm:write
GET/v1/sequence-templatescampaigns:read
GET/v1/webhooks/examplescampaigns:read

Rotate a key

  1. Generate a new key in Settings → API Keys.
  2. Deploy your integration with the new key.
  3. Revoke the old key. Requests made with a revoked key answer 401 UNAUTHORIZED.

If a key is ever exposed, revoke it straight away.

Authentication errors

StatusCodeMeaning
401UNAUTHORIZEDThe Authorization header is missing or malformed, or the key is unknown or revoked.
401API_KEY_EXPIREDThe key is past its expiry date.
403INSUFFICIENT_SCOPEThe key doesn't have the scope the endpoint requires.
403ORGANIZATION_DEACTIVATEDThe organization that owns the key has been deactivated.
503AUTH_UNAVAILABLEThe key couldn't be checked. Retry after a short wait.

A header counts as malformed unless it's exactly Bearer, one space, and the key.