---
updatedAt: 2025-06-05T00:03:52.000Z
agentTools:
  projectIndex: https://developers.envoy.com/hub/llms.txt
---

# Make your first API request

Learn how to get started using the Envoy API.

<div class="time-box">Time to complete: 10 minutes</div>

This tutorial describes the basic steps for getting started with the Envoy API. This tutorial will show you how to get an access token and then call the locations API to fetch details about your Envoy location(s).

## Create a developer account

Use the [Dev Dashboard](https://developers.envoy.com/hub/docs/dev-dashboard) to create and manage apps for use privately within your company or to share publicly with others.

## Create an API user

Before you can make a call to the API, you need to set up an API user account. For demonstration purposes, this guide will show you how to authenticate with the Envoy API using the [OAuth2](https://developers.envoy.com/hub/docs/authenticate-overview) password grant type.

> ❗️
>
> The password grant type should only be used for private apps you are building for just your company. If you are building apps for others, you'll need to authenticate by following this [guide](https://developers.envoy.com/hub/docs/get-a-token-when-your-app-is-installed).

1. Create an employee manually in your [employee directory](https://dashboard.envoy.com/employees).
2. [Assign](https://envoy.help/en/articles/6523450-employee-directory-and-admin-roles#h_eaa03077ce) the user a **Global Admin** role.
3. Make sure the setting **Show employee as a host on the Visitors Kiosk** is disabled

![](https://files.readme.io/4c6abf7-Screen_Shot_2020-10-19_at_8.32.37_PM.png "Screen Shot 2020-10-19 at 8.32.37 PM.png")

## Get a client id and secret

You'll need a client id and secret to retrieve an access token to authenticate with the API. To generate a client id and secret you will need to create an integration using the Dev Dashboard.

1. Go to the [Dev Dashboard](https://dashboard.envoy.com/dev-dashboard).
2. Click **Create New**.
3. Provide a name for your integration
4. Under **API Scopes** add the scope `locations.read`
5. Check **Is the integration ready to be displayed?**
6. Click **Save Integration**

Here's what your integration configuration settings should look like

![](https://files.readme.io/b6ac952-Screen_Shot_2022-08-16_at_10.39.53_AM.png "Screen Shot 2022-08-16 at 10.39.53 AM.png")

1. From the **All Integrations** tab within the Dev Dashboard find the integration you just created and select **Configure**.
2. Copy the client id and client secret from the **Envoy API Credentials** section.

![](https://files.readme.io/5cf9f6f-24a34e0-Screen_Shot_2020-10-04_at_12_06_41_AM.png "24a34e0-Screen_Shot_2020-10-04_at_12_06_41_AM.png")

## Get an access token

Next you'll need to exchange the client id, secret, and username and password to get an access token that can be used to authenticate your API request.

Call the [token API](/reference#token) `oauth2/token` and format your request using the curl example below.

```curl Curl request
curl --location --request POST 'https://api.envoy.com/oauth2/token' \
--header "Authorization: Basic $( echo -n {ENVOY_CLIENT_ID}:{ENVOY_CLIENT_SECRET} | base64 )" \
--form "username={USER_EMAIL}" \
--form "password={PASSWORD}" \
--form "scope=token.refresh,locations.read" \
--form "grant_type=password"
```
```json API response
{
    "token_type": "Bearer",
    "access_token": "{YOUR_ACCESS_TOKEN}",
    "expires_in": 86400,
    "refresh_token": "{YOUR_REFRESH_TOKEN}",
    "refresh_token_expires_in": 2592000,
    "state": null,
    "company_id": "10000"
}
```

> 📘
>
> Remember to base64 encode your client ID and secret in the authorization header.

| Name           | Description                                                                                                                                                                                                                      |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| authorization  | Basic auth header using the client ID and secret as the username and password base64 encoded.                                                                                                                                    |
| client\_id     | The client ID for your application.                                                                                                                                                                                              |
| client\_secret | The client secret for your application.                                                                                                                                                                                          |
| grant\_type    | Set to `password`.                                                                                                                                                                                                               |
| scope          | Set to `token.refresh,locations.read`. This will allow us to retrieve location information. If you want to fetch other types of data you'll need to include the appropriate scopes. [Learn more](/hub/docs/scopes) about scopes. |

## Make an API request

To get a list of locations for your account, use the access token that was returned in the previous step in the authorization header and call the [locations API](hub/reference/locations-1) `/api/v1/locations`.

```curl API request
curl --location --request GET 'https://api.envoy.com/rest/v1/locations' --header 'Accept: application/vnd.api+json' --header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'
```
```json API response
{
    "data": [
        {
            "id": "94082",
            "type": "locations",
            "links": {
                "self": "https://app.envoy.com/api/v3/locations/94082"
            },
            "attributes": {
                "address": "410 Townsend St 4th floor, San Francisco, CA 94107, USA",
                "address-line-one": "410 Townsend St",
                "address-line-two": "4th floor",
                "auto-sign-out-at-midnight": false,
                "blacklist-filters-csv-upload-status": null,
                "city": "San Francisco",
                "company-name-override": "Envoy",
                "deliveries-onboarding-complete": false,
                "disabled": false,
                "capacity-limit": 5
            }
}
```

> 📘
>
> If you want to access other resources through the API remember to add the appropriate scopes in the scopes section of the Dev Dashboard and in the `scope` value in the /tokens endpoint.