Skip to main content
@timeback/clr and timeback-clr wrap the authenticated CLR v2.0 API. The client exposes credentials.upsert() and discovery.get().

Install

Credential contract

credentials.upsert() sends POST /ims/clr/v2p0/credentials/. The receiver creates or updates a record identified by credential id and issuer id, returning the stored credential with HTTP 201 or 200. This path does not add a signature, verify a supplied proof, or aggregate a student’s records automatically. The receiver requires:
  • Three ordered contexts: W3C credentials v2, CLR v2, then Open Badges v3.
  • type containing both VerifiableCredential and ClrCredential.
  • An issuer profile, credential name, URI identifier and ISO date in validFrom.
  • A ClrSubject with at least one nested verifiableCredential.
  • At least one top-level credentialSubject.achievement. This is an additional receiver requirement: an achievement nested only inside a child credential is insufficient. Each achievement needs an ID, type, name, description and criteria.
Optional email identity entries are resolved to a Timeback student; an unknown email fails the request. Existing proofs are data in this upsert path, not evidence that this endpoint verified or issued the credential.

Example

This example illustrates the accepted structure. Replace the sample issuer, learner, achievement and credential records with your own authorized records before submitting.
credential.json
TypeScript validates the input with Zod; Python validates and serializes its input model. The receiver validates again. Successful client validation alone does not satisfy the receiver’s achievement requirement.

Discovery and composition

discovery.get() calls the authenticated discovery endpoint and returns its OpenAPI document. Route descriptions may describe intended capabilities; credential signing is not implemented by the reviewed upsert handler. The same resources are available through timeback.clr on the Core client. Standalone configuration supports environment mode, explicit base/auth URLs, or a shared TimebackProvider; the optional request timeout is milliseconds in TypeScript and seconds in Python.

Errors

Input validation errors can occur before a request; HTTP error handling is separate. Check the response and your stored record rather than assuming an upsert produced a signed credential.