> For the complete documentation index, see [llms.txt](https://docs.sudoplatform.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sudoplatform.com/guides/decentralized-identity/cloud-agent/cloud-agent-admin-api/credentials/anoncreds-credentials/credential-definitions.md).

# Credential Definitions

An Anoncreds credential definition, represented by `AnoncredsCredDef`, enables the cloud agent to issue credentials from a specific Anoncreds [schema](/guides/decentralized-identity/cloud-agent/cloud-agent-admin-api/credentials/anoncreds-credentials/schemas.md).

Anoncreds credential definitions are written to the ledger, and therefore cannot be modified or deleted once created. However, it is possible for multiple credential definitions to reference a single schema.

## Create an Anoncreds credential definition

The cloud agent creates a new `AnoncredsCredDef` and writes it permanently to the ledger. The `schemaId` param references an Anoncreds schema which must be already written to the ledger. The `isRevocable` param determines whether credentials issued using this credential definition can be revoked.

```graphql
mutation MyMutation {
  createAnoncredsCredDef(
    args: {
      schemaId: "Hoh1tsuYFJxqsuJ5vVjxuL:2:MySchema:1.0"
      tag: "MyCredDefTag"
      isRevocable: false
    }
  ) {
    id
  }
}
```

## View Anoncreds credential definitions

View Anoncreds credential definitions which are created by the cloud agent, with pagination and filtering options. Returns a `nextToken` which can be passed into the same query in order to fetch subsequent pages.

The `AnoncredsCredDef` type provides the option to resolve its associated `AnoncredsSchema` within a single operation.

```graphql
query MyQuery {
  anoncredsCredDefs(
    page: {
      nextToken: null
    }
    filter: {}
  ) {
    items {
      id
      schemaId
      schema {
        name
        version
        attributeNames
      }
      tag
      isRevocable
    }
    nextToken
  }
}
```

Alternatively, view a single Anoncreds credential definition, referenced by its unique ID.

```graphql
query MyQuery {
  anoncredsCredDef(
    credDefId: "Hoh1tsuYFJxqsuJ5vVjxuL:3:CL:3050:MyCredDefTag"
  ) {
    id
    schemaId
    schema {
      name
      version
      attributeNames
    }
    tag
    isRevocable
  }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sudoplatform.com/guides/decentralized-identity/cloud-agent/cloud-agent-admin-api/credentials/anoncreds-credentials/credential-definitions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
