> For the complete documentation index, see [llms.txt](https://doc.wearepatchworks.com/product-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.wearepatchworks.com/product-documentation/developer-hub/patchworks-core-api/core-api-authentication/oauth-2-client-credentials.md).

# OAuth 2 (client credentials)

## Introduction

Patchworks API requests must be authenticated with a **bearer token**. To obtain a token, you need to send a login request which includes credentials that you use to access the Patchworks dashboard.

{% hint style="info" %}
This authentication mechanism is pre-configured and ready to use in our [Core API Postman collection](/product-documentation/developer-hub/patchworks-core-api/core-api-spotlights.md) - if you haven't seen it, we advise checking this first!
{% endhint %}

## Obtaining a token for Patchworks API authentication

<details>

<summary><img src="/files/JOYoP4EdSu7WJ3CMdAAS" alt="" data-size="line"> Show me</summary>

![](/files/T27BCHjwFTEGvYvpXXzn)

</details>

**Step 1**\
Create a POST request for the following endpoint:

{% code lineNumbers="true" %}

```
https://svc-fabric.pwks.co/api/v1/login
```

{% endcode %}

{% hint style="info" %}
This endpoint is for the Patchworks **production** environment.
{% endhint %}

**Step 2**\
In the request body, add the **email** and **password** that you use to log into the Patchworks dashboard. You should add this as JSON - for example:

{% code lineNumbers="true" %}

```json
{
    "email": "joe.bloggs@wearepatchworks.com",
    "password": "mypassword123*"
}
```

{% endcode %}

<figure><img src="/files/GaYbjxthq5giRz6jkMT5" alt=""><figcaption></figcaption></figure>

**Step 3**\
Send the request - if successful, a token is returned. For example:

<figure><img src="/files/8ZeH7yT9VLZ54OlZfJBZ" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Access tokens are valid for 24 hours - for example:\
Issued: Wednesday 20th July at 10:03:08 GMT\
Expires: Tuesday 21st July at 10:03:08 GMT
{% endhint %}

**Step 4**\
Save this token ready for use in your API requests.
