本文へスキップ
MZGrid

このページは英語版のみご利用いただけます。 英語版が正式な内容となります。

API keys

Create, list and revoke long-lived mzg_live_ API keys for servers and scripts.

API keys let servers and scripts call the customer endpoints without a wallet sign-in each time. A key acts on behalf of the wallet that created it. Key management requires a session token from wallet sign-in — an API key cannot create or revoke other keys. You can also manage keys in your dashboard.

重要

The full key is returned only once, when it is created. Store it in a secret manager. Never commit it or ship it in client-side code.

POST /v1/keys

HTTP
POST /v1/keys
Authorization: Bearer <session token>
Content-Type: application/json

{ "name": "inference-backend-prod" }
JSON
{
  "id": "key_2w9r6t1b",
  "key": "mzg_live_4Jt7qX2mV9cR1sPz8kLw3nYb6HdF0aGe",
  "createdAt": "2026-11-04T09:20:14Z"
}

GET /v1/keys

Lists your keys. The secret is never returned again; only a short prefix is shown for identification.

JSON
{
  "items": [
    { "id": "key_2w9r6t1b", "name": "inference-backend-prod", "prefix": "mzg_live_4Jt7", "createdAt": "2026-11-04T09:20:14Z", "lastUsedAt": "2026-11-04T10:02:51Z" },
    { "id": "key_8c3m0q5d", "name": "ci-smoke-tests", "prefix": "mzg_live_Qa91", "createdAt": "2026-09-17T16:45:02Z", "lastUsedAt": null }
  ]
}

DELETE /v1/keys/:id

Revokes a key immediately. Requests using it fail with 401 unauthorized. Returns 204 No Content.

Shell
curl -X DELETE https://api.mzgrid.io/v1/keys/key_8c3m0q5d -H "Authorization: Bearer $MZG_SESSION_TOKEN"

Good practice

  • Create one key per service or environment so you can revoke them independently.
  • Rotate keys periodically: create a new key, deploy it, then delete the old one.
  • An API key cannot move funds — funding a job always needs a wallet signature — but it can create and stop jobs and read job logs. Treat it as a secret.
  • If a key leaks, delete it immediately and review recent jobs in your dashboard.