---
title: "Make your first API call"
description: "Create an API key, then list your organization and its projects with curl."
---

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

# Make your first API call

You need an account in an organization. See [Create an account](/get-started/create-an-account).

## Create an API key

An API key acts as you, with exactly your access. See [Authentication](/api/authentication).

### Console

1. In the [console](https://console.ezghcloud.com), open the account menu (your name or email, top right) and click **API keys**.
2. Click **Create API key**.
3. Enter a **Name**, choose when it **Expires** (**30 days**, **90 days**, **1 year** or **Never**), and click **Next**.
4. Check the details and click **Create key**.
5. Click **Copy**. The key isn't shown again.
### CLI

[Install the CLI](/cli/install) first. On macOS and Linux:

```sh
curl -fsSL https://get.ezghcloud.com | sh
```

```sh
ezgh login
ezgh iam api-keys create my-first-key --expires-in-days 30
```

The key is printed once, on standard output. `--expires-in-days` takes 1 to 365; without it,
the key doesn't expire.

Keep the key in an environment variable:

```sh
export EZGH_API_KEY=ezgh_...
```

## List your organization

```sh
curl https://orgs.ezghcloud.com/v1/organizations \
  -H "Authorization: Bearer $EZGH_API_KEY"
```

```json
{
  "organizations": [
    {
      "id": "0199a3c2-5b1e-7d40-9f3a-2c8e6b1d4f70",
      "name": "Acme",
      "slug": "org_k3f9a0x2m7qp",
      "resourceName": "ezgh::org_k3f9a0x2m7qp",
      "createdAt": "2026-09-01T08:00:00.000Z",
      "updatedAt": "2026-09-01T08:00:00.000Z",
      "isRoot": true
    }
  ],
  "nextCursor": null
}
```

`isRoot` says whether the key's owner is the organization's root user. Save the `id`:

```sh
export ORG_ID=0199a3c2-5b1e-7d40-9f3a-2c8e6b1d4f70
```

## List your projects

```sh
curl https://orgs.ezghcloud.com/v1/organizations/$ORG_ID/projects \
  -H "Authorization: Bearer $EZGH_API_KEY"
```

```json
{
  "projects": [
    {
      "id": "0199a3c4-7a2b-7c1d-8e3f-4a5b6c7d8e9f",
      "organizationId": "0199a3c2-5b1e-7d40-9f3a-2c8e6b1d4f70",
      "name": "web",
      "slug": "prj_g7h8i9j0k1l2",
      "resourceName": "ezgh::org_k3f9a0x2m7qp:prj_g7h8i9j0k1l2",
      "createdAt": "2026-09-01T08:01:00.000Z",
      "updatedAt": "2026-09-01T08:01:00.000Z"
    }
  ],
  "nextCursor": null
}
```

The list shows the projects you're allowed to list. A `nextCursor` that isn't `null` means
there's another page. See [Requests](/api/requests#pagination).

## Next steps

- [API overview](/api): the products' hosts and API references.
- [Errors](/api/errors): what failed calls return.
- The [Organizations API reference](/orgs-api/organizations/ListOrganizations/).

Source: https://docs.ezghcloud.com/get-started/first-api-call/index.mdx
