Authentication
Every request carries an API key in the Authorization header, as a Bearer token. Keys are issued to admitted organisations.
Header
Authorization: Bearer YOUR_API_KEY
With the OpenAI SDKs, pass the key as api_key (Python) or apiKey (Node.js).
Good practice
- Store the key in an environment variable or a secrets manager, never in a repository.
- Use one key per application or environment, so that one can be revoked without stopping the others.
- Call the API from your servers, not from a browser or a mobile app.
Rotation and leaks
To rotate a key, or if a key may have been exposed, use the contact form (topic: API key rotation or leak). We revoke the old key and issue a new one. Under the acceptable use policy, a suspected leak must be reported without delay.
Errors
A missing or invalid key returns 401. A valid key without permission for the requested model
returns 403. See errors.
Last updated: 2 December 2026