# Quickstart

> Get an API key and make your first GraphQL request in under five minutes.

Source: https://docs.gastrogate.io/docs/getting-started/quickstart

## 1. Get an API key

Create an API key as described in [Authentication](https://docs.gastrogate.io/docs/getting-started/authentication.md). Store it in an environment variable — never commit it to source control.

```bash
export LOCO_API_KEY="your-api-key"
```

## 2. Make your first request

All requests are `POST`s to one endpoint with a JSON body containing a `query`.

```bash
curl https://api.thelocoapp.com/graphql \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $LOCO_API_KEY" \
  -d '{"query": "{ me { id } }"}'
```

A successful response always has a `data` key:

```json
{
  "data": {
    "me": { "id": "…" }
  }
}
```

## 3. Call it from code

```typescript
const res = await fetch("https://api.thelocoapp.com/graphql", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: `Bearer ${process.env.LOCO_API_KEY}`,
  },
  body: JSON.stringify({
    query: `query Restaurants($first: Int) {
      restaurants(first: $first) {
        edges { node { id } }
        pageInfo { hasNextPage endCursor }
      }
    }`,
    variables: { first: 10 },
  }),
});
const { data, errors } = await res.json();
```

## Next steps

- Build a complete app in the [first app tutorial](https://docs.gastrogate.io/docs/tutorials/first-app.md).
- Learn how lists work in [Paginate through results](https://docs.gastrogate.io/docs/guides/pagination.md).
- Browse every operation in the [API reference](https://docs.gastrogate.io/docs/api.md).
