# Authentication Guide

### Obtaining Your API Token:

1. **Access Developer Settings:** Open your web browser and navigate to [**Developer Settings**](https://web.clearfeed.app/settings/developer-settings).

<figure><img src="https://2719052266-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5mcT5Ccv0HPFDCfXy7RC%2Fuploads%2FXgLsondE3cY62QpzWfJc%2Fimage.png?alt=media&#x26;token=f8b18a38-358c-45b1-90ce-a205c9d5d898" alt=""><figcaption><p>Personal Access Token section under Developer Settings</p></figcaption></figure>

2. **Generate New Token:** If you haven't generated an API token yet, simply click the `Generate Token` button. This will create a new token for your use.

<figure><img src="https://2719052266-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5mcT5Ccv0HPFDCfXy7RC%2Fuploads%2FJByhL8EsMy9iYFpG3ayl%2Fimage.png?alt=media&#x26;token=99ac2b7c-75b8-4088-9829-ca547fb55be3" alt=""><figcaption><p>Generated Token</p></figcaption></figure>

After generating the token, you can easily copy it and begin using it.

{% hint style="info" %}
Remember, it's crucial to keep your token secure and avoid sharing it. If you suspect any compromise, promptly revoke the token; you can always generate a new one from the same page.
{% endhint %}

3. **Encountering Error (403):** If you encounter an Error like this below while running any Endpoint with an Access Token, it means that the API token used for the request is associated with a user who is not a member of the connected Slack workspace. ClearFeed validates the user’s Slack profile for all ticketing operations.

```
{
  "message": "The authenticated user does not have a corresponding profile in the Slack workspace.",
  "error": "FORBIDDEN"
}
```

**Possible Causes:**

* The user whose API token was used has been removed from the Slack workspace.
* The user’s email/profile is not correctly mapped between Slack and ClearFeed.
* The API token is outdated or invalid.

**How to Resolve:**

1. Ensure the user is an active member of the connected Slack workspace.
2. If the user was removed or is inactive, generate a new **Personal Access Token** from ClearFeed:
   * Open the ClearFeed web app and go to [Developer Settings](https://web.clearfeed.app/settings/developer-settings).
   * Under **Personal Access Token**, click **Generate Token**.
   * Replace the old token in your API calls with the newly generated token.
3. Verify the user has appropriate roles (Agent/Responder) in ClearFeed.

### Using Your API Token:

Include the bearer token in the HTTP request's `Authorization` header for API access:

```vbnet
GET /v1/rest/endpoint
Host: api.clearfeed.app
Authorization: Bearer YOUR_TOKEN_HERE
```
