πŸš€Build & Issue Credentials

Construct, and then Issue (Sign and Store) Credentials

Process Flow for Issuance

Process Flow

Disco's API End-point

GET/POST
Host: https://api.disco.xyz/v1/<API>
Authorization: Bearer <your API key>

Single Credential Issuance

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

{
    "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"
}

Batch Credential Issuance

Programmatically issue multiple Verifiable Credentials, aka batch issuance

post

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

Authorizations
Body

IssueCredentialsRequest

issuerstringOptional

The DID of the Credential issuer

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

The Credential schema

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

Signing suite. Use JWT or 712

Example: jwt
subjectsarrayOptional

One or more Credential recipient DIDs

Example: [ { "subject": { "id": "did:3:abc123" }, "recipient": "did:3:abc123", "expirationDate": "" } ]
Responses
200
Returns and store a collection of Verifiable Credential Documents
application/json
post
POST /v1/credentials HTTP/1.1
Host: 
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 316

{
  "issuer": "did:web:api.disco.xyz/v1/disco",
  "schema": "https://raw.githubusercontent.com/discoxyz/disco-schemas/main/json/GMCredential/1-0-0.json",
  "suite": "jwt",
  "subjects": "[\n        { \"subject\": { \"id\": \"did:3:abc123\" },\n          \"recipient\": \"did:3:abc123\",\n         \"expirationDate\": \"\" }\n    ]"
}
{
  "_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/credentials' \
--header 'Content-Type: application/json' \
--header 'Accept: */*' \
--header 'Authorization: Bearer <your Disco API key>' \
--data '{
  "issuer": "did:3:123abcexample",
  "schema": "https://raw.githubusercontent.com/discoxyz/disco-schemas/main/json/GMCredential/1-0-0.json",
  "suite": "jwt",
  "subjects": [
    {
      "subject": {
        "id": "did:3:456defexample"
      },
      "recipient": "did:3:456defexample",
      "expirationDate": ""
    },
    {
      "subject": {
        "id": "did:3:789ghiexample"
      },
      "recipient": "789ghiexample",
      "expirationDate": ""
    }
  ]
}'

Successful Response

[
    {
        "vc": {
            "@context": [
                "https://www.w3.org/2018/credentials/v1"
            ],
            "type": [
                "VerifiableCredential",
                "GmCredential"
            ],
            "issuer": {
                "id": "did:3:123abcexample"
            },
            "issuanceDate": "2023-10-10T14:11:38.056Z",
            "id": "https://api.disco.xyz/credential/9c65e3d4-4232-4129-9681-3004b94ceaa1",
            "credentialSubject": {
                "id": "did:3:456defexample"
            },
            "credentialSchema": {
                "id": "https://raw.githubusercontent.com/discoxyz/disco-schemas/main/json/GMCredential/1-0-0.json",
                "type": "JsonSchemaValidator2018"
            }
        },
        "isPublic": false,
        "issuer": "did:3:123abcexample",
        "recipient": "did:3:456defexample",
        "subject": "did:3:456defexample",
        "schema": "https://raw.githubusercontent.com/discoxyz/disco-schemas/main/json/GMCredential/1-0-0.json",
        "isDeleted": false,
        "genId": "64ca2748-2f19-42c2-9108-b392b9861d8e",
        "updatedAt": "2023-10-10T14:11:38.056Z",
        "history": [],
        "jwt": "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2Y ... 3kA7BMNbns6vA",
        "_id": "65255b9ab8ffec6244182e04"
    },
    {
        "vc": {
            "@context": [
                "https://www.w3.org/2018/credentials/v1"
            ],
            "type": [
                "VerifiableCredential",
                "GmCredential"
            ],
            "issuer": {
                "id": "did:3:123abcexample"
            },
            "issuanceDate": "2023-10-10T14:11:38.063Z",
            "id": "https://api.disco.xyz/credential/28facd33-f7cf-45f9-b1da-da9d08a45f20",
            "credentialSubject": {
                "id": "did:3:789ghiexample"
            },
            "credentialSchema": {
                "id": "https://raw.githubusercontent.com/discoxyz/disco-schemas/main/json/GMCredential/1-0-0.json",
                "type": "JsonSchemaValidator2018"
            }
        },
        "isPublic": false,
        "issuer": "did:3:123abcexample",
        "recipient": "did:3:789ghiexample",
        "subject": "did:3:789ghiexample",
        "schema": "https://raw.githubusercontent.com/discoxyz/disco-schemas/main/json/GMCredential/1-0-0.json",
        "isDeleted": false,
        "genId": "84748837-7f5d-4b6c-9267-b75a3155c145",
        "updatedAt": "2023-10-10T14:11:38.063Z",
        "history": [],
        "jwt": "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1 ... EVVcpKy4Hrrx-3_jcnzteLqFPIO7xA",
        "_id": "65255b9ab8ffec6244182e05"
    }
]

Last updated