Peachdesk has three credential families. They are not interchangeable, and sending the wrong one is the most common source of a 401.
If you are writing code against Peachdesk, you almost certainly want an API key in the X-API-Key header. The other two are for the browser session and for the managed model-proxy tier respectively.

API key authentication

API keys are the credential for programmatic requests. Pass your key in the X-API-Key request header.
Keys are prefixed bibha_. A key is scoped to an organization: every resource created or read with it belongs to that organization, and the key carries the permissions of the member who created it.

Create an API key

Create keys in the dashboard under Settings тЖТ API Keys, or programmatically with POST /user/api-keys. The full key is returned only once, at creation тАФ store it immediately in a secrets manager or environment variable.
For self-hosted deployments using local auth, sign up and log in via the dashboard first, then create an API key there before making API calls.

Manage API keys

Archiving a key immediately revokes it. All subsequent requests using that key return 401.

Session-only routes

Some routes require an interactive user session and refuse an API key outright. An API key is a long-lived organization credential that any member of the organization can mint, and it carries no membership re-check тАФ so the operator surfaces that read cost data, move money, or hand out permissions are not reachable with one. These prefixes are session-only: Sending X-API-Key to any of them returns 401 before the key is even looked up:
Authenticate these routes with the user session token instead:
Nothing in this public reference тАФ agents, calls, campaigns, telephony configurations, analytics, BRAHMA, VAANI, LIPI, or the Voice Engine тАФ is session-only. An API key reaches all of it.

MPS service keys are a different credential

The managed model-proxy routes under /api/v1/mps/* do not accept an API key. They take a service key, issued by a Peachdesk super-admin, sent as a bearer token:
A malformed or missing bearer on an MPS route returns:
Service keys also enforce a per-key concurrency limit; exceeding it returns 429.

Header precedence

If a request carries both X-API-Key and Authorization, the API key wins тАФ except on the session-only routes above, where the presence of X-API-Key is itself the rejection. Send exactly one credential.

Error responses

Authentication succeeding does not mean the request is free. Requests that run a model draw on your organizationтАЩs credit balance and are refused with 402 once it is exhausted тАФ see Errors.