API Reference
API reference for the ID Generator service — endpoints, response envelope, error codes, and HTTP status codes.
The ID Generator exposes an OpenAPI 3.1 compliant REST API. A running instance provides interactive documentation at:
Swagger UI:
GET /docsReDoc:
GET /redocOpenAPI JSON spec:
GET /openapi.json
Response envelope
All endpoints return a consistent JSON envelope.
Success response:
{
"id": "openg2p.idgenerator",
"version": "1.0",
"responsetime": "2026-03-27T10:00:00.000Z",
"response": { ... },
"errors": []
}Error response (response is null, errors is populated):
{
"id": "openg2p.idgenerator",
"version": "1.0",
"responsetime": "2026-03-27T10:00:00.000Z",
"response": null,
"errors": [
{ "errorCode": "IDG-001", "message": "No IDs available for ID type 'farmer'" }
]
}Path parameter constraints
{id_type}
string
^[a-z][a-z0-9_]{1,63}$
Lowercase alphanumeric + underscore, starts with letter
{id}
string
^\d{1,32}$
Digits only, 1–32 characters
Invalid path parameters return HTTP 422 Unprocessable Entity.
Endpoints
Issue ID
POST /v1/idgenerator/{id_type}/id
Issues a single AVAILABLE ID from the specified ID type pool and marks it as TAKEN. No request body required.
Success response (200 OK):
Error responses:
Pool temporarily empty
503 Service Unavailable
IDG-001
ID space permanently exhausted
410 Gone
IDG-002
Unknown ID type
404 Not Found
IDG-003
Validate ID
GET /v1/idgenerator/{id_type}/id/validate/{id}
Validates whether a given ID is structurally valid — checks the Verhoeff checksum and all 10 filter rules. Does not check whether the ID exists in the database.
Response (200 OK):
Both valid and invalid IDs return HTTP 200 — the result is in the valid field.
Unknown ID type
404 Not Found
IDG-003
Health Check
GET /v1/idgenerator/health
Returns service health (DB connectivity ping). Used as Kubernetes readiness/liveness probe.
Success response (200 OK):
Healthy
200 OK
—
Startup not complete
503 Service Unavailable
IDG-005
DB health check failed
503 Service Unavailable
IDG-006
Version
GET /v1/idgenerator/version
Returns the service version and build metadata. Used by test frameworks and monitoring to identify which version is deployed.
Response (200 OK):
service_version
Semantic version from pyproject.toml
build_time
Timestamp when the Docker image was built
git_commit
Short git commit hash
Config
GET /v1/idgenerator/config
Returns the active service configuration — configured ID types, ID lengths, and filter rules. Useful for test frameworks and diagnostics to discover configured ID types without hardcoding names.
Response (200 OK):
HTTP status codes
200 OK
Request succeeded
Successful issue, validate, health, version, config
404 Not Found
Resource not found
Unknown ID type (IDG-003)
410 Gone
Resource permanently gone
ID space exhausted (IDG-002)
422 Unprocessable Entity
Validation error
Invalid path parameter format
503 Service Unavailable
Temporarily unavailable
Pool empty (IDG-001), health check failing (IDG-005/006)
Error codes
IDG-001
503
No IDs available in pool (temporary — replenishment in progress)
IDG-002
410
ID space exhausted for ID type (permanent — no more IDs possible)
IDG-003
404
Unknown ID type
IDG-004
—
Invalid ID (returned in validate response body, not as HTTP error)
IDG-005
503
Service not ready — startup not complete
IDG-006
503
Database health check failed
Last updated
Was this helpful?