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

# Quickstart

> Get a token and make your first Guile API call

You can call the Guile API without an account. An anonymous token covers the
operations that don't need a signed-in person, so you can try a real request
right now.

The base URL is `https://api.guile.app`.

<Steps>
  <Step title="Get a token">
    ```bash theme={null}
    curl -X POST https://api.guile.app/auth/anonymousTokens
    ```

    You get back two tokens. Both are strings.

    ```json theme={null}
    {
      "authToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
      "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
    }
    ```

    Export the access token for the next call:

    ```bash theme={null}
    export GUILE_TOKEN='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
    ```

    Send `authToken` on your calls. When it expires, exchange `refreshToken` for a
    fresh pair with `POST /auth/exchangeRefreshToken` instead of asking the person
    to sign in again. The
    [authentication overview](/api-reference/Authentication/overview) walks through
    the full sign-in flow.
  </Step>

  <Step title="Make an authenticated call">
    Put the token in an `Authorization` header:

    ```bash theme={null}
    curl https://api.guile.app/serviceCategories \
      -H "Authorization: Bearer $GUILE_TOKEN"
    ```

    That returns the service categories a shop can offer, like haircuts or beard
    trims. Every other read works the same way.
  </Step>
</Steps>

## When a call fails

Failures come back as a problem document, not a bare status code. The `type`
field is a link to a page that says what to do:

```json theme={null}
{
  "type": "https://docs.guile.app/problems/unauthorized",
  "title": "Unauthorized",
  "status": 401
}
```

Open the link and you get the cause, the fix, and whether retrying is safe. The
[error reference](/api-reference/problems) lists every one.

## Next

<Columns cols={2}>
  <Card title="Sign a person in" icon="user" href="/api-reference/Authentication/overview">
    Move from an anonymous token to a real customer or barber session.
  </Card>

  <Card title="Book an appointment" icon="calendar" href="/api-reference/Appointments/overview">
    Hold a time with a barber.
  </Card>

  <Card title="Charge safely" icon="credit-card" href="/api-reference/idempotency">
    Use idempotency keys and replay the same logical write when the outcome is unknown.
  </Card>

  <Card title="Download the definition" icon="download" href="/api-reference/artifacts">
    The OpenAPI file and Postman collection.
  </Card>
</Columns>
