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

# Your first API call

> Set up authentication, create a sandbox, and make your first request to the Plane API.

This guide walks you through creating a sandbox, generating an API key, and making your first request. By the end, you will have a working sandbox environment and a test worker created through the API.

## Prerequisites

* A Plane account with admin access
* An API key (or you will create one below)

## Create a sandbox

Before testing with the API, create a sandbox so you can experiment without affecting live data.

<Steps>
  <Step title="Go to Developers">
    In your Plane dashboard, navigate to **Developers** in the sidebar, then click **Sandboxes**.
  </Step>

  <Step title="Create a sandbox">
    Click **Create sandbox** and confirm. You will start with an empty workspace for testing.
  </Step>

  <Step title="Enter the sandbox and create an API key">
    Click **Enter** on your new sandbox, then go to **Developers > API keys** and click **Create secret key**. Copy the key—it is only shown once.

    <Warning>
      Your sandbox key starts with `sk_test_`. Make sure you are using this key for testing, not a live key (`sk_live_`).
    </Warning>
  </Step>
</Steps>

## Make your first request

List the workers in your sandbox. Since it is new, the result will be empty—but this confirms your authentication is working.

<Note>
  The Plane API accepts both HTTP Basic Auth (`-u YOUR_KEY:`) and Bearer tokens (`Authorization: Bearer YOUR_KEY`). The examples below use whichever is most idiomatic for each language. See [Authentication](/reference/authentication) for details.
</Note>

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.plane.com/v1/workers \
    -u "sk_test_YOUR_KEY_HERE:"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch("https://api.plane.com/v1/workers", {
    headers: {
      Authorization: `Bearer sk_test_YOUR_KEY_HERE`,
    },
  });

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

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.plane.com/v1/workers",
      auth=("sk_test_YOUR_KEY_HERE", ""),
  )

  print(response.json())
  ```
</CodeGroup>

You should see an empty list response:

```json theme={null}
{
  "data": []
}
```

## Create a test worker

Now create a contractor in your sandbox:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.plane.com/v1/workers \
    -u "sk_test_YOUR_KEY_HERE:" \
    -H "Content-Type: application/json" \
    -d '{
      "type": "contractor",
      "name": {
        "first": "Alex",
        "last": "Rivera"
      },
      "email": "alex@example.com",
      "title": "Design Consultant"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch("https://api.plane.com/v1/workers", {
    method: "POST",
    headers: {
      Authorization: `Bearer sk_test_YOUR_KEY_HERE`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      type: "contractor",
      name: { first: "Alex", last: "Rivera" },
      email: "alex@example.com",
      title: "Design Consultant",
    }),
  });

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

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api.plane.com/v1/workers",
      auth=("sk_test_YOUR_KEY_HERE", ""),
      json={
          "type": "contractor",
          "name": {"first": "Alex", "last": "Rivera"},
          "email": "alex@example.com",
          "title": "Design Consultant",
      },
  )

  print(response.json())
  ```
</CodeGroup>

The response includes the new worker's ID:

```json theme={null}
{
  "id": "wr_test_abc123"
}
```

<Tip>
  Sandbox records use a `_test_` midfix in their IDs, making it easy to distinguish test data from live data.
</Tip>

## Retrieve the worker

Use the returned ID to fetch the full worker object:

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.plane.com/v1/workers/wr_test_abc123 \
    -u "sk_test_YOUR_KEY_HERE:"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    "https://api.plane.com/v1/workers/wr_test_abc123",
    {
      headers: {
        Authorization: `Bearer sk_test_YOUR_KEY_HERE`,
      },
    }
  );

  const worker = await response.json();
  console.log(worker);
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.plane.com/v1/workers/wr_test_abc123",
      auth=("sk_test_YOUR_KEY_HERE", ""),
  )

  print(response.json())
  ```
</CodeGroup>

## Next steps

You have authenticated, created a sandbox, and made your first API calls. From here:

<CardGroup cols={2}>
  <Card title="Onboard a contractor" icon="user-plus" href="/guides/onboard-a-contractor">
    Walk through the full contractor onboarding flow via the API.
  </Card>

  <Card title="Send a payment" icon="paper-plane" href="/guides/send-a-payment">
    Send a one-off payment to a worker.
  </Card>

  <Card title="Set up webhooks" icon="bell" href="/guides/setting-up-webhooks">
    Get real-time notifications when things happen in Plane.
  </Card>

  <Card title="API reference" icon="book" href="/reference/introduction">
    Browse every endpoint and object in the API.
  </Card>
</CardGroup>
