Skip to content
Docs

Creating an OpenAI API key

This guide is part of the Publicus connection catalog. Once you have the credentials, connect the service and Publicus stores them for you.

Distilled from OpenAI’s own documentation: API reference overview, Assign API key permissions, Best practices for API key safety, and Managing your work in the API platform with projects. Retrieved 2026-07-03.

OpenAI’s REST API authenticates with a secret API key (there is no OAuth flow for calling the API). A key belongs to a project; project-owned service-account keys are the recommended choice for automated and server-side use because they are not tied to an individual user.

  1. Sign in at platform.openai.com and make sure a payment method is on file (the API is billed per usage).
  2. Open the API keys page: platform.openai.com/settings/organization/api-keys.
  3. Click Create new secret key.
  4. Under Owned by, choose Service account (recommended for integrations) or You. Service-account keys live in a project and are not bound to a person.
  5. Select the Project the key should belong to, and give the key a descriptive Name (e.g. publicus-flows-prod).
  6. Set the key’s permissions: All (full access, the default), Restricted (choose None / Read / Write per endpoint), or Read Only. Grant the least privilege the flows need.
  7. Click Create secret key, then Copy the value. The full key (prefix sk-) is shown only once — store it in your secrets vault immediately, then close the dialog.

Operational notes:

  • Requests carry the key as Authorization: Bearer <API key> over HTTPS (API reference overview).
  • If the key’s owner belongs to more than one organization, set the connection’s Organization ID (sent as OpenAI-Organization) to attribute usage correctly. A user-owned key may also set Project ID (sent as OpenAI-Project); project-scoped keys already imply their project (API reference overview).
  • The key does not carry an expiry — rotate or revoke it from the API keys page. Never embed it in client-side code or source control (Best practices for API key safety).
  • Verify a key with GET https://api.openai.com/v1/models, which lists the models available to the key and takes no parameters (List models).

Open Connections under Credentials, choose OpenAI, and pick OpenAI API key. Publicus asks for exactly the fields listed above and keeps them in your workspace’s secret storage.

See also: OpenAI in the catalog.

This guide is maintained by Publicus and published under CC BY 4.0.