Disco Docs
Search
K

⚡️ Quickstart Guide

Takes 5 minutes!

Prerequisites

You will need an API Key and any library or app capable of making http requests (Postman, Fetch, Axios, Httpie, etc)

Get started with Disco in only three steps:

  1. 1.
    Get an API key
  2. 2.
    Select a credential schema
  3. 3.
    Build and issue credential(s)

Introduction

The Disco API enables developers to issue Verifiable Credentials to addresses and to fetch and validate credentials about those addresses. These credentials use standard data models (schemas), contain event metadata or attestations, and can be later fetched and relied upon to bootstrap onboarding, manage access control, and understand community insights.

Prerequisites

You will need to create an API key, steps to create one:
  1. 1.
    Create a test account in our dashboard https://dashboard.disco.xyz/login
  2. 2.
    Go to the Admin section and click on API Keys
  3. 3.
    Create an API Key
Create API Key
Video and more details are found in Generate an API Key section.

Select a Credential Schema

Schemas define the structure and contents of a credential – enabling them to be consistent, verifiable, and interoperable. More details in Schemas 101. View Disco's public Github repository of schemas.
The directions below use the Membership Credential schema.
Always use Schemas raw files, example.

How to use the API to Build and Issue or Fetch credentials

This method constructs a Membership Credential Schema, signed by Disco-controlled keys.

Issue Credentials

Generate and issue credentials to an ETH address or Decentralized Identifier (DID).
post
/v1/credential
Programmatically issue one verifiable credential

Generate and return a signed Credential. This will also write the Credential the recipient's data backpack in Disco's Verifiable Data Registry. The JSON body should contain required Credential values for the schema type used. Available schemas and their specifications can be found at https://github.com/discoxyz/disco-schemas.

Parameters
No parameters
Body
Example
Schema
{
"schemaUrl": "https://raw.githubusercontent.com/discoxyz/disco-schemas/main/json/MembershipCredential/1-0-0.json",
"recipientDID": "did:3:Example987xyz",
"subjectData": "{\n \"memberId\": \"Goldstar Member\",\n \"membershipDescription\": \"Demo membership to showcase Disco API\",\n \"membershipLevel\": \"Permanent\",\n \"membershipType\": \"Developer\",\n \"organization\": \"Disco.xyz\"\n }",
"expirationDate": "",
"suite": "",
"issuer": "did:web:api.disco.xyz/v1/disco",
"skipSign": "false"
}
Responses
200: OK
Success
401: Unauthorized
Unauthorized
500: Internal Server Error
Credential not created function captureStackTrace() { [native code] }

Usage example

Curl
JavaScript
1
curl --location 'https://api.disco.xyz/v1/credential' \
2
--header 'Content-Type: application/json' \
3
--header 'Accept: */*' \
4
--header 'Authorization: Bearer <your Disco API key>' \
5
--data '{
6
"issuer": "did:3:123abcexample",
7
"schemaUrl": "https://raw.githubusercontent.com/discoxyz/disco-schemas/main/json/MembershipCredential/1-0-0.json",
8
"recipientDID": "did:3:456defexample",
9
"subjectData": {
10
"memberId": "123XYZ",
11
"membershipDescription": "Demo membership to showcase Disco API",
12
"membershipLevel": "Permanent",
13
"membershipType": "Developer",
14
"organization": "Disco.xyz"
15
},
16
"expirationDate": ""
17
}'
1
var myHeaders = new Headers();
2
myHeaders.append("Content-Type", "application/json");
3
myHeaders.append("Accept", "*/*");
4
myHeaders.append("Authorization", "Bearer <your Disco API key>");
5
6
var raw = JSON.stringify({
7
"issuer": "did:3:123abcexample",
8
"schemaUrl": "https://raw.githubusercontent.com/discoxyz/disco-schemas/main/json/MembershipCredential/1-0-0.json",
9
"recipientDID": "did:3:456defexample",
10
"subjectData": {
11
"memberId": "123XYZ",
12
"membershipDescription": "Demo membership to showcase Disco API",
13
"membershipLevel": "Permanent",
14
"membershipType": "Developer",
15
"organization": "Disco.xyz"
16
},
17
"expirationDate": ""
18
});
19
20
var requestOptions = {
21
method: 'POST',
22
headers: myHeaders,
23
body: raw,
24
redirect: 'follow'
25
};
26
27
fetch("https://api.disco.xyz/v1/credential", requestOptions)
28
.then(response => response.text())
29
.then(result => console.log(result))
30
.catch(error => console.log('error', error));

