Docs

Get a schema by ID

GET
/schemas/{schema_id}

Returns a schema by ID. A schema ID identifies one immutable revision, so this returns exactly that revision. To find the current revision of an object type, call listSchemas (GET /schemas) with revisions=latest.

Schema IDs are unique within a project, not across projects (the seeded default schema carries the same $id in every project). A console session that manages more than one project names the project with project_id; without it, the ID is resolved in the credential's own project when it is ambiguous. A project secret always resolves in its own project and ignores project_id.

Authorization

headerAuthorizationBearer <token>

Scope: schema.read

Path Parameters

schema_id*string

The schema ID: the id that publishSchema (POST /schemas) returns or listSchemas (GET /schemas) lists.

Query Parameters

team_id?string

The team ID: the id that createTeam (POST /teams) or queryTeams (POST /teams/query) returns.

Match^[a-zA-Z0-9_-]+$
project_id?string

The project the request addresses, by the id that createProject (POST /projects) returns. Omit it to address the credential's own project.

Match^[a-zA-Z0-9_-]+$

Response Body

The schema.

application/json
  1. response

A schema resource: the server-owned envelope around a customer-authored JSON Schema document.

schema is the customer-authored document, served verbatim: its author defines its keys and contents. The rest of the object (id and metadata) is the server-owned envelope. Keeping the two apart means the document may declare any property (including id or metadata) without colliding with the envelope, and the resource id stays distinguishable from the document's own $id.

id*string

The schema's ID: the server-generated sch_* identifier, or the customer-supplied $id URI when the document declared one at creation.

schema*

The customer-authored JSON Schema document, served verbatim.

metadata*
Example Request
import { configureZitadel, getApi } from "@zitadel/api/config";// In the browser, through the SDK proxy: the session cookie authenticates the call.const client = getApi(configureZitadel({ projectId: "proj_01KWH1P4MYS7F0N9WD3P2E4YM5" }));const schema = await client.getSchema("sch_01KWHF2XY6RN7F0N9WD3P2E4YM", { team_id: "team_01KZZY8PX8K8ATNVDSMRCZY4N1" });
Example Response
{  "id": "string",  "schema": {    "$schema": "https://json-schema.org/draft/2020-12/schema",    "objectType": "string",    "kind": "user-schema",    "metaSchema": "http://example.com",    "x-auth-methods": {      "password": {        "enabled": true      },      "passkey": {        "enabled": true      },      "magic_link": {        "enabled": true      },      "sso": {        "providers": [          "google"        ],        "enabled": true      },      "otp": {        "enabled": true      }    },    "x-identifier": "string",    "x-display": [      "string"    ],    "properties": {      "property1": {        "x-unique": "unspecified",        "x-claim": "string",        "x-audit": false,        "properties": {          "property1": {},          "property2": {}        }      },      "property2": {        "x-unique": "unspecified",        "x-claim": "string",        "x-audit": false,        "properties": {          "property1": {},          "property2": {}        }      }    }  },  "metadata": {    "created_at": "2019-08-24T14:15:22Z",    "in_use": true  }}

Was this helpful?