# Azion API quickstart

> Platform versions: this page applies to API v6.x only, not to API v4.x and API v3.x.
> Equivalent page for API v4.x: [Azion API quickstart](/en/documentation/devtools/api/quickstart.md)
> Release stage: Preview.

This guide instructs you through your first requests to the Azion API.

- Get a personal token to authenticate your requests.
- List the workloads of your account.
- Create a network list.
- Read the network list and rename it.
- Delete the network list and confirm that it is gone.

Every request goes to the base URL `https://api.azion.com/v6` and carries your personal token in the `Authorization` header. The guide creates one object, a network list with one IP address, and links it to nothing else. You delete it in the last stage, so the account ends as it started. For every endpoint, refer to the [Azion API reference](https://api.azion.com/v6).

---

## Prerequisites

- An Azion account that uses API v6.
- `curl`, or another HTTP client.

---

## Get a personal token

A [personal token](/en/documentation/fundamentals/personal-tokens/) authenticates your requests to the Azion API. To create one in Azion Console, refer to [Manage personal tokens](/en/documentation/guides/platform/account-and-billing/personal-tokens/). Copy the token when Azion Console shows it, because you can only see it when you create it.

The Azion API reads the token from the `Authorization` header. Every request in this guide sends it in this form:

```text
Authorization: Token [TOKEN VALUE]
```

You have the header that authenticates every request in the next stages.

---

## List your workloads

A list request returns the workloads of your account and confirms that the token works. The response is one page of results.

Send a `GET` request to the workloads endpoint. The `page_size=100` parameter asks for up to 100 workloads on one page, and `fields=id` returns only the ID of each workload:

```bash
curl --request GET \
  --url 'https://api.azion.com/v6/workspace/workloads?page_size=100&fields=id' \
  --header 'Accept: application/json' \
  --header 'Authorization: Token [TOKEN VALUE]'
```

A `200` returns the page of workloads:

```json
{
  "count": 3,
  "total_pages": 1,
  "page": 1,
  "page_size": 100,
  "next": null,
  "previous": null,
  "results": [
    {"id": 1234567890},
    {"id": 1234567891},
    {"id": 1234567892}
  ]
}
```

The `count` field holds the number of workloads in the account, and `results` holds the workloads of the page. For pagination, `fields`, `ordering`, and `search`, refer to [Azion API](/en/documentation/devtools/api/v6/).

---

## Create a network list

A network list holds a set of values of one type. The request needs a `name`, a `type`, and the `items` of the list. The `type` takes `ip_cidr`, `asn`, or `countries`, and `items` takes from 1 to 20,000 entries. This guide creates an `ip_cidr` list with one address from the documentation range `192.0.2.0/24`.

Send a `POST` request to the network lists endpoint:

```bash
curl --request POST \
  --url https://api.azion.com/v6/workspace/network_lists \
  --header 'Accept: application/json' \
  --header 'Authorization: Token [TOKEN VALUE]' \
  --header 'Content-Type: application/json' \
  --data '{"name": "my-ip-list", "type": "ip_cidr", "items": ["192.0.2.10"]}'
```

A `201` returns the network list inside `data`:

```json
{
  "data": {
    "id": 12345,
    "name": "my-ip-list",
    "type": "ip_cidr",
    "items": ["192.0.2.10"],
    "last_editor": "user@example.com",
    "last_modified": "2026-01-15T12:00:00.420000Z",
    "created_at": "2026-01-15T12:00:00.000000Z",
    "version_id": "ABCD1234",
    "version_state": "draft"
  }
}
```

The body carries the `id`, `name`, `type`, and `items` of the list, its `last_editor`, `last_modified`, and `created_at`, and the `version_id` and `version_state` of its version. Record the `id`. The next stages send it in the URL.

---

## Read and rename the network list

Reading the network list returns its current values. A rename changes one field and leaves the others as they are.

Send a `GET` request to the network list. Replace `<network-list-id>` with the `id` the create request returned:

```bash
curl --request GET \
  --url https://api.azion.com/v6/workspace/network_lists/<network-list-id> \
  --header 'Accept: application/json' \
  --header 'Authorization: Token [TOKEN VALUE]'
```

A `200` returns the network list inside `data`, with the fields of the create response.

To rename the network list, send a `PATCH` request with the new `name` only:

```bash
curl --request PATCH \
  --url https://api.azion.com/v6/workspace/network_lists/<network-list-id> \
  --header 'Accept: application/json' \
  --header 'Authorization: Token [TOKEN VALUE]' \
  --header 'Content-Type: application/json' \
  --data '{"name": "my-ip-list-renamed"}'
```

A `200` returns the network list inside `data`, with the new name:

```json
{
  "data": {
    "id": 12345,
    "name": "my-ip-list-renamed",
    "type": "ip_cidr",
    "items": ["192.0.2.10"],
    "last_editor": "user@example.com",
    "last_modified": "2026-01-15T12:00:04.280000Z",
    "created_at": "2026-01-15T12:00:00.000000Z",
    "version_id": "ABCD1234",
    "version_state": "draft"
  }
}
```

The `type` and `items` fields keep the values of the create request, and `last_modified` changes.

---

## Delete the network list

Deleting the network list returns the account to the state it had before you created the list.

Send a `DELETE` request to the network list:

```bash
curl --request DELETE \
  --url https://api.azion.com/v6/workspace/network_lists/<network-list-id> \
  --header 'Accept: application/json' \
  --header 'Authorization: Token [TOKEN VALUE]'
```

A `204` confirms the deletion, and the response has no body.

To confirm the deletion, send the `GET` request that read the list again. A `404` returns the error envelope:

```json
{
  "errors": [
    {
      "code": "10004",
      "title": "Not Found",
      "detail": "Not found.",
      "status": "404"
    }
  ]
}
```

The network list no longer exists.

---

## Next steps

- [Azion API](/en/documentation/devtools/api/v6.md): The base URL, authentication, responses, errors, pagination, and limits of the API.
- [Troubleshoot Azion API](/en/documentation/devtools/api/troubleshooting/v6.md): Causes and fixes for the errors the API returns.
- [Azion API reference](https://api.azion.com/v6): Every path, method, parameter, and response of the API.
