Skip to main content
Glama

CreateApiKey

Create an API key for an organization. The response contains the new key's value in token. It is a live credential, so give it to the user to store in a secret manager, and do not repeat it, log it, or pass it to another tool. Which key types you can create depends on how you authenticate. With the GraphOS sign-in (OAuth), you can create OPERATOR, SCIM, and GATEWAY keys. SUBGRAPH and VARIANT keys need a personal API key in the x-api-key header. With an operator key in x-api-key, you can create only GATEWAY keys, and a graph key can create none. No credential can create ROUTER keys. OPERATOR, SCIM, and GATEWAY keys also require the Org Admin role. GATEWAY keys are used by Apollo Gateway instances. Choose the narrowest type that does the job, and confirm the type and its resources with the user before you call this tool. Provide the organization ID, the key name, and the type. For a SUBGRAPH key, list each graphId, variantName, and subgraphName in resources.subgraphs. For a VARIANT key, list each graphId and variantName in resources.variants.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "organizationId": "<organizationId>",
      "name": "<name>",
      "type": "<type>"
    },
    "name": "CreateApiKey"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYes
typeYes
resourcesNo
organizationIdYes

Output Schema

NameRequiredDescriptionDefault
dataNo
errorsNo
extensionsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / properties / data / properties / organization / anyOf
      Previous value: -[
      -  {
      -    "properties": {
      -      "createKey": {
      -        "description": "Create an ApiKey",
      -        "properties": {
      -          "expiresAt": {
      -            "anyOf": [
      -              {
      -                "description": "ISO 8601, extended format with nanoseconds, Zulu (or \"[+-]seconds\" as a string or number relative to now)"
      -              },
      -              {
      -                "type": "null"
      -              }
      -            ],
      -            "description": "The time when this API key expires, if applicable."
      -          },
      -          "id": {
      -            "description": "The API key's ID.",
      -            "oneOf": [
      -              {
      -                "type": "string"
      -              },
      -              {
      -                "type": "integer"
      -              }
      -            ]
      -          },
      -          "keyName": {
      -            "anyOf": [
      -              {
      -                "type": "string"
      -              },
      -              {
      -                "type": "null"
      -              }
      -            ],
      -            "description": "The API key's name, for distinguishing it from other keys."
      -          },
      -          "keyType": {
      -            "anyOf": [
      -              {
      -                "$ref": "#/definitions/GraphOsKeyType"
      -              },
      -              {
      -                "type": "null"
      -              }
      -            ],
      -            "description": "The type of API key (e.g., OPERATOR, SUBGRAPH, GATEWAY, SCIM)."
      -          },
      -          "token": {
      -            "description": "The value of the API key. **This is a secret credential!**",
      -            "type": "string"
      -          }
      -        },
      -        "required": [
      -          "id",
      -          "token"
      -        ],
      -        "type": "object"
      -      }
      -    },
      -    "required": [
      -      "createKey"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "properties": {
      +      "createKey": {
      +        "description": "Create an ApiKey. name must not exceed 250 characters.",
      +        "properties": {
      +          "expiresAt": {
      +            "anyOf": [
      +              {
      +                "description": "ISO 8601, extended format with nanoseconds, Zulu (or \"[+-]seconds\" as a string or number relative to now)"
      +              },
      +              {
      +                "type": "null"
      +              }
      +            ],
      +            "description": "The time when this API key expires, if applicable."
      +          },
      +          "id": {
      +            "description": "The API key's ID.",
      +            "oneOf": [
      +              {
      +                "type": "string"
      +              },
      +              {
      +                "type": "integer"
      +              }
      +            ]
      +          },
      +          "keyName": {
      +            "anyOf": [
      +              {
      +                "type": "string"
      +              },
      +              {
      +                "type": "null"
      +              }
      +            ],
      +            "description": "The API key's name, for distinguishing it from other keys."
      +          },
      +          "keyType": {
      +            "anyOf": [
      +              {
      +                "$ref": "#/definitions/GraphOsKeyType"
      +              },
      +              {
      +                "type": "null"
      +              }
      +            ],
      +            "description": "The type of API key (e.g., OPERATOR, SUBGRAPH, GATEWAY, SCIM)."
      +          },
      +          "token": {
      +            "description": "The value of the API key. **This is a secret credential!**",
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "id",
      +          "token"
      +        ],
      +        "type": "object"
      +      }
      +    },
      +    "required": [
      +      "createKey"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
  2. Added

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Discloses behavior beyond the annotations: the return value is a live credential, and it prescribes handling (give to user, store in secret manager, never repeat/log/forward to another tool). It also surfaces authorization constraints (which auth method unlocks which key types, Org Admin role) that annotations (readOnlyHint=false, destructiveHint=false, openWorldHint=true) do not convey. No contradiction with the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and the credential-handling warning are front-loaded, and the auth-to-key-type matrix is dense but useful. A couple of lines are close to filler — "GATEWAY keys are used by Apollo Gateway instances" adds little, and the key-type enumeration overlaps with the GraphOsKeyType enum documentation — but overall the length is justified by the decision complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutating, auth-sensitive credential-creation tool, the description covers purpose, permissions matrix, required inputs, per-type resource shapes, and post-call handling. An output schema exists, so return-value structure need not be detailed, and the one thing worth flagging (the token in the response) is flagged.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% at the top level, so the description must carry the load — it names the three required inputs (organizationId, name, type) and spells out the shape of `resources.subgraphs` (graphId, variantName, subgraphName) and `resources.variants` (graphId, variantName), which is exactly what the anyOf schema leaves ambiguous. It does not explain `resources.gateways` or the GatewayIdentifierInput.graphId fallback behavior, so it is not fully exhaustive.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb and resource ("Create an API key for an organization") and immediately distinguishes the outcome (response carries the new key in `token`). It also separates itself from sibling key operations (GetApiKeys, DeleteApiKey, RenameApiKey) by describing creation semantics and the resulting credential.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit decision table: which key types are creatable depends on the auth method (OAuth vs personal key vs operator key), and it names the role requirement for OPERATOR/SCIM/GATEWAY. It adds a concrete usage directive — "Choose the narrowest type that does the job, and confirm the type and its resources with the user" — plus the flat exclusion that no credential can create ROUTER keys.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources