Skip to main content
A schema defines the structure of a verifiable credential — the set of attribute names, their data types, and display metadata. Before you can issue a credential, you need a schema registered on a ledger and a credential definition derived from it. CREDEBL supports two schema formats:
  • AnonCreds (Indy) — Attributes are a flat list of name/type pairs. Suitable for use with Hyperledger Indy-compatible ledgers.
  • W3C JSON-LD — Attributes are structured JSON Schema objects supporting rich types (string, number, boolean, array, object) and validation constraints. Used with Polygon and other W3C-compatible ledgers.

Base path

All endpoints are rooted at /orgs/:orgId/schemas.

Authentication

Every endpoint requires a JWT bearer token.
Authorization: Bearer <your-jwt-token>

Role-based access

OperationRequired roles
Create schemaowner, admin
Read schemasowner, admin, issuer, verifier, member

Endpoints

Create schema

POST /orgs/:orgId/schemas — Register a new schema on the ledger.

List schemas

GET /orgs/:orgId/schemas — Retrieve all schemas for an organization.

Get schema

GET /orgs/:orgId/schemas/:schemaId — Fetch a schema from the ledger by its ID.

Credential definitions by schema

GET /orgs/:orgId/schemas/:schemaId/cred-defs — List credential definitions linked to a schema.

Create schema

POST /orgs/:orgId/schemas Register a new schema for an organization. The schema is written to the ledger associated with the organization’s DID. Supports Indy (AnonCreds) and W3C JSON-LD formats. Required roles: owner, admin

Path parameters

orgId
string
required
UUID of the organization creating the schema.

Request body

type
string
required
Schema format. Enum: INDY or JSON (W3C JSON-LD).
alias
string
Optional human-readable alias for the schema record in the platform database.
schemaPayload
object
required
The schema definition. The structure depends on type.

Response

data
object

Examples

curl --request POST \
  --url "http://localhost:5000/v1/orgs/3fa85f64-5717-4562-b3fc-2c963f66afa6/schemas" \
  --header "Authorization: Bearer <your-jwt-token>" \
  --header "Content-Type: application/json" \
  --data '{
    "type": "INDY",
    "alias": "Employee credential schema",
    "schemaPayload": {
      "schemaName": "EmployeeCredential",
      "schemaVersion": "1.0",
      "attributes": [
        {
          "attributeName": "firstName",
          "schemaDataType": "string",
          "displayName": "First Name",
          "isRequired": true
        },
        {
          "attributeName": "lastName",
          "schemaDataType": "string",
          "displayName": "Last Name",
          "isRequired": true
        },
        {
          "attributeName": "employeeId",
          "schemaDataType": "string",
          "displayName": "Employee ID",
          "isRequired": true
        },
        {
          "attributeName": "department",
          "schemaDataType": "string",
          "displayName": "Department",
          "isRequired": false
        },
        {
          "attributeName": "startDate",
          "schemaDataType": "date",
          "displayName": "Start Date",
          "isRequired": true
        }
      ]
    }
  }'
201 response
{
  "statusCode": 201,
  "message": "Schema created successfully",
  "data": {
    "id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
    "schemaLedgerId": "WgWxqztrNooG92RXvxSTWv:2:EmployeeCredential:1.0",
    "name": "EmployeeCredential",
    "version": "1.0",
    "attributes": ["firstName", "lastName", "employeeId", "department", "startDate"],
    "publisherDid": "did:indy:WgWxqztrNooG92RXvxSTWv",
    "orgId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "issuerId": "WgWxqztrNooG92RXvxSTWv",
    "createdBy": "1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed"
  }
}
StatusDescription
400 Bad RequestorgId is not a valid UUID, or required fields are missing.
401 UnauthorizedMissing or invalid bearer token.
403 ForbiddenUser does not have owner or admin role.
409 ConflictA schema with the same name and version already exists on the ledger.

List schemas

GET /orgs/:orgId/schemas Retrieve all schemas belonging to an organization. Supports pagination, full-text search, and sorting. Required roles: owner, admin, issuer, verifier, member

Path parameters

orgId
string
required
UUID of the organization.

