> For the complete documentation index, see [llms.txt](https://docs.coda.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coda.co/codapay/direct-api-integration/direct-api-integration-for-cards/getting-started/how-to-generate-the-jwt-token.md).

# How to generate the JWT token

*More details about JWT tokens can be found* [*here*](https://jwt.io/)*.*&#x20;

JWT (or JSON Web Token) is a token that you can generate from your payload and that provides an easy way to transmit information between parties securely.

You can generate one by using jwt libraries <https://jwt.io/libraries>. Then, pass a header value that contains information on how to encode the data, as well as a payload that contains your data.

The token header should contain the following information:&#x20;

* alg: this is the signing algorithm to use. For your request to Coda, always use **HS256**&#x20;
* typ: this is the type of token you want to generate. For your request to Coda, always use “**JWT**”.

The token payload should contain the following information:

* partner\_id: This is the partner id provided to you by Coda&#x20;
* iat: Token creation Time on UTC timezone&#x20;

Please note that the generated token should be **available for 5 minutes**.

*Note: This is the token header that will be used to generate the authorization, not the header of your request to Coda. Do not expose the partnerId in the header of your request to Coda.*

### Example&#x20;

#### Header: Algorithm and Secret

```json
{
   "alg":"HS256",
   "typ":"JWT",
}
```

#### JWT token: Payload: data

```json
{
  "partner_id": "1234567890",
  "iat": 1512203223
}
```

The payload is also used to generate JWT tokens.

To generate a JWT, you can first encode the token header and the payload, then generate a signature from your Client Secret and assemble them:

```json
key = '*yourclientsecret*'

unsignedToken = *encodeBase64Url(header) + '.' + encodeBase64Url(payload)*

signature = *HMAC-SHA256(key, unsignedToken)*

JWT = *unsignedToken + ‘.’ + signature*
```


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.coda.co/codapay/direct-api-integration/direct-api-integration-for-cards/getting-started/how-to-generate-the-jwt-token.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
