---
title: Generate IDs
slug: api-documentation/generate-ids
docTags: 
createdAt: 2026-10-09T16:36:44.630Z
---

{
  "id": "KgUw1m0JvYOlNEgYi0IFs",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "http://localhost:8080/idgen/namespaces/{name}/ids",
    "servers": [
      {
        "url": "{baseUrl}/idgen/namespaces/{name}/ids",
        "description": "The API gateway, or the service itself (port 8080).",
        "variables": {
          "baseUrl": {
            "default": "http://localhost:8080",
            "description": "Scheme and host, e.g. https://<gateway>. No trailing slash."
          }
        }
      }
    ],
    "name": "Generate IDs",
    "description": "<p>Issues <code>count</code> IDs from the namespace's active version, in sequence order. A tenant's first request for a name it does not have copies the <code>_default</code> template of that name, if there is one. IDs are never issued twice; gaps are normal. Needs <code>idgen.ids.generate</code>.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "name",
          "type": "string",
          "description": "<p>The namespace name (<code>^[a-z][a-z0-9._-]{0,63}$</code>).</p>"
        }
      ],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        },
        {
          "kind": "optional",
          "name": "Idempotency-Key",
          "type": "string",
          "description": "<p>Makes retries safe: a repeat with the same key within 24 hours returns the first response byte for byte. 5xx responses are not stored, so retrying after one really retries.</p>"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "How many IDs to generate.",
          "customType": "GenerateIdsRequest",
          "schema": [
            {
              "name": "count",
              "kind": "optional",
              "type": "integer<int32>",
              "description": "<p>1-1000. Default 1.</p>",
              "format": "int32"
            }
          ],
          "modelRef": "#/components/schemas/GenerateIdsRequest",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "bearerAuth",
          "name": "bearerAuth",
          "kind": "optional",
          "type": "http",
          "description": "<p>A JWT from authentication-svc. The tenant comes from the token.</p>",
          "scheme": "bearer"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "201",
        "description": "The new IDs.",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "<p>Newly issued IDs, in sequence order, all from one version.</p>",
            "customType": "GeneratedIdsDto",
            "schema": [
              {
                "name": "namespace",
                "kind": "required",
                "type": "string",
                "description": "The namespace the IDs belong to."
              },
              {
                "name": "version",
                "kind": "required",
                "type": "integer<int32>",
                "description": "The version that produced them.",
                "format": "int32"
              },
              {
                "name": "count",
                "kind": "required",
                "type": "integer<int32>",
                "description": "How many IDs were issued.",
                "format": "int32"
              },
              {
                "name": "ids",
                "kind": "optional",
                "type": "array",
                "description": "<p>The IDs. Never issued again; gaps between requests are normal.</p>",
                "example": "",
                "itemType": "string",
                "customType": "string[]",
                "itemExample": "",
                "itemDefault": ""
              },
              {
                "name": "links",
                "kind": "required",
                "type": "map",
                "description": "<p>Related resources: <code>namespace</code> (path under /idgen).</p>",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/GeneratedIdsDto",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "<p>INVALID_REQUEST: a malformed path or body value, or <code>count</code> outside 1-1000.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "<p>The body of every error response. Branch on <code>error</code>, never on <code>message</code>.</p>",
            "customType": "ErrorDto",
            "schema": [
              {
                "name": "error",
                "kind": "required",
                "type": "string",
                "description": "<p>The machine-readable error code, e.g. NAMESPACE_NOT_FOUND or FORMAT_OVERLAP.</p>"
              },
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "<p>A human-readable explanation.</p>"
              },
              {
                "name": "status",
                "kind": "required",
                "type": "integer<int32>",
                "description": "<p>The HTTP status code, repeated.</p>",
                "format": "int32"
              },
              {
                "name": "details",
                "kind": "required",
                "type": "map",
                "description": "<p>Structured context: <code>retryable</code> (whether the same request can succeed later) and, depending on the code, <code>namespace</code>, <code>version</code>, <code>templateExists</code>, <code>conflictingVersion</code> and <code>exampleId</code>.</p>",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              },
              {
                "name": "links",
                "kind": "required",
                "type": "map",
                "description": "<p>Related resources, e.g. <code>namespace</code> (paths under /idgen).</p>",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/ErrorDto",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "401",
        "description": "<p>UNAUTHENTICATED: missing, expired or invalid credentials.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "<p>The body of every error response. Branch on <code>error</code>, never on <code>message</code>.</p>",
            "customType": "ErrorDto",
            "schema": [
              {
                "name": "error",
                "kind": "required",
                "type": "string",
                "description": "<p>The machine-readable error code, e.g. NAMESPACE_NOT_FOUND or FORMAT_OVERLAP.</p>"
              },
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "<p>A human-readable explanation.</p>"
              },
              {
                "name": "status",
                "kind": "required",
                "type": "integer<int32>",
                "description": "<p>The HTTP status code, repeated.</p>",
                "format": "int32"
              },
              {
                "name": "details",
                "kind": "required",
                "type": "map",
                "description": "<p>Structured context: <code>retryable</code> (whether the same request can succeed later) and, depending on the code, <code>namespace</code>, <code>version</code>, <code>templateExists</code>, <code>conflictingVersion</code> and <code>exampleId</code>.</p>",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              },
              {
                "name": "links",
                "kind": "required",
                "type": "map",
                "description": "<p>Related resources, e.g. <code>namespace</code> (paths under /idgen).</p>",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/ErrorDto",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "403",
        "description": "<p>FORBIDDEN: the caller lacks the <code>idgen.ids.generate</code> permission, or its tenant or site scope does not match.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "<p>The body of every error response. Branch on <code>error</code>, never on <code>message</code>.</p>",
            "customType": "ErrorDto",
            "schema": [
              {
                "name": "error",
                "kind": "required",
                "type": "string",
                "description": "<p>The machine-readable error code, e.g. NAMESPACE_NOT_FOUND or FORMAT_OVERLAP.</p>"
              },
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "<p>A human-readable explanation.</p>"
              },
              {
                "name": "status",
                "kind": "required",
                "type": "integer<int32>",
                "description": "<p>The HTTP status code, repeated.</p>",
                "format": "int32"
              },
              {
                "name": "details",
                "kind": "required",
                "type": "map",
                "description": "<p>Structured context: <code>retryable</code> (whether the same request can succeed later) and, depending on the code, <code>namespace</code>, <code>version</code>, <code>templateExists</code>, <code>conflictingVersion</code> and <code>exampleId</code>.</p>",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              },
              {
                "name": "links",
                "kind": "required",
                "type": "map",
                "description": "<p>Related resources, e.g. <code>namespace</code> (paths under /idgen).</p>",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/ErrorDto",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "404",
        "description": "<p>NAMESPACE_NOT_FOUND: no such namespace and no template of that name.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "<p>The body of every error response. Branch on <code>error</code>, never on <code>message</code>.</p>",
            "customType": "ErrorDto",
            "schema": [
              {
                "name": "error",
                "kind": "required",
                "type": "string",
                "description": "<p>The machine-readable error code, e.g. NAMESPACE_NOT_FOUND or FORMAT_OVERLAP.</p>"
              },
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "<p>A human-readable explanation.</p>"
              },
              {
                "name": "status",
                "kind": "required",
                "type": "integer<int32>",
                "description": "<p>The HTTP status code, repeated.</p>",
                "format": "int32"
              },
              {
                "name": "details",
                "kind": "required",
                "type": "map",
                "description": "<p>Structured context: <code>retryable</code> (whether the same request can succeed later) and, depending on the code, <code>namespace</code>, <code>version</code>, <code>templateExists</code>, <code>conflictingVersion</code> and <code>exampleId</code>.</p>",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              },
              {
                "name": "links",
                "kind": "required",
                "type": "map",
                "description": "<p>Related resources, e.g. <code>namespace</code> (paths under /idgen).</p>",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/ErrorDto",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "409",
        "description": "<p>NAMESPACE_DISABLED, NO_ACTIVE_VERSION or SEQUENCE_EXHAUSTED (configuration problems), or IDEMPOTENCY_KEY_IN_USE (retryable: the first request with this key is still running).</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "<p>The body of every error response. Branch on <code>error</code>, never on <code>message</code>.</p>",
            "customType": "ErrorDto",
            "schema": [
              {
                "name": "error",
                "kind": "required",
                "type": "string",
                "description": "<p>The machine-readable error code, e.g. NAMESPACE_NOT_FOUND or FORMAT_OVERLAP.</p>"
              },
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "<p>A human-readable explanation.</p>"
              },
              {
                "name": "status",
                "kind": "required",
                "type": "integer<int32>",
                "description": "<p>The HTTP status code, repeated.</p>",
                "format": "int32"
              },
              {
                "name": "details",
                "kind": "required",
                "type": "map",
                "description": "<p>Structured context: <code>retryable</code> (whether the same request can succeed later) and, depending on the code, <code>namespace</code>, <code>version</code>, <code>templateExists</code>, <code>conflictingVersion</code> and <code>exampleId</code>.</p>",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              },
              {
                "name": "links",
                "kind": "required",
                "type": "map",
                "description": "<p>Related resources, e.g. <code>namespace</code> (paths under /idgen).</p>",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/ErrorDto",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "422",
        "description": "<p>IDEMPOTENCY_KEY_REUSED: the key was used with a different request.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "<p>The body of every error response. Branch on <code>error</code>, never on <code>message</code>.</p>",
            "customType": "ErrorDto",
            "schema": [
              {
                "name": "error",
                "kind": "required",
                "type": "string",
                "description": "<p>The machine-readable error code, e.g. NAMESPACE_NOT_FOUND or FORMAT_OVERLAP.</p>"
              },
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "<p>A human-readable explanation.</p>"
              },
              {
                "name": "status",
                "kind": "required",
                "type": "integer<int32>",
                "description": "<p>The HTTP status code, repeated.</p>",
                "format": "int32"
              },
              {
                "name": "details",
                "kind": "required",
                "type": "map",
                "description": "<p>Structured context: <code>retryable</code> (whether the same request can succeed later) and, depending on the code, <code>namespace</code>, <code>version</code>, <code>templateExists</code>, <code>conflictingVersion</code> and <code>exampleId</code>.</p>",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              },
              {
                "name": "links",
                "kind": "required",
                "type": "map",
                "description": "<p>Related resources, e.g. <code>namespace</code> (paths under /idgen).</p>",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/ErrorDto",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "500",
        "description": "<p>INTERNAL_ERROR: an unexpected failure. Retry once, then report it with the <code>x-request-id</code>.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "<p>The body of every error response. Branch on <code>error</code>, never on <code>message</code>.</p>",
            "customType": "ErrorDto",
            "schema": [
              {
                "name": "error",
                "kind": "required",
                "type": "string",
                "description": "<p>The machine-readable error code, e.g. NAMESPACE_NOT_FOUND or FORMAT_OVERLAP.</p>"
              },
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "<p>A human-readable explanation.</p>"
              },
              {
                "name": "status",
                "kind": "required",
                "type": "integer<int32>",
                "description": "<p>The HTTP status code, repeated.</p>",
                "format": "int32"
              },
              {
                "name": "details",
                "kind": "required",
                "type": "map",
                "description": "<p>Structured context: <code>retryable</code> (whether the same request can succeed later) and, depending on the code, <code>namespace</code>, <code>version</code>, <code>templateExists</code>, <code>conflictingVersion</code> and <code>exampleId</code>.</p>",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              },
              {
                "name": "links",
                "kind": "required",
                "type": "map",
                "description": "<p>Related resources, e.g. <code>namespace</code> (paths under /idgen).</p>",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/ErrorDto",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "503",
        "description": "<p>AUTH_UNAVAILABLE or BACKEND_UNAVAILABLE (both retryable): retry with backoff.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "<p>The body of every error response. Branch on <code>error</code>, never on <code>message</code>.</p>",
            "customType": "ErrorDto",
            "schema": [
              {
                "name": "error",
                "kind": "required",
                "type": "string",
                "description": "<p>The machine-readable error code, e.g. NAMESPACE_NOT_FOUND or FORMAT_OVERLAP.</p>"
              },
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "<p>A human-readable explanation.</p>"
              },
              {
                "name": "status",
                "kind": "required",
                "type": "integer<int32>",
                "description": "<p>The HTTP status code, repeated.</p>",
                "format": "int32"
              },
              {
                "name": "details",
                "kind": "required",
                "type": "map",
                "description": "<p>Structured context: <code>retryable</code> (whether the same request can succeed later) and, depending on the code, <code>namespace</code>, <code>version</code>, <code>templateExists</code>, <code>conflictingVersion</code> and <code>exampleId</code>.</p>",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              },
              {
                "name": "links",
                "kind": "required",
                "type": "map",
                "description": "<p>Related resources, e.g. <code>namespace</code> (paths under /idgen).</p>",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/ErrorDto",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "SVMlskewNpdc1Ov5miLYa",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url http://localhost:8080/idgen/namespaces/{name}/ids \\\n     --header 'accept: application/json'"
        },
        {
          "id": "DfPfqZzA5JoV2BisMwpEA",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"http://localhost:8080/idgen/namespaces/{name}/ids\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "QmnLhVRggUwYTug2fY7_v",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"http://localhost:8080/idgen/namespaces/{name}/ids\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "RvnfHRVk0mCl_Vo31CsYq",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"http://localhost:8080/idgen/namespaces/{name}/ids\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "SVMlskewNpdc1Ov5miLYa"
    },
    "results": {
      "languages": [
        {
          "id": "ayVw26KEmtqz0m1_0uU8V",
          "language": "201",
          "code": "// The new IDs.\n{\n  \"namespace\": \"\",\n  \"version\": \"\",\n  \"count\": \"\",\n  \"ids\": [\n    \"\"\n  ],\n  \"links\": \"\"\n}"
        },
        {
          "id": "KWBczwo0YE7bWJ_HArxT7",
          "language": "400",
          "code": "// INVALID_REQUEST: a malformed path or body value, or count outside 1-1000.\n{\n  \"error\": \"\",\n  \"message\": \"\",\n  \"status\": \"\",\n  \"details\": \"\",\n  \"links\": \"\"\n}"
        },
        {
          "id": "bSFDWs4-UO605hO-YmpaH",
          "language": "401",
          "code": "// UNAUTHENTICATED: missing, expired or invalid credentials.\n{\n  \"error\": \"\",\n  \"message\": \"\",\n  \"status\": \"\",\n  \"details\": \"\",\n  \"links\": \"\"\n}"
        },
        {
          "id": "ytvVdZRlKULF0ThT3NZil",
          "language": "403",
          "code": "// FORBIDDEN: the caller lacks the idgen.ids.generate permission, or its tenant or site scope does not match.\n{\n  \"error\": \"\",\n  \"message\": \"\",\n  \"status\": \"\",\n  \"details\": \"\",\n  \"links\": \"\"\n}"
        },
        {
          "id": "PwerBvIo9JZOFCRCKkSlU",
          "language": "404",
          "code": "// NAMESPACE_NOT_FOUND: no such namespace and no template of that name.\n{\n  \"error\": \"\",\n  \"message\": \"\",\n  \"status\": \"\",\n  \"details\": \"\",\n  \"links\": \"\"\n}"
        },
        {
          "id": "Jy7CR6tih0zU_0R3-Jl3V",
          "language": "409",
          "code": "// NAMESPACE_DISABLED, NO_ACTIVE_VERSION or SEQUENCE_EXHAUSTED (configuration problems), or IDEMPOTENCY_KEY_IN_USE (retryable: the first request with this key is still running).\n{\n  \"error\": \"\",\n  \"message\": \"\",\n  \"status\": \"\",\n  \"details\": \"\",\n  \"links\": \"\"\n}"
        },
        {
          "id": "l2XY069Yed30Fz3UeutMU",
          "language": "422",
          "code": "// IDEMPOTENCY_KEY_REUSED: the key was used with a different request.\n{\n  \"error\": \"\",\n  \"message\": \"\",\n  \"status\": \"\",\n  \"details\": \"\",\n  \"links\": \"\"\n}"
        },
        {
          "id": "tbTKrmXBPd4VbAtbQkAt5",
          "language": "500",
          "code": "// INTERNAL_ERROR: an unexpected failure. Retry once, then report it with the x-request-id.\n{\n  \"error\": \"\",\n  \"message\": \"\",\n  \"status\": \"\",\n  \"details\": \"\",\n  \"links\": \"\"\n}"
        },
        {
          "id": "hJbUAL0CaXqfEABhugtdG",
          "language": "503",
          "code": "// AUTH_UNAVAILABLE or BACKEND_UNAVAILABLE (both retryable): retry with backoff.\n{\n  \"error\": \"\",\n  \"message\": \"\",\n  \"status\": \"\",\n  \"details\": \"\",\n  \"links\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "ayVw26KEmtqz0m1_0uU8V"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}