Successful Response

Response
{
"vc": {
"@context": [
"https://www.w3.org/2018/credentials/v1"
],
"type": [
"VerifiableCredential",
"MembershipCredential"
],
"issuer": {
"id": "did:3:123abcexample"
},
"issuanceDate": "2023-10-10T12:53:15.718Z",
"id": "https://api.disco.xyz/credential/5c7cca5e-56ab-4e08-87f6-817e9f89f507",
"credentialSubject": {
"id": "did:3:456defexample",
"memberId": "123XYZ",
"membershipDescription": "Demo membership to showcase Disco API",
"membershipLevel": "Permanent",
"membershipType": "Developer",
"organization": "Disco.xyz"
},
"credentialSchema": {
"id": "https://raw.githubusercontent.com/discoxyz/disco-schemas/main/json/MembershipCredential/1-0-0.json",
"type": "JsonSchemaValidator2018"
},
"proof": {
"verificationMethod": "did:3:kjzl6cwe1jw14a7u9sx3thx9gg9uh7u5tqjkzcnr5pi5zzkap7kiztgsfhzayzt#controller",
"created": "2023-10-10T12:53:15.745Z",
"proofPurpose": "assertionMethod",
"type": "EthereumEip712Signature2021",
"proofValue": "0x487aa8ad7c90aa34a108b52cd7e23c5ef6cf9cfbdc01d7741d70d6b8f79763dc65df429e558af4c2d7a54c7f4040cf874ecffa95f17d87d8dc07823b23324bfe1b",
"eip712Domain": {
"domain": {
"chainId": 1,
"name": "Disco Verifiable Credential",
"version": "1"
},
"messageSchema": {
"EIP712Domain": [
{
"name": "name",
"type": "string"
},
{
"name": "version",
"type": "string"
},
{
"name": "chainId",
"type": "uint256"
}
],
"Proof": [
{
"name": "created",
"type": "string"
},
{
"name": "proofPurpose",
"type": "string"
},
{
"name": "type",
"type": "string"
},
{
"name": "verificationMethod",
"type": "string"
}
],
"Issuer": [
{
"name": "id",
"type": "string"
}
],
"CredentialSubject": [
{
"name": "id",
"type": "string"
},
{
"name": "organization",
"type": "string"
}
],
"VerifiableCredential": [
{
"name": "@context",
"type": "string[]"
},
{
"name": "credentialSubject",
"type": "CredentialSubject"
},
{
"name": "id",
"type": "string"
},
{
"name": "issuanceDate",
"type": "string"
},
{
"name": "issuer",
"type": "Issuer"
},
{
"name": "proof",
"type": "Proof"
},
{
"name": "type",
"type": "string[]"
}
]
},
"primaryType": "VerifiableCredential"
}
}
},
"isPublic": false,
"issuer": "did:3:123abcexample",
"recipient": "did:3:456defexample",
"subject": "did:3:456defexample",
"schema": "https://raw.githubusercontent.com/discoxyz/disco-schemas/main/json/MembershipCredential/1-0-0.json",
"isDeleted": false,
"genId": "a4282add-ed1f-429d-a80d-abdd675b2eef",
"updatedAt": "2023-10-10T12:53:15.748Z",
"history": [],
"_id": "6525493bb8ffec6244182e03"
}

Fetch Credentials

Fetch a public credential based on its ID
get
/v1/credential/{id}
Returns a single credential using its `vc.id`

Returns a single credential using its verifiable credential ID (vc.id) - assuming the Api Key holder is either the holder, issuer or the Credential is public.

Parameters
Path
id*
string
Unique ID of Credential
Responses
200: OK
A Verifiable Credential document
401: Unauthorized
Unauthorized
403: Forbidden
Forbidden
404: Not Found
Endpoint Not found

Usage example

Curl
JavaScript
# Looking up id=https://api.disco.xyz/credential/22d9187b-8a33-4e17-b05f-c8192107ab28
curl --location 'https://api.disco.xyz/v1/credential/https%3A%2F%2Fapi.disco.xyz%2Fcredential%2F22d9187b-8a33-4e17-b05f-c8192107ab28' \
--header 'Authorization: Bearer <your Disco API key>'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer <your Disco API key>");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.disco.xyz/v1/credential/https%3A%2F%2Fapi.disco.xyz%2Fcredential%2F3f929a36-8e1c-46c1-9981-120b43241c13", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Successful response

