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

# Quickstart

> Create a personal access token and make your first COSMIC API request in minutes.

Use this quickstart to call COSMIC APIs in a few minutes with a personal access token.

## 1) Create a personal access token

<Steps>
  <Step title="Open access tokens">
    Sign in to{" "}
    <a href="https://natecosmic.com/developers" rel="noopener noreferrer" target="_blank">natecosmic.com/developers</a>
    , then open{" "}
    <a href="https://natecosmic.com/developers/access-tokens" rel="noopener noreferrer" target="_blank">Access tokens</a>
    .
  </Step>

  <Step title="Generate a token">Create a token and copy it.</Step>

  <Step title="Store it securely">
    Save it in an environment variable for local testing.
  </Step>
</Steps>

```bash theme={null}
export COSMIC_ACCESS_TOKEN="YOUR_ACCESS_TOKEN"
```

<Warning>
  Treat access tokens as secrets. Do not commit them to source control.
</Warning>

## 2) Make your first API request

Use your token in the `Authorization` header as a bearer token.

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl -sS -X GET "https://api.natecosmic.com/v1/me" \
      -H "Authorization: Bearer $COSMIC_ACCESS_TOKEN" \
      -H "Accept: application/json"
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    const response = await fetch("https://api.natecosmic.com/v1/me", {
      method: "GET",
      headers: {
        Authorization: `Bearer ${process.env.COSMIC_ACCESS_TOKEN}`,
        Accept: "application/json",
      },
    });

    if (!response.ok) {
      throw new Error(`Request failed: ${response.status}`);
    }

    const data = await response.json();
    console.log(data);
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import os
    import requests

    response = requests.get(
        "https://api.natecosmic.com/v1/me",
        headers={
            "Authorization": f"Bearer {os.environ['COSMIC_ACCESS_TOKEN']}",
            "Accept": "application/json",
        },
        timeout=30,
    )

    response.raise_for_status()
    print(response.json())
    ```
  </Tab>
</Tabs>

<Tip>
  If the request fails with `401`, your token may be expired. Personal access
  tokens expire after one hour, so create a new token and retry.
</Tip>

## Next steps

* Fetch user certification records from `GET /v1/certifications`
* Review available endpoints in [API reference](/api-reference/api)
* Learn token behavior in [Access tokens](/concepts/access-token)
* Build a production integration with [Creating apps](/guides/creating-apps)
* Implement full user authorization in [OAuth](/guides/oauth)
