API keys
Every request authenticates with a bearer token in theAuthorization header:
vein_sk_{live|test}_{32 chars}:
vein_sk_live_…accesses your production data.vein_sk_test_…is intended for sandbox/non-production use; like all keys, it only sees the company it is bound to.
Scopes
Each key carries a set of scopes. A request to an endpoint whose scope your key lacks returns403 permission_error with code insufficient_scope.
Rate limits
The API is rate limited per key (not per IP). Every response carries:
When you exceed the limit you get
429 rate_limit_error (code
rate_limit_exceeded) with a Retry-After header giving the seconds to wait.
Back off until then rather than retrying immediately.
Errors
All errors share one shape. Branch onerror.code, not error.message:
request_id (also returned as the Vein-Request-Id header) in support
tickets so we can find your request in our logs.
Data access & consent
Financial endpoints (currentlyGET /v1/companies/:id/metrics and
GET /v1/companies/:id/metrics/:key) require two things: an API key with the
metrics:read scope and an approved data-access grant from the company. The
companies:read scope (used by GET /v1/companies) is unaffected and stays
open; portfolio membership alone is sufficient to list companies.
Each company object returned by GET /v1/companies carries an access field
with one of four values that tells you the state of your grant for that company:
none (no request exists), pending (request submitted, awaiting the company’s
approval), approved (access granted), or revoked (a previously approved
grant was revoked by the company).
Requesting access
SubmitPOST /v1/access-requests with the company_id and the scopes you
need. The company receives a notification and must approve the request in their
Vein dashboard before the grant activates. If you submit an identical request
(same company_id and scopes) while an existing request is pending or
approved, the endpoint is idempotent and returns the existing record with HTTP
200 rather than creating a duplicate.
Polling for approval
CallGET /v1/access-requests (optionally with ?status=pending) to list your
outstanding requests and check their status. When status changes to approved
you may call the financial endpoints for that company.
Error codes on 403
When a financial endpoint returns 403, branch onerror.code to determine next
steps:

