Skip to content

Getting an API Key

An API key (api_...) lets your backend call Imbrace without user sessions. For when to use an API key versus an access token, see Authentication.


Get API Key from UI

Step 1 — Log in to the Imbrace Portal, then navigate to GovernCore → Generate External Token.

Imbrace Portal — sidebar showing GovernCore menu with Generate External Token option

Step 2 — Click Generate Token to issue a new API key.

GovernCore Generate External Token page — Generate Token button highlighted

Step 3 — Copy the generated key. It starts with api_ and is only shown once.

Generated API key displayed in full — copy icon next to the api_... value

Generate via SDK (programmatic)

Use this when you need to generate a key from code, for example during automated provisioning. You must be authenticated with an access token first (via OTP or password).

// Requires client initialized with an access token
const res = await client.auth.getThirdPartyToken(30) // expires in 30 days
const apiKey = res.apiKey.apiKey // "api_..."

The response shape (full fields below — internal fields omitted for brevity):

{
"apiKey": {
"_id": "...",
"apiKey": "api_...",
"organization_id": "...",
"user_id": "...",
"is_active": true,
"expired_at": "2025-08-01T00:00:00.000Z",
"created_at": "2025-07-01T00:00:00.000Z",
"updated_at": "2025-07-01T00:00:00.000Z",
"is_temp": false
},
"expires_in": 2592000
}

Using the key

Pass the key to the client constructor:

import { ImbraceClient } from "@imbrace/sdk";
const client = new ImbraceClient({
apiKey: process.env.IMBRACE_API_KEY!,
organizationId: process.env.IMBRACE_ORGANIZATION_ID,
env: "stable",
});