Query parameters

pageNumber
number
Page to retrieve. Min 1. Defaults to 1.
pageSize
number
Records per page. Min 1. Defaults to 10.
searchByText
string
Free-text search across schema names.
sortField
string
Field to sort by. Enum: createDateTime (default) and other available sort fields.
sortBy
string
Sort direction. ASC or DESC (default).

Examples

curl --request GET \
  --url "http://localhost:5000/v1/orgs/3fa85f64-5717-4562-b3fc-2c963f66afa6/schemas?pageNumber=1&pageSize=20&sortBy=DESC" \
  --header "Authorization: Bearer <your-jwt-token>"
200 response
{
  "statusCode": 200,
  "message": "Schemas fetched successfully",
  "data": {
    "totalItems": 1,
    "hasNextPage": false,
    "data": [
      {
        "id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
        "schemaLedgerId": "WgWxqztrNooG92RXvxSTWv:2:EmployeeCredential:1.0",
        "name": "EmployeeCredential",
        "version": "1.0",
        "attributes": ["firstName", "lastName", "employeeId", "department", "startDate"],
        "orgId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "createdAt": "2024-01-15T09:00:00.000Z"
      }
    ]
  }
}

Get schema by ID

GET /orgs/:orgId/schemas/:schemaId Fetch the full schema details from the ledger using its ledger schema ID. Required roles: owner, admin, issuer, verifier, member

Path parameters

orgId
string
required
UUID of the organization.
schemaId
string
required
The ledger schema ID, for example "WgWxqztrNooG92RXvxSTWv:2:EmployeeCredential:1.0".

Examples

curl --request GET \
  --url "http://localhost:5000/v1/orgs/3fa85f64-5717-4562-b3fc-2c963f66afa6/schemas/WgWxqztrNooG92RXvxSTWv:2:EmployeeCredential:1.0" \
  --header "Authorization: Bearer <your-jwt-token>"
200 response
{
  "statusCode": 200,
  "message": "Schema fetched successfully",
  "data": {
    "schema": {
      "attrNames": ["firstName", "lastName", "employeeId", "department", "startDate"],
      "name": "EmployeeCredential",
      "version": "1.0",
      "issuerId": "WgWxqztrNooG92RXvxSTWv"
    },
    "schemaId": "WgWxqztrNooG92RXvxSTWv:2:EmployeeCredential:1.0"
  }
}
StatusDescription
400 Bad RequestschemaId is missing or malformed.
404 Not FoundSchema not found on the ledger.

Credential definitions by schema

GET /orgs/:orgId/schemas/:schemaId/cred-defs List all credential definitions on the platform that are derived from a given schema. Required roles: owner, admin, issuer, verifier, member

Path parameters

orgId
string
required
UUID of the organization.
schemaId
string
required
The ledger schema ID.

Query parameters

pageNumber
number
Page to retrieve. Min 1. Defaults to 1.
pageSize
number
Records per page. Min 1. Defaults to 10.
searchByText
string
Free-text search.
sortField
string
Field to sort by. Enum: createDateTime (default).
sortBy
string
Sort direction. ASC or DESC (default).

Examples

curl --request GET \
  --url "http://localhost:5000/v1/orgs/3fa85f64-5717-4562-b3fc-2c963f66afa6/schemas/WgWxqztrNooG92RXvxSTWv:2:EmployeeCredential:1.0/cred-defs" \
  --header "Authorization: Bearer <your-jwt-token>"
200 response
{
  "statusCode": 200,
  "message": "Schema fetched successfully",
  "data": {
    "totalItems": 1,
    "data": [
      {
        "id": "b1e5f231-4c56-7a89-bc01-d234e567f890",
        "credentialDefinitionId": "WgWxqztrNooG92RXvxSTWv:3:CL:123:default",
        "tag": "default",
        "schemaLedgerId": "WgWxqztrNooG92RXvxSTWv:2:EmployeeCredential:1.0",
        "revocable": false,
        "orgId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "createdAt": "2024-01-15T09:30:00.000Z"
      }
    ]
  }
}

Build docs developers (and LLMs) love