API reference

API keys

An API key is a secret key of the X account, as on the app's API page. You can have 20 active keys per account. Read Authentication for how to send one.

A key's secret shows once, in the answer that makes or rolls it, and no call returns it again. Only a request made with an API key gets one. An AI app connected through OAuth cannot make or roll keys, Gemlead's in-app chat never sees a secret, and a key never gets more access than the key that makes it.

The owner and the team members who edit the settings manage the keys. A member rolls only the keys they made.

The API key object

A secret key of the X account, as the app's API page lists it. An X account has 20 active keys at most. The object never holds the secret, which only the answers of create and roll carry, once.

Attributes

  • idstring
    Unique identifier for the key.
  • objectstring
    Always api_key.
  • namestring
    The key's name, like the tool that uses it, up to 60 characters.
  • prefixstring
    The secret's first 12 characters, like gl_live_3Fk9, to tell keys apart.
  • scopesarray of strings
    What the key may do, read, or read and write.
    readwrite
  • created_atstring
    When the key was made, ISO 8601.
  • last_used_atstring or null
    When the key last made a request, ISO 8601. null until it does.
  • currentboolean
    true for the key making this request.
  • secretstring
    The whole key, gl_live_ and 24 letters and digits. Only in the answers of create and roll, once. No call returns it again, and Gemlead's in-app chat never sees it.
API key object
{
  "id": "kY7mQ2pLxW",
  "object": "api_key",
  "name": "HubSpot sync",
  "prefix": "gl_live_3Fk9",
  "scopes": ["read"],
  "created_at": "2026-09-14T09:21:05.300Z",
  "last_used_at": "2026-11-06T07:45:12.904Z",
  "current": false
}

List API keys

GET/v1/api_keysread scopeMCPlist_api_keys

Returns the X account's active API keys, as the API page lists them, without their secrets.

Returns

A list of API key objects, all in one page.

GET/v1/api_keys
curl https://gemlead.ai/api/v1/api_keys \
  -H "Authorization: Bearer $GEMLEAD_API_KEY"
Response200
{
  "object": "list",
  "data": [
    {
      "id": "kY7mQ2pLxW",
      "object": "api_key",
      "name": "HubSpot sync",
      "prefix": "gl_live_3Fk9",
      "scopes": ["read"],
      "created_at": "2026-09-14T09:21:05.300Z",
      "last_used_at": "2026-11-06T07:45:12.904Z",
      "current": false
    },
    {
      "id": "Wq2xT9vLmC",
      "object": "api_key",
      "name": "Claude Code",
      "prefix": "gl_live_Hn5r",
      "scopes": ["read", "write"],
      "created_at": "2026-09-14T09:21:05.300Z",
      "last_used_at": "2026-11-06T07:45:12.904Z",
      "current": true
    }
  ],
  "has_more": false,
  "next_cursor": null
}

Create an API key

POST/v1/api_keyswrite scopeMCPmanage_api_keys

Makes an API key for the X account. Its secret is in this answer only, so store it now. An Idempotency-Key is ignored here, so the secret is never kept for a replay.

Body parameters

  • namestring
    The key's name, like the tool that uses it, up to 60 characters. Defaults to API key.
  • scopesarray of strings
    read, the default, or read and write. Asking write gives both. Never more than the calling key has.
    readwrite

Returns

The new API key object with its secret, shown this once, and a message.

Errors

  • A parameter has a value the API does not accept. param names it.
  • The body has a field this endpoint does not take.
  • The X account already has 20 active keys. Revoke one first.
  • The call came from an AI app connected through OAuth, which cannot make keys since a key would outlive its access, or from a team member's key whose role can only view the settings.
POST/v1/api_keys
curl -X POST https://gemlead.ai/api/v1/api_keys \
  -H "Authorization: Bearer $GEMLEAD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Zapier",
    "scopes": ["read", "write"]
  }'
Response200
{
  "id": "Pz4vN8kRtB",
  "object": "api_key",
  "name": "Zapier",
  "prefix": "gl_live_8Wd2",
  "scopes": ["read", "write"],
  "created_at": "2026-11-06T09:02:44.000Z",
  "last_used_at": null,
  "current": false,
  "secret": "gl_live_8Wd2Lm4XqR7tKp9VzN3cYb6F",
  "message": "Copy the secret now: it is shown this once and never again."
}

Roll an API key

POST/v1/api_keys/:key_id/rollwrite scopeMCPmanage_api_keys

Gives a key a new secret and keeps its name, access and ID. The old secret stops working at once, the calling key's own included, so deploy the new one right after. The new secret is in this answer only. An Idempotency-Key is ignored here.

Path parameters

  • key_idstringRequired
    The API key's ID.

Returns

The API key object with its new secret, shown this once, and a message.

Errors

  • No active API key with this ID on the X account.
  • The key to roll has write and the calling key does not.
  • An AI app connected through OAuth asked, a team member's key whose role can only view the settings, or a member rolling a key they did not make.
POST/v1/api_keys/:key_id/roll
curl -X POST \
  https://gemlead.ai/api/v1/api_keys/Pz4vN8kRtB/roll \
  -H "Authorization: Bearer $GEMLEAD_API_KEY"
Response200
{
  "id": "Pz4vN8kRtB",
  "object": "api_key",
  "name": "Zapier",
  "prefix": "gl_live_Q7mx",
  "scopes": ["read", "write"],
  "created_at": "2026-11-06T09:02:44.000Z",
  "last_used_at": "2026-11-06T10:41:09.000Z",
  "current": false,
  "secret": "gl_live_Q7mxB2kWp9RtL4vZc8NyH3dF",
  "message": "Copy the secret now: it is shown this once and never again. The old secret stopped working."
}

Revoke an API key

DELETE/v1/api_keys/:key_idwrite scopeMCPmanage_api_keys

Revokes a key. It stops working at once, and the webhook endpoints it made are turned off with the reason creator_revoked. Revoking the calling key ends its own access too.

Path parameters

  • key_idstringRequired
    The API key's ID.

Returns

An object with the key's id, revoked set to true, current when it was the calling key, and a message.

Errors

  • No active API key with this ID on the X account.
  • A team member's key whose role can only view the settings. The owner and the members who edit the settings can.
DELETE/v1/api_keys/:key_id
curl -X DELETE https://gemlead.ai/api/v1/api_keys/kY7mQ2pLxW \
  -H "Authorization: Bearer $GEMLEAD_API_KEY"
Response200
{
  "id": "kY7mQ2pLxW",
  "object": "api_key",
  "revoked": true,
  "current": false,
  "message": "Key revoked: it stopped working, and the webhook endpoints it made are turned off."
}