Define & add new credentials
The Credential Schema Structure
Before attesting a credential to a user, you must first define its schema.
A credential consists of two parts: a slug name, which serves as a unique identifier, and a list of fields with their corresponding values.
slug
String
A unique and descriptive name for the credential schema.
'monthly_expense'
name
String
A short, human-readable name for the credential
'Monthly expense per category'
description
String
A detailed explanation of the credential, including how it’s calculated and how to interpret it. This helps make the credential self-explanatory.
'The average financial expenses over the 90 days preceding the credential’s generation date, calculated using data from Plaid. This includes transactions from both credit cards and bank accounts'
codeUrl
String
A direct URL to the code snippet used to calculate this credential. This promotes transparency and allows others to verify how the credential was generated. The link can point to a GitHub repository or any other trusted source provider
fields
JSON
A payload for the credential, which includes a list of fields and their corresponding values.
{ "name": "expense", "type": "uint", "description": "the dollar value of the average expense" }
Credential field types
uint
130; 5400
string
'USD'; 'Low Fat Milk'
Credential Limit
Each credential schema can contain up to 12 fields.
Define a New Credential Schema
POST
/api.moojo.id/define-credential
Headers
Content-Type
application/json
x-api-key
Your API KEY as provided by Moojo
Body
slug
string
A unique name of the credential's scheme
fieldDefinitions
Array of objects
An array of fields definition
Request example
Response example
Add a Credential to a User
After defining a credential schema, you can begin adding credentials based on it to users
POST
/api.moojo.id/user/add-credential
Headers
Content-Type
application/json
x-api-key
Your API KEY as provided by Moojo
Body
publicUserId
string
The publicUserId of the user receiving the credential. This ID can be found in the response of the user authentication call.
slug
string
The unique name of the credential to be added, as defined by the scheme.
fields
Object
An object containing all fields defined in the scheme along with their corresponding values. See the example below.
Request example
Response example
Last updated
Was this helpful?