CL03 Issuer API
Version 1Issue 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
- Create an API client in the console, and store its secret.
- Get a token:
POST /oauth/tokenwith the client ID and secret. - See your data pages:
GET /api/v1/templates. - Issue:
POST /api/v1/credentialswith a data page and its fields. - 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.
/oauth/tokengrant_type=client_credentials, optional scope/api/v1/meyour client, its scopes and limits, today's counts| Scope | Lets the client |
|---|---|
| templates:read | Read its data pages and their fields |
| credentials:issue | Issue credentials |
| credentials:read | Read the records of credentials it issued |
| credentials:revoke | Revoke credentials it issued |
Data pages
/api/v1/templatesneeds templates:read/api/v1/templates/{template}one data pageEach 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
/api/v1/credentialsneeds credentials:issue| Header | Value |
|---|---|
| Authorization | Bearer and the token |
| Idempotency-Key | Required: 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-Type | application/json |
| Body field | Type | Meaning |
|---|---|---|
| template | string, required | The data page's template id, such as certificate-of-enrolment |
| version | integer | Refuse unless this version is live (409), so a changed data page cannot surprise you |
| fields | object | One 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_number | string | Required when the data page takes the document number from the request; at most 40 characters |
| external_ref | string | Your own ID for the record, at most 128 characters. Not in the code. No personal data here. |
| valid_days | integer | From 1 to the data page's longest; its default if left out |
| office | string | The code of one of your issuing offices, for "Issuing office" |
| operator | string | The issuing officer, when the data page takes it from the request; at most 60 characters |
| document_sha256 | string | 64 hex characters: the SHA-256 of your printed file, to bind the credential to it |
| render.formats | array | svg and/or png, drawn for you in the right QR mode |
| render.module_px | integer | Pixels 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
/api/v1/credentials/{id}status, dates and data page; never the field values/api/v1/credentials?status=signed&external_ref=SIS-88412filters: status, template, external_ref, issued_after; page with next_cursor/api/v1/credentials/{id}/revokebody: an optional reason; safe to repeatA 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.
| Status | code | What to do |
|---|---|---|
| 400 | idempotency_key_required, invalid_json | Fix the request |
| 401 | invalid_token | Get a new token |
| 403 | insufficient_scope, address_not_allowed | Change the client's settings in the console |
| 404 | no_template, not_found | Check the template id or credential id, and the client's data pages |
| 409 | request_in_progress, version_not_live | Retry shortly with the same key; or read the template again |
| 422 | invalid_fields, too_large, bad_validity, bad_doc_number, unknown_parameter, idempotency_key_reused | Fix the request |
| 429 | rate_limited, client_quota, organization_quota, site_quota | Wait for the Retry-After seconds |
| 503 | signing_paused, signer_unavailable | Retry 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.
Printing the QR code
- Encode
qr.textexactly, 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_mmwide: 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.