# Quickstart

URL: https://api-docs.vestta.io/quickstart

Create an API key and make your first authenticated request to the Vestta API.

This guide takes you from no credentials to a working API call. You need a Vestta workspace on the **Premium** or **Enterprise** plan and a user with permission to manage API keys.

### Create an API key

In Vestta, open [**Settings → API**](https://crm.vestta.io/settings?page=apis) and select **Nueva API Key**. The Vestta app is in Spanish; the fields are:

- **Nombre** — where the key will be used, for example `Website`.
- **Duración** — how long the key stays valid: 1, 3, 6 or 12 months.
- **Permisos** — the scopes. For this guide, select **Propiedades** (`properties:read`).

### Save the key securely

The full key is shown **only once**, right after you create it. It has this format:

```text
AC_LIVE_<key_id>.<secret>
```

Store it in a secret manager or an environment variable on your server. Never put it in front-end code or commit it to a repository. For this guide, export it in your terminal:

```bash
export VESTTA_API_KEY="AC_LIVE_..."
```

### Make your first request

Call [Retrieve key context](/me). It works with any active key and returns the business and scopes behind it, which makes it the safest first call:

#### cURL

```bash
curl "https://api.vestta.io/v1/me" \
  -H "X-Api-Key: $VESTTA_API_KEY"
```

#### JavaScript

```javascript
const response = await fetch('https://api.vestta.io/v1/me', {
  headers: { 'X-Api-Key': process.env.VESTTA_API_KEY },
})

const data = await response.json()
```

#### Python

```python
import os

import requests

response = requests.get(
    "https://api.vestta.io/v1/me",
    headers={"X-Api-Key": os.environ["VESTTA_API_KEY"]},
)
response.raise_for_status()
data = response.json()
```

### Inspect the response

A `200` response confirms the key works. Check that `scopes` contains everything your integration needs:

```json
{
  "status": "ok",
  "user": {
    "company_name": "Inmobiliaria Ejemplo",
    "scopes": [
      "properties:read",
      "leads:read"
    ],
    "auth_method": "api_key"
  }
}
```

If you get a `401` instead, the body tells you why — a missing header, a typo in the key, or a revoked or expired key. See [Errors](/errors#authentication-failures).

### Continue with Properties or Leads

With `properties:read` granted, list the first page of your public catalogue:

#### cURL

```bash
curl "https://api.vestta.io/v1/properties?limit=20" \
  -H "X-Api-Key: $VESTTA_API_KEY"
```

#### JavaScript

```javascript
const response = await fetch('https://api.vestta.io/v1/properties?limit=20', {
  headers: { 'X-Api-Key': process.env.VESTTA_API_KEY },
})

const data = await response.json()
```

#### Python

```python
import os

import requests

response = requests.get(
    "https://api.vestta.io/v1/properties",
    headers={"X-Api-Key": os.environ["VESTTA_API_KEY"]},
    params={
        "limit": 20,
    },
)
response.raise_for_status()
data = response.json()
```

From here, go deeper into the resource you need:

- [Properties](/properties) — filters, prices, map areas and the property object.
- [Leads](/leads) — read leads, or send them from your forms with the `leads:ingest` scope.

## Next steps

- [Authentication](/authentication) — both supported headers and what each scope unlocks.
- [API keys](/api-keys) — expiry, revocation and rotating a key without downtime.
- [Pagination](/pagination) — walk through every page of a list.
