> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloud.aptranet.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Make your first API request

> Create project credentials, send a request from Bash or PowerShell, and interpret the response.

This guide verifies API access by listing your project's CDN distributions. It does not create or change resources.

## Before you begin

* [Select a project and activate Cloud CDN](/quickstart).
* Have permission to create API keys and grant the key permission to list distributions.
* Use Bash with curl, or PowerShell. The examples below do not require an SDK.

If you are using Cloud DNS instead, use `/cloud-dns/zones` in place of `/cloud-cdn/distributions` and grant permission to list zones. Your organization needs the corresponding active service.

## 1. Create the credentials

In the Management Console, select your project and open **Developers → Create API key**. Name the key for its workload and grant only the list permission needed for this request.

Save both the access key, which begins with `APTRANET_`, and its secret. The secret is shown only when created or rolled. The key's project is permanent; switching the console project does not change the key.

## 2. Send the request

```bash Bash theme={"system"}
# Enter credentials interactively so they are not saved in shell history.
read -r -p "Access key: " APTRANET_ACCESS_KEY
read -r -s -p "Secret: " APTRANET_SECRET
printf '\n'

curl --silent --show-error --include \
  --request GET \
  --url https://cloud.aptranetservices.com/cloud-cdn/distributions \
  --header "Authorization: Bearer $APTRANET_ACCESS_KEY" \
  --header "Aptranet-Secret: $APTRANET_SECRET" \
  --header "Accept: application/json"
```

```powershell PowerShell theme={"system"}
# Enter the access key as the username and the API secret as the password.
$credential = Get-Credential -Message 'Enter your Aptranet API key and secret'
$headers = @{
    Authorization = 'Bearer ' + $credential.UserName
    'Aptranet-Secret' = $credential.GetNetworkCredential().Password
    Accept = 'application/json'
}

$response = Invoke-WebRequest -UseBasicParsing -Method Get `
    -Uri 'https://cloud.aptranetservices.com/cloud-cdn/distributions' `
    -Headers $headers
$response.StatusCode
$response.Content
```

Send both credential headers. Omit the console's `project` query parameter and organization header: the API key already identifies the project.

> [!NOTE]
>
> Bash examples elsewhere in these docs use `$APTRANET_ACCESS_KEY` and `$APTRANET_SECRET` from this step. For unattended workloads, supply these values through your deployment's secret store.

## 3. Check the response

| Result | Meaning | Next action |
| - | - | - |
| `200` and a JSON array | Authentication succeeded and the project has distributions | Use returned IDs for later requests |
| `204` with no body | Authentication succeeded; the CDN collection is empty | [Create a distribution](/cloud-cdn/quickstart) |
| `401` | Authentication is missing or not recognized | Check the `Bearer APTRANET_` prefix and both headers |
| `402` | The service or billing state prevents access | Check the subscription for the key's organization |
| `403` | The key is disabled, its secret is wrong, or access is denied | Check the key status, current secret, and list permission |

An empty Cloud DNS zone collection returns `200` with `[]`. Do not attempt to parse a `204` response as JSON. PowerShell reports non-success HTTP responses as errors; inspect their status before retrying.

When finished with an interactive session, clear the variables:

```bash Bash theme={"system"}
unset APTRANET_ACCESS_KEY APTRANET_SECRET
```

```powershell PowerShell theme={"system"}
Remove-Variable credential, headers, response -ErrorAction SilentlyContinue
```

## Continue

* [Request conventions](/api-reference/request-conventions) explain identifiers, full-document updates, and retries.
* [Update CDN configuration](/cloud-cdn/update-configuration) walks through reading, modifying, and verifying a setting.
* [API keys](/platform/api-keys) covers rotation and revocation.
* [Errors](/api-reference/errors) explains error bodies and trace IDs.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.