# Authentication

> How to authenticate API requests using an API Key with Fleetwork.

Source: https://docs.fleetwork.vn/en/introduction/authentication

## API Key Format

Fleetwork API Keys are **48-character hex strings**:

```
a3f92c1d8b0e5f7a29d4c6e1b8f03a7d2c9e5b1f4a8d3c6e
```

## How to Authenticate

Pass your API Key via the `API-KEY` HTTP header:

```bash
curl -X GET \
  "https://live.fleetwork.vn/api/v1/workspace/jobs" \
  -H "API-KEY: a3f92c1d8b0e5f7a29d4c6e1b8f03a7d2c9e5b1f4a8d3c6e"
```

## JavaScript Example

```javascript
const apiKey = "a3f92c1d8b0e5f7a29d4c6e1b8f03a7d2c9e5b1f4a8d3c6e";

const response = await fetch(
  "https://live.fleetwork.vn/api/v1/workspace/jobs",
  {
    headers: {
      "API-KEY": apiKey,
      "Content-Type": "application/json",
    },
  },
);

const data = await response.json();
```

## Environment Types

| Value | Environment |
| ----- | ----------- |
| `1`   | Development |
| `2`   | Production  |

Keys can be restricted to a specific environment. A Production key cannot be used against the Development environment and vice versa.
