⚡️ 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. Get an API key

  2. Select a credential schema

  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. Create a test account in our dashboard https://dashboard.disco.xyz/login

  2. Go to the Admin section and click on API Keys

  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).

Programmatically issue one verifiable credential

post

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.

Authorizations
Body
schemaUrlstringOptional

The URL of the verifiable crednetial schema. Available schemas can be found at https://github.com/discoxyz/disco-schemas

Example: https://raw.githubusercontent.com/discoxyz/disco-schemas/main/json/MembershipCredential/1-0-0.json
recipientDIDstringOptional

The DID address of the credential's claimant

Example: did:3:Example987xyz
subjectDataobject · subjectDataOptional

The fields and values for the credential (based on its schema)

Example: { "memberId": "Goldstar Member", "membershipDescription": "Demo membership to showcase Disco API", "membershipLevel": "Permanent", "membershipType": "Developer", "organization": "Disco.xyz" }
expirationDatestringOptional

The date for the credential to expire for the claimant. Leave empty if there's no expiration.

suitestringOptional

Optional - supported values are "JWT" and "712".

issuerstringOptional

The DID address of the credential's issuer.

Example: did:web:api.disco.xyz/v1/disco
skipSignbooleanOptional

To sign or not to sign - hint you should sign! Either leave out or assign false.

Example: false
Responses
200
Success
application/json
post
POST /v1/credential HTTP/1.1
Host: 
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 499

{
  "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"
}
{
  "_id": "text",
  "vc": "See https://www.w3.org/TR/vc-data-model/#example-a-simple-example-of-a-verifiable-credential",
  "jwt": "eyJhbGciOiJIUzI1N........",
  "isPublic": "true",
  "issuer": "",
  "recipient": "text",
  "subject": "text",
  "schema": "https://raw.githubusercontent.com/discoxyz/disco-schemas/main/json/MembershipCredential/1-0-0.json",
  "genId": "text",
  "updatedAt": "text",
  "isDeleted": true,
  "history": []
}

Usage example

curl --location 'https://api.disco.xyz/v1/credential' \
--header 'Content-Type: application/json' \
--header 'Accept: */*' \
--header 'Authorization: Bearer <your Disco API key>' \
--data '{
    "issuer": "did:3:123abcexample",
    "schemaUrl": "https://raw.githubusercontent.com/discoxyz/disco-schemas/main/json/MembershipCredential/1-0-0.json",
    "recipientDID": "did:3:456defexample",
    "subjectData": {
        "memberId": "123XYZ",
        "membershipDescription": "Demo membership to showcase Disco API",
        "membershipLevel": "Permanent",
        "membershipType": "Developer",
        "organization": "Disco.xyz"
    },
    "expirationDate": ""
}'

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

Returns a single credential using its `vc.id`

get

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.

Authorizations
Path parameters
idstringRequired

Unique ID of Credential

Example: "did:3:123abcexample#someuuid"
Responses
200
A Verifiable Credential document
application/json
get
GET /v1/credential/{id} HTTP/1.1
Host: 
Authorization: YOUR_API_KEY
Accept: */*
{
  "_id": "text",
  "vc": "See https://www.w3.org/TR/vc-data-model/#example-a-simple-example-of-a-verifiable-credential",
  "jwt": "eyJhbGciOiJIUzI1N........",
  "isPublic": "true",
  "issuer": "",
  "recipient": "text",
  "subject": "text",
  "schema": "https://raw.githubusercontent.com/discoxyz/disco-schemas/main/json/MembershipCredential/1-0-0.json",
  "genId": "text",
  "updatedAt": "text",
  "isDeleted": true,
  "history": []
}

Usage example

# 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>'

Successful response

Response
{
    "_id": "65099e2e52bf698c21aeeb91",
    "vc": {
        "@context": [
            "https://www.w3.org/2018/credentials/v1"
        ],
        "type": [
            "VerifiableCredential",
            "MembershipCredential"
        ],
        "issuer": {
            "id": "did:3:kjzl6cwe1jw14a7u9sx3thx9gg9uh7u5tqjkzcnr5pi5zzkap7kiztgsfhzayzt"
        },
        "issuanceDate": "2023-09-19T13:12:14.801Z",
        "id": "https://api.disco.xyz/credential/22d9187b-8a33-4e17-b05f-c8192107ab28",
        "credentialSubject": {
            "id": "did:ethr:0x08936438bfb8e9b269f978d5327ad684f47f8c05",
            "organization": "House of Leroy"
        },
        "expirationDate": "2024-08-29T00:00:00.000Z",
        "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-09-19T13:12:14.827Z",
            "proofPurpose": "assertionMethod",
            "type": "EthereumEip712Signature2021",
            "proofValue": "0x3aa89255fe63d7ca70c43b0603aa3d004978bc0815b35ae5dcbf84a3df4867f133b6f0d717916cf84b8f6b3dcbf6a7643f18fa00557c0ddb5f5571cc8f678d291c",
            "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": true,
    "issuer": "did:3:kjzl6cwe1jw14a7u9sx3thx9gg9uh7u5tqjkzcnr5pi5zzkap7kiztgsfhzayzt",
    "recipient": "did:ethr:0x08936438bfb8e9B269F978D5327Ad684f47F8C05",
    "subject": "did:ethr:0x08936438bfb8e9B269F978D5327Ad684f47F8C05",
    "schema": "https://raw.githubusercontent.com/discoxyz/disco-schemas/main/json/MembershipCredential/1-0-0.json",
    "isDeleted": false,
    "genId": "9af80795-09f5-48a7-abd7-d713a8cd2447",
    "updatedAt": "2023-09-20T18:34:29.629Z",
    "history": [
        "{\"field\":\"isPublic\",\"oldValue\":false,\"newValue\":true,\"updatedAt\":\"2023-09-20T18:34:29.629Z\"}"
    ]
}

Community and Support

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

Last updated