Skip to Content
CerebrumDocs
GuidesAPI referenceTrust & security

Create Credential

Related workflow: Working with Beams and credentials

POST
/v1/credential

Create a new W3C verifiable credential for a user's submitted input.

Behavior

  • After storing the input, the handler checks five times at 100 ms intervals for a credential created from it, then responds.
  • input is not validated against the beam input type's schema by this handler.

Related: Get Credential · Get Credential Status

Authorization

apiKey
headerapikey<token>

Request Body

application/json
  1. body
inputTypeId*string

The id of the beam input type

userId*string

The id of the user the credential should be issued to

input*object

The data used to generate the credential, this should match the schema in the beam input type.

Response Body

Beam input recorded. credentialId is the credential produced from it, or null if none existed when the handler stopped waiting.

application/json
  1. response
inputId*string

The id of the beam input that was created

credentialId*string|null

The id of the created Credential if it is immediately available. Note that this depends on the beam processor used to generate the credential.

Example Request
curl -X POST 'https://api.cerebrum.com/v1/credential' \  -H 'apikey: CEREBRUM_API_KEY' \  -H 'Content-Type: application/json' \  -d '{  "inputTypeId": "f5f08fd9-435d-49ce-85d7-ccc748dddce0",  "userId": "ee5da20d-e610-4039-8fc6-00885a49cfdb",  "input": {    "id": "did:example:1234",    "name": "John Doe",    "birthdate": "1990-01-01",    "idDocument": {      "type": "Passport",      "number": "X12345678",      "country": "US",      "expiryDate": "2030-12-31"    },    "selfie": {      "type": "ImageObject",      "contentUrl": "https://www.cerebrum.com/images/user_id/selfie.jpg",      "encodingFormat": "image/jpeg"    },    "facialVerification": {      "type": "FacialVerificationResult",      "status": "verified",      "confidence": 99    }  }}'
Example Response
{  "inputId": "string",  "credentialId": "string"}