> For the complete documentation index, see [llms.txt](https://docs.teranode.group/tng-identity-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.teranode.group/tng-identity-documentation/tng-identity-issuers/issuer-api/api-documentation/claim.md).

# Claim

## Claim credential

> Claim specific credential. User has to pass authorization token in header and data in request body.\
> \`authorization\` header has to contain \`Bearer\` and token returned from previous token endpoint.\
> In request body user has to pass \`types\` array with type of credential being claimed, \`format\` string with format of the credential,\
> and \`proof\` object with \`proof\_type\` string and \`jwt\` string. \`proof\_type\` is a string that represents the type of the proof, which is in our case \`jwt\`.\
> \`jwt\` is a string that represents the JWT token which is generated by wallet and acts as a proof of posession JWT. If successful, the server returns\
> an object with \`credential\`, \`format\`, \`c\_nonce\` and \`c\_nonce\_expires\_in\` properties. \`credential\` is a string that represents the JWT token which contains\
> all the details about the claimed credential. \`format\` is a string that represents the format of the credential. \`c\_nonce\` is a string that \
> represents c-nonce and \`c\_nonce\_expires\_in\` is a number that represents the expiration time of the c-nonce in seconds.\
> \<hr /> If the API is NOT running in DEMO MODE, note that the resources must be creating using \<b>POST /private/credential-offers\</b> otherwise it will return errors

```json
{"openapi":"3.0.0","info":{"title":"Identity Issuer Backend Documentation","version":"dev"},"servers":[{"url":"{hostname}","description":"Issuer Backend REST API Server","variables":{"hostname":{"default":"https://identity.nchainplatform.com/products/web/$IDENTITY_ENV_ID/issuer/api"}}}],"paths":{"/public/{correlationId}/credentials":{"post":{"operationId":"AgentPublicCredentialController_credential","summary":"Claim credential","description":"Claim specific credential. User has to pass authorization token in header and data in request body.\n`authorization` header has to contain `Bearer` and token returned from previous token endpoint.\nIn request body user has to pass `types` array with type of credential being claimed, `format` string with format of the credential,\nand `proof` object with `proof_type` string and `jwt` string. `proof_type` is a string that represents the type of the proof, which is in our case `jwt`.\n`jwt` is a string that represents the JWT token which is generated by wallet and acts as a proof of posession JWT. If successful, the server returns\nan object with `credential`, `format`, `c_nonce` and `c_nonce_expires_in` properties. `credential` is a string that represents the JWT token which contains\nall the details about the claimed credential. `format` is a string that represents the format of the credential. `c_nonce` is a string that \nrepresents c-nonce and `c_nonce_expires_in` is a number that represents the expiration time of the c-nonce in seconds.\n<hr /> If the API is NOT running in DEMO MODE, note that the resources must be creating using <b>POST /private/credential-offers</b> otherwise it will return errors","parameters":[{"name":"correlationId","required":true,"in":"path","description":"Defines a organisation which is defined as a correlationId. Must be a value the Issuer is working with! ","schema":{"type":"string"}},{"name":"Authorization","in":"header","description":"Authorization retrieved from token endpoint","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CorrelationCredentialBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CorrelationCredentialDetailDto"}}}},"503":{"description":"The service is unavailable"}},"tags":["Claim"]}}},"components":{"schemas":{"CorrelationCredentialBodyDto":{"type":"object","properties":{"format":{"type":"string","description":"The format of the credential we choose when issuing."},"credential_definition":{"description":"Credential definition metadata","allOf":[{"$ref":"#/components/schemas/CorrelationCredentialDefinitionDto"}]},"proof":{"description":"Credential proof","allOf":[{"$ref":"#/components/schemas/CorrelationCredentialProofDto"}]}},"required":["format","credential_definition","proof"]},"CorrelationCredentialDefinitionDto":{"type":"object","properties":{"type":{"description":"Credential definition types","type":"array","items":{"type":"string"}},"credentialSubject":{"type":"object","description":"Credential definition subjects"}},"required":["type","credentialSubject"]},"CorrelationCredentialProofDto":{"type":"object","properties":{"proof_type":{"type":"string","description":"The type of the proof we choose when issuing."},"jwt":{"type":"string","description":"The JWT token which is generated by wallet and acts as a proof of possession JWT."}},"required":["proof_type","jwt"]},"CorrelationCredentialDetailDto":{"type":"object","properties":{"credential":{"type":"string","description":"JWT token which contains all the details about the claimed credential."},"format":{"type":"string","description":"The format of the credential."},"c_nonce":{"type":"string","description":"String representing c-nonce."},"c_nonce_expires_in":{"type":"number","description":"Number representing the expiration time of the c-nonce in seconds."}},"required":["credential","format","c_nonce","c_nonce_expires_in"]}}}}
```

## Get access token to start the credential issuance.

> Before claiming the credential, the user has to get an access token. This endpoint facilitates the retrieval \
> of an access token with the provided \`client\_id\`, \`grant\_type\` and \`pre-authorized\_code\`. The \`client\_id\` is\
> a string that represents the client ID. The \`grant\_type\` is a string that represents the grant type, which is in our case\
> \`urn:ietf:params:oauth:grant-type:pre-authorized\_code\`. The \`pre-authorized\_code\` is a string that represents the pre-authorized code,\
> which is generated by the web client when creating an offer. If successful, the server returns an object with \`access\_token\`, \`token\_type\`,\
> \`expires\_in\`, \`c\_nonce\`, \`c\_nonce\_expires\_in\`, \`authorization\_pending\` and \`interval\` properties. \`access\_token\` is a string that represents\
> the access token. \`token\_type\` is a string that represents the token type (bearer in our case). \`expires\_in\` is a number that represents the\
> expiration time of the token in seconds. \`c\_nonce\` is a string that represents the c-nonce. \`c\_nonce\_expires\_in\` is a number that represents\
> the expiration time of the c-nonce in seconds. \`authorization\_pending\` is a boolean that indicates if the authorization is pending\
> (not used in our case). \`interval\` is a number that represents the interval in milliseconds.\
> \<hr /> If the API is NOT running in DEMO MODE, note that the resources must be creating using \<b>POST /private/credential-offers\</b> otherwise it will return errors

```json
{"openapi":"3.0.0","info":{"title":"Identity Issuer Backend Documentation","version":"dev"},"servers":[{"url":"{hostname}","description":"Issuer Backend REST API Server","variables":{"hostname":{"default":"https://identity.nchainplatform.com/products/web/$IDENTITY_ENV_ID/issuer/api"}}}],"paths":{"/public/{correlationId}/token":{"post":{"operationId":"AgentPublicTokenController_token","summary":"Get access token to start the credential issuance.","description":"Before claiming the credential, the user has to get an access token. This endpoint facilitates the retrieval \nof an access token with the provided `client_id`, `grant_type` and `pre-authorized_code`. The `client_id` is\na string that represents the client ID. The `grant_type` is a string that represents the grant type, which is in our case\n`urn:ietf:params:oauth:grant-type:pre-authorized_code`. The `pre-authorized_code` is a string that represents the pre-authorized code,\nwhich is generated by the web client when creating an offer. If successful, the server returns an object with `access_token`, `token_type`,\n`expires_in`, `c_nonce`, `c_nonce_expires_in`, `authorization_pending` and `interval` properties. `access_token` is a string that represents\nthe access token. `token_type` is a string that represents the token type (bearer in our case). `expires_in` is a number that represents the\nexpiration time of the token in seconds. `c_nonce` is a string that represents the c-nonce. `c_nonce_expires_in` is a number that represents\nthe expiration time of the c-nonce in seconds. `authorization_pending` is a boolean that indicates if the authorization is pending\n(not used in our case). `interval` is a number that represents the interval in milliseconds.\n<hr /> If the API is NOT running in DEMO MODE, note that the resources must be creating using <b>POST /private/credential-offers</b> otherwise it will return errors","parameters":[{"name":"correlationId","required":true,"in":"path","description":"Defines a organisation which is defined as a correlationId. Must be a value the Issuer is working with! ","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CorrelationTokenBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CorrelationTokenDetailDto"}}}},"503":{"description":"The service is unavailable"}},"tags":["Claim"]}}},"components":{"schemas":{"CorrelationTokenBodyDto":{"type":"object","properties":{"client_id":{"type":"string","description":"The client ID."},"grant_type":{"type":"string","description":"The grant type to use"},"pre-authorized_code":{"type":"string","description":"Pre Authorized code that references the credential to start token fetching"}},"required":["client_id","grant_type","pre-authorized_code"]},"CorrelationTokenDetailDto":{"type":"object","properties":{"access_token":{"type":"string","description":"String representing access token"},"token_type":{"type":"string","description":"String representing token type"},"c_nonce":{"type":"string","description":"String containing a nonce to be used when creating a proof of possession of the key proof. When received, the Wallet MUST use this nonce value for its subsequent requests until the Credential Issuer provides a fresh nonce."},"c_nonce_expires_in":{"type":"number","description":"Number denoting the lifetime in seconds of the c_nonce."},"authorization_pending":{"type":"boolean","description":"Boolean indicating if the authorization is pending."},"interval":{"type":"number","description":""}},"required":["access_token","token_type","c_nonce","c_nonce_expires_in","authorization_pending","interval"]}}}}
```
