CL03 IssuerAPI documentation · ov.x.trl.ph Sign in

CL03 Issuer API

Version 1

Issue signed, encrypted CL03 credentials from your own systems, and get back a QR code that OVX and VerifyX check offline.

Base URL https://ov.x.trl.ph. Machine-readable description: OpenAPI 3.1.

Quick start

  1. Create an API client in the console, and store its secret.
  2. Get a token: POST /oauth/token with the client ID and secret.
  3. See your data pages: GET /api/v1/templates.
  4. Issue: POST /api/v1/credentials with a data page and its fields.
  5. Print the returned text as an alphanumeric QR code at error correction level Q.

Authentication

The API uses the OAuth 2.0 client credentials grant. Send the client ID and secret to /oauth/token with HTTP Basic authentication, or as client_id and client_secret in the form body, not both. The token lasts the client's token lifetime (15 minutes unless changed): reuse it until then, and send it on every call as Authorization: Bearer.

Secrets are shown once, when they are made. Rotate them from the console; during a rotation the old and new secret both work for a while. A client can only call from its allowed addresses, and ten wrong secrets in a row lock it for 15 minutes.

POST/oauth/tokengrant_type=client_credentials, optional scope
GET/api/v1/meyour client, its scopes and limits, today's counts
ScopeLets the client
templates:readRead its data pages and their fields
credentials:issueIssue credentials
credentials:readRead the records of credentials it issued
credentials:revokeRevoke credentials it issued

Data pages

GET/api/v1/templatesneeds templates:read
GET/api/v1/templates/{template}one data page

Each data page your client may use, at its live version: its fields (key, label, type, whether required, longest value, choices, pattern), where the document number and issuing officer come from, the validity it allows, and the size of the largest code it can make.

Issue a credential

POST/api/v1/credentialsneeds credentials:issue
HeaderValue
AuthorizationBearer and the token
Idempotency-KeyRequired: a new value for each credential, such as a UUID. A retry with the same key and body returns the first answer, marked Idempotent-Replayed: true, and never issues twice. Kept for 24 hours.
Content-Typeapplication/json
Body fieldTypeMeaning
templatestring, requiredThe data page's template id, such as certificate-of-enrolment
versionintegerRefuse unless this version is live (409), so a changed data page cannot surprise you
fieldsobjectOne value per field key. Text at most the field's longest, never over 96 characters; dates as YYYY-MM-DD, written for the apps as the data page says.
doc_numberstringRequired when the data page takes the document number from the request; at most 40 characters
external_refstringYour own ID for the record, at most 128 characters. Not in the code. No personal data here.
valid_daysintegerFrom 1 to the data page's longest; its default if left out
officestringThe code of one of your issuing offices, for "Issuing office"
operatorstringThe issuing officer, when the data page takes it from the request; at most 60 characters
document_sha256string64 hex characters: the SHA-256 of your printed file, to bind the credential to it
render.formatsarraysvg and/or png, drawn for you in the right QR mode
render.module_pxintegerPixels a module in the drawing, 1 to 20 (default 4)

The service does not keep the field values or the QR code. Store the code in your own document system if you need it again.

Check and revoke

GET/api/v1/credentials/{id}status, dates and data page; never the field values
GET/api/v1/credentials?status=signed&external_ref=SIS-88412filters: status, template, external_ref, issued_after; page with next_cursor
POST/api/v1/credentials/{id}/revokebody: an optional reason; safe to repeat

A client reads and revokes the credentials it issued; another client's, or another organization's, is not found. Phones learn of a revocation from the site's signed feed within 24 hours, and at their next sync. A phone that has not heard yet still shows the credential as valid, so revoke as soon as you know.

Errors

Errors are application/problem+json with a code you can act on and a request_id to quote to support. Field errors name each field and the rule it broke in fields. They never repeat the values you sent. /oauth/token answers as OAuth 2.0 says: error and error_description.

StatuscodeWhat to do
400idempotency_key_required, invalid_jsonFix the request
401invalid_tokenGet a new token
403insufficient_scope, address_not_allowedChange the client's settings in the console
404no_template, not_foundCheck the template id or credential id, and the client's data pages
409request_in_progress, version_not_liveRetry shortly with the same key; or read the template again
422invalid_fields, too_large, bad_validity, bad_doc_number, unknown_parameter, idempotency_key_reusedFix the request
429rate_limited, client_quota, organization_quota, site_quotaWait for the Retry-After seconds
503signing_paused, signer_unavailableRetry later with the same Idempotency-Key

Limits

Each client has a rate a minute (120 unless the organization sets another) and may have a daily credential quota of its own; every client shares the organization's daily quota. A refusal is a 429 with Retry-After. The token endpoint allows 30 requests a minute from one address.

  • Encode qr.text exactly, in alphanumeric mode. Byte mode wastes about 45% of the code's room, and many libraries default to it.
  • Use error correction level Q, and do not let your library raise it: that makes the code larger.
  • Print at least qr.min_stamp_mm wide: no module smaller than 0.4 mm, with a clear margin of 4 modules around it.
  • Text before CL03: is ignored by the apps, so a prefix of your own does no harm, but it does make the code bigger.

Phones and apps

Verifiers check credentials with OVX or VerifyX, paired with ov.x.trl.ph from the console's Phones page. It works without a connection. Restricted-tier phones show the data page's verified details; other phones show the header and whether the credential is genuine.