AlmondTill/G3N API

mintApiKey

mutation · in the family System and integration setup

What it does

Mint an API key — a machine credential for your integrations.

Mint an ApiKey: owner-gated engine-side (the minting actor's Account must hold group ownership live — reach derives from those ownerships at every call); descriptors ride the grammar (≥1, deduped, immutable); expiresAt ≤ 12 months (clock-gated); returns the key + the secret once (hash-only at rest). Template class (integration config — Manager's hard-disallow correctly blocks the attempt at the descriptor layer; hand-derived v30).

Before you call

A signed-in user’s session — the call refuses an API key (AUTHZ/FORBIDDEN).

Capability area: System and integration setup — Registers, connections and the settings your systems run on.

Roles that may call it:

What happens

The secret shows ONCE at minting and never again; only its facts remain visible.

Careful

OWNER-gated. A key is a standing credential — scope it narrowly and rotate it on schedule (12-month maximum).

Arguments

NameTypeRequiredNotes
inputMintApiKeyInput MintApiKeyInput!yesCreate-input for mintApiKey.

Returns

ApiKeyMint ApiKeyMint! — The mintApiKey result — the key + its secret, returned once (hash-only at rest; presented only to exchangeApiKey).

Example request

graphql
mutation ExampleMintApiKey($input: MintApiKeyInput!) {
  mintApiKey(input: $input) {
    secret
  }
}

Variables:

json
{
  "input": {
    "caption": "Blue jeans",
    "descriptors": [
      {
        "service": "<service>",
        "action": "<action>",
        "polarity": "allow"
      }
    ],
    "expiresAt": "2028-01-31T00:00:00.000Z"
  }
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

json
{
  "data": {
    "mintApiKey": {
      "secret": "<your key secret>"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer

Used in