# Authentication

### Arrange Data

First, you need to arrange data which will be used to generate message

```json
{
    "owner": "string" // can be address or DID
}
```

### Generate a message

{% openapi src="/files/xjcYh3sZCi10eHJaNA7T" path="/authentication/generate-message" method="post" %}
[openapi.yml](https://2219691098-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxaHazojZlIts4pidXQC6%2Fuploads%2FfnFyuZwzFVn93GBdO4kv%2Fopenapi.yml?alt=media\&token=7e1414fc-c6b1-4244-9549-9bb061a79cc5)
{% endopenapi %}

### Generate Access Tokens

Sign the above message using the appropriate address and arrange data in below format

```json
{
    "owner": "string",
    "signature": "string",
    "timestamp": "number"
}
```

`signature` is the obtained by signing the above generated message and timestamp is also given in the response of [this](#generate-a-message)

`timestamp` can't be older than 5 minutes

{% openapi src="/files/xjcYh3sZCi10eHJaNA7T" path="/authentication" method="post" %}
[openapi.yml](https://2219691098-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxaHazojZlIts4pidXQC6%2Fuploads%2FfnFyuZwzFVn93GBdO4kv%2Fopenapi.yml?alt=media\&token=7e1414fc-c6b1-4244-9549-9bb061a79cc5)
{% endopenapi %}

### Authenticate

To authenticate, just include the received `accessToken` in `headers` as `authorization` in format `bearer ${accessToken}`


---

# Agent Instructions: 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.fetcch.xyz/how-to-integrate/guides/authentication.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.
