{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/api-gouv-fr/json-schema/api-gouv-fr-api-token-created-schema.json",
  "title": "ApiTokenCreated",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/api-gouv-fr-me-api-openapi.yml#/components/schemas/ApiTokenCreated",
  "allOf": [
    {
      "$ref": "#/$defs/ApiToken__read"
    },
    {
      "properties": {
        "token": {
          "description": "The plaintext token (shown only once at creation)",
          "readOnly": true,
          "type": "string"
        }
      },
      "type": "object"
    }
  ],
  "$defs": {
    "ApiToken__read": {
      "properties": {
        "created_at": {
          "description": "Token creation date",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "expires_at": {
          "description": "When this token expires",
          "format": "date-time",
          "type": "string"
        },
        "id": {
          "readOnly": true,
          "type": "string"
        },
        "kind": {
          "description": "Token type",
          "enum": [
            "api_key"
          ],
          "readOnly": true,
          "type": "string"
        },
        "last_used_at": {
          "description": "Last time this token was used",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "name": {
          "description": "User-given label for this token",
          "maxLength": 255,
          "type": "string"
        },
        "revoked_at": {
          "description": "When this token was revoked",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "scopes": {
          "description": "Token scopes",
          "items": {
            "description": "Token scopes",
            "enum": [
              "admin"
            ],
            "type": "string"
          },
          "type": "array"
        },
        "token_prefix": {
          "description": "First characters of the token for identification",
          "readOnly": true,
          "type": "string"
        },
        "user_agents": {
          "description": "User agents that have used this token",
          "items": {
            "description": "User agents that have used this token",
            "readOnly": true,
            "type": "string"
          },
          "readOnly": true,
          "type": "array"
        }
      },
      "required": [
        "created_at",
        "id",
        "token_prefix"
      ],
      "type": "object"
    }
  }
}