# Authentication

## Get your API token

Once you are logged in to your dashboard navigate to API access and create an API token.

You can name your token, so you know where this one is going to be used, in case you ever need to revoke it.

## r4nkt API access

Once you create a token, it will be shown only once to you. Make sure to store it safely. After it is shown it can only be revoked, in which case you will need to generate a new token for use.

Once you have your token, you can authenticate against the API.

## Authenticate against the API

The token you've received can be used in the `Authorization` header.

Here's a curl example of how you can authenticate against the API. In this example, it will list all of your game's actions.

```bash
$ R4NKT_TOKEN="your API token"
$ curl https://api.r4nkt.com/v1/games/<your game id>/actions \
    -H "Authorization: Bearer $R4NKT_TOKEN" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json"
```

The token is used to authenticate. The `/v1/games/<game_id>/actions` endpoint is hit to retrieve your game's actions. The resulting response payload might look like this:

```javascript
{
   "data":[
      {
         "custom_id":"solve.puzzle",
         "name":"solve.puzzle",
         "description":"Solve any puzzle",
         "custom_data":null,
         "created_at":"2021-10-06T12:05:20.000000Z",
         "updated_at":"2021-10-06T12:05:20.000000Z"
      },
      {
         "custom_id":"open.chest",
         "name":"open.chest",
         "description":"Open any chest",
         "custom_data":null,
         "created_at":"2021-10-06T12:05:20.000000Z",
         "updated_at":"2021-10-06T12:05:20.000000Z"
      }
   ],
   "links":{
      ...
   },
   "meta":{
      ...
   }
}
```


---

# 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.r4nkt.com/api/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.