Response
1
{
2
"_id": "65099e2e52bf698c21aeeb91",
3
"vc": {
4
"@context": [
5
"https://www.w3.org/2018/credentials/v1"
6
],
7
"type": [
8
"VerifiableCredential",
9
"MembershipCredential"
10
],
11
"issuer": {
12
"id": "did:3:kjzl6cwe1jw14a7u9sx3thx9gg9uh7u5tqjkzcnr5pi5zzkap7kiztgsfhzayzt"
13
},
14
"issuanceDate": "2023-09-19T13:12:14.801Z",
15
"id": "https://api.disco.xyz/credential/22d9187b-8a33-4e17-b05f-c8192107ab28",
16
"credentialSubject": {
17
"id": "did:ethr:0x08936438bfb8e9b269f978d5327ad684f47f8c05",
18
"organization": "House of Leroy"
19
},
20
"expirationDate": "2024-08-29T00:00:00.000Z",
21
"credentialSchema": {
22
"id": "https://raw.githubusercontent.com/discoxyz/disco-schemas/main/json/MembershipCredential/1-0-0.json",
23
"type": "JsonSchemaValidator2018"
24
},
25
"proof": {
26
"verificationMethod": "did:3:kjzl6cwe1jw14a7u9sx3thx9gg9uh7u5tqjkzcnr5pi5zzkap7kiztgsfhzayzt#controller",
27
"created": "2023-09-19T13:12:14.827Z",
28
"proofPurpose": "assertionMethod",
29
"type": "EthereumEip712Signature2021",
30
"proofValue": "0x3aa89255fe63d7ca70c43b0603aa3d004978bc0815b35ae5dcbf84a3df4867f133b6f0d717916cf84b8f6b3dcbf6a7643f18fa00557c0ddb5f5571cc8f678d291c",
31
"eip712Domain": {
32
"domain": {
33
"chainId": 1,
34
"name": "Disco Verifiable Credential",
35
"version": "1"
36
},
37
"messageSchema": {
38
"EIP712Domain": [
39
{
40
"name": "name",
41
"type": "string"
42
},
43
{
44
"name": "version",
45
"type": "string"
46
},
47
{
48
"name": "chainId",
49
"type": "uint256"
50
}
51
],
52
"Proof": [
53
{
54
"name": "created",
55
"type": "string"
56
},
57
{
58
"name": "proofPurpose",
59
"type": "string"
60
},
61
{
62
"name": "type",
63
"type": "string"
64
},
65
{
66
"name": "verificationMethod",
67
"type": "string"
68
}
69
],
70
"Issuer": [
71
{
72
"name": "id",
73
"type": "string"
74
}
75
],
76
"CredentialSubject": [
77
{
78
"name": "id",
79
"type": "string"
80
},
81
{
82
"name": "organization",
83
"type": "string"
84
}
85
],
86
"VerifiableCredential": [
87
{
88
"name": "@context",
89
"type": "string[]"
90
},
91
{
92
"name": "credentialSubject",
93
"type": "CredentialSubject"
94
},
95
{
96
"name": "id",
97
"type": "string"
98
},
99
{
100
"name": "issuanceDate",
101
"type": "string"
102
},
103
{
104
"name": "issuer",
105
"type": "Issuer"
106
},
107
{
108
"name": "proof",
109
"type": "Proof"
110
},
111
{
112
"name": "type",
113
"type": "string[]"
114
}
115
]
116
},
117
"primaryType": "VerifiableCredential"
118
}
119
}
120
},
121
"isPublic": true,
122
"issuer": "did:3:kjzl6cwe1jw14a7u9sx3thx9gg9uh7u5tqjkzcnr5pi5zzkap7kiztgsfhzayzt",
123
"recipient": "did:ethr:0x08936438bfb8e9B269F978D5327Ad684f47F8C05",
124
"subject": "did:ethr:0x08936438bfb8e9B269F978D5327Ad684f47F8C05",
125
"schema": "https://raw.githubusercontent.com/discoxyz/disco-schemas/main/json/MembershipCredential/1-0-0.json",
126
"isDeleted": false,
127
"genId": "9af80795-09f5-48a7-abd7-d713a8cd2447",
128
"updatedAt": "2023-09-20T18:34:29.629Z",
129
"history": [
130
"{\"field\":\"isPublic\",\"oldValue\":false,\"newValue\":true,\"updatedAt\":\"2023-09-20T18:34:29.629Z\"}"
131
]
132
}

Community and Support

Join our Discord! You can also contact us at [email protected].