> For the complete documentation index, see [llms.txt](https://docs.udara360.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.udara360.io/udara360-docs-1/authenticate/auth.md).

# Auth

To authenticate a client, make a <mark style="color:yellow;">`POST`</mark> request to this endpoint, passing your `clientId` and `clientSecret` in the request body. These credentials are issued by the API provider and uniquely identify your client application on every request.

A successful request returns an `accessToken`, its `tokenType`, an `expirationTime` (EPOCH timestamp), and `tokenValiditySec` which is how long the token stays valid, in seconds.

The `accessToken` returned here must go in the `Authorization` header of every subsequent API call, so this endpoint is the required first step before anything else.

**Headers**

| Name                                           | Value              | Description                   |
| ---------------------------------------------- | ------------------ | ----------------------------- |
| Content-Type<mark style="color:red;">\*</mark> | `application/json` | Format of the request payload |

**Body Parameters**

<table><thead><tr><th>Name</th><th>Data Type (Length)</th><th width="120" data-type="checkbox">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>clientId</code></td><td>string (<em>100)</em></td><td>true</td><td>Unique identifier for the client application, issued by the API provider</td></tr><tr><td><code>clientSecret</code></td><td>string (<em>100</em>)</td><td>true</td><td>Secret key paired with the clientId, used to authenticate the client</td></tr></tbody></table>

Here is an example request and response with a sample payload sent to the endpoint in Curl format.

<details>

<summary>Sample Request</summary>

```json
curl --location -g '{{baseurl}}/api/auth/v1/authenticate' \
--header 'Content-Type: application/json' \
--data '{
  "clientId": "string",
  "clientSecret": "string"
}'
```

</details>

<details>

<summary>Response: <code>200</code></summary>

```json
{
  "accessToken": "string",
  "tokenType": "string",
  "expirationTime": "long",//EPOCH time
  "tokenValiditySec": "long" //Token validity in Seconds
}
```

</details>
