---
title: "Get token"
slug: "get-token"
abstract: "Overview of the Get token resource, which returns an authentication token to use in request headers."
---
# Get token

This resource will return an authentication token that needs to be sent in the `X-Auth-Token` header of every request that requires authentication. The token will remain valid until a new token is generated.

> [!warning]
> This token never expires, which makes it less secure. It is recommended to [create a new token using OAuth](https://doc.sitecore.com/ch/en/developers/cloud-dev/oauth-tokens.html "OAuth tokens") instead.

```html
POST /api/authenticate

```

## Body parameters

| Name | Type | Description |
| --- | --- | --- |
| `user_name` | `String` | The username to authenticate with. |
| `password` | `String` | The password to authenticate with. |

## Body examples

```html
POST /api/authenticate

{
  "user_name":"Username",
  "password":"Password"
}

```

## Response

| Response | Description |
| --- | --- |
| `200 Ok` | Returns the token to be used in the `X-Auth-Token` header |

## Response examples

```json
Status: 200 Ok

{
  "token" : "token-to-be-used-in-X-Auth-Token-header"
}

```