# Update Token Status List

## Step 1. Manually create your new Status List JWT/CWT and save the file locally

Create a JWT or CWT file with the updated indices and bits for the updated Status List.

<details>

<summary>Non-normative example for a Status List Token in JWT format</summary>

```json
{
  "alg": "ES256",
  "kid": "12",
  "typ": "statuslist+jwt"
}
.
{
  "exp": 2291720170,
  "iat": 1686920170,
  "iss": "https://example.com",
  "status_list": {
    "bits": 3,
    "lst": "eNrbuRgAAhcBXQHutdpRiBFREinSjQfeTpXmdQfwefegD"
  },
  "sub": "https://example.com/statuslists/1"
}
```

</details>

<details>

<summary>Non-normative example for a Status List Token in CWT format (not including the type header yet)</summary>

```json
d28453a20126106e7374617475736c6973742b637774a1044231325860a502782168
747470733a2f2f6578616d706c652e636f6d2f7374617475736c697374732f310173
68747470733a2f2f6578616d706c652e636f6d061a648c5bea041a8898dfea19fffe
56a2646269747301636c73744a78dadbb918000217015d58400f2ca3772e10b09d5d
6ed56461f7cba1a816c6234072d1bb693db277048e5db5a4e64444492a9b781d6c7a
c9714db99cc7aadb3812ec90cab7794170bab5b473
```

</details>

Save this file locally and call it something like `statusListTokenUPDATED.json`

{% hint style="info" %}
Note that each JWT or CWT must be **below \~45kb in size**.
{% endhint %}

## Step 2: Encode the updated file

Prepare a file with resource and encode it into `base64, base64url` or `hex`. On Unix systems, you can use the following command input:

```bash
$ base64 -w 0 resource.json
<path-to-the-resource-file>
```

Expected output:

```bash
$ base64 -w 0 resource.json
HfSynOpmBrhgfYguING
```

## Step 3: Set the same Resource Name and Type

To create a new version you must use the **same "name" and "type"** for your resource, and ensure that the new Token Status List resource is being created **underneath the same DID** as your initial DI&#x44;**.** You will also need to be logged into the same cheqd Studio account that you used to create the initial Token Status List to have access to the keys to sign the update.

For Token Status Lists, the "type" MUST be: **`"TokenStatusList"`.**

For example:

```json
{
    "data": "HfSynOpmBrhgfYguING",
    "encoding": "base64url",
    "name": "DegreeCredentialStatus",
    "type": "TokenStatusList"
}
```

## Step 4: Populate the request inputs and hit the API

## Create a DID-Linked Resource.

> This endpoint creates a DID-Linked Resource. As input, it can take the DID identifier and the resource parameters via a form, or the fully-assembled resource itself.

```json
{"openapi":"3.0.0","info":{"title":"cheqd Studio API for cheqd network","version":"2.0.0"},"tags":[{"name":"DID-Linked Resources (DLRs)"}],"servers":[{"url":"https://studio-api.cheqd.net","description":"Main (production) server"},{"url":"https://studio-api-staging.cheqd.net","description":"Staging server for testing"},{"url":"http://localhost:3000","description":"Local server for testing"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","name":"x-api-key","in":"header"}},"schemas":{"CreateResourceRequest":{"description":"Input fields for DID-Linked Resource creation.","type":"object","additionalProperties":false,"required":["name","type","data","encoding"],"properties":{"data":{"description":"Encoded string containing the data to be stored in the DID-Linked Resource.","type":"string"},"encoding":{"description":"Encoding format used to encode the data.","type":"string","enum":["base64url","base64","hex"]},"name":{"description":"Name of DID-Linked Resource.","type":"string"},"type":{"description":"Type of DID-Linked Resource. This is NOT the same as the media type, which is calculated automatically ledger-side.","type":"string"},"alsoKnownAs":{"description":"Optional field to assign a set of alternative URIs where the DID-Linked Resource can be fetched from.","type":"array","items":{"type":"object","properties":{"uri":{"type":"string"},"description":{"type":"string"}}}},"version":{"description":"Optional field to assign a human-readable version in the DID-Linked Resource.","type":"string"},"publicKeyHexs":{"description":"List of key references (publicKeys) which will be used for signing the message. The should be in hexadecimal format and placed in the wallet of current user.","type":"array","items":{"type":"string"}}}},"ResourceMetadata":{"type":"object","properties":{"resourceURI":{"type":"string"},"resourceCollectionId":{"type":"string"},"resourceId":{"type":"string"},"resourceName":{"type":"string"},"resourceType":{"type":"string"},"mediaType":{"type":"string"},"resourceVersion":{"type":"string"},"checksum":{"type":"string"},"created":{"type":"string"},"nextVersionId":{"type":"string"},"previousVersionId":{"type":"string"}}},"InvalidRequest":{"description":"A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.","type":"object","properties":{"error":{"type":"string"}}},"UnauthorizedError":{"description":"Access token is missing or invalid","type":"object","properties":{"error":{"type":"string"}}},"InternalError":{"description":"An internal error has occurred. Additional state information plus metadata may be available in the response body.","type":"object","properties":{"error":{"type":"string"}}}}},"paths":{"/resource/create/{did}":{"post":{"tags":["DID-Linked Resources (DLRs)"],"summary":"Create a DID-Linked Resource.","description":"This endpoint creates a DID-Linked Resource. As input, it can take the DID identifier and the resource parameters via a form, or the fully-assembled resource itself.","parameters":[{"in":"path","name":"did","description":"DID identifier to link the resource to.","schema":{"type":"string"},"required":true}],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/CreateResourceRequest"}},"application/json":{"schema":{"$ref":"#/components/schemas/CreateResourceRequest"}}}},"responses":{"200":{"description":"The request was successful.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceMetadata"}}}},"400":{"$ref":"#/components/schemas/InvalidRequest"},"401":{"$ref":"#/components/schemas/UnauthorizedError"},"500":{"$ref":"#/components/schemas/InternalError"}}}}}}
```
