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

# Quickstart

> Build your first Leonar integration in 5 minutes.

This guide walks you through setting up API access and making your first requests.

## 1. Get your API key

<Steps>
  <Step title="Open settings">
    Go to **Settings > API** in your [Leonar dashboard](https://app.leonar.app).
  </Step>

  <Step title="Create a key">
    Click **Create API key**, give it a name, and select the scopes you need. For this quickstart, select the `read_only` bundle.
  </Step>

  <Step title="Copy the key">
    Copy the key starting with `leo_`. You won't be able to see it again.
  </Step>
</Steps>

## 2. Make your first request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://app.leonar.app/api/v1/contacts?limit=5" \
    -H "Authorization: Bearer leo_your_api_key"
  ```

  ```typescript TypeScript theme={null}
  const response = await fetch("https://app.leonar.app/api/v1/contacts?limit=5", {
    headers: {
      Authorization: "Bearer leo_your_api_key",
    },
  });

  const { data, meta } = await response.json();
  console.log(`Found ${meta.total} contacts`);
  ```

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

  response = requests.get(
      "https://app.leonar.app/api/v1/contacts",
      headers={"Authorization": "Bearer leo_your_api_key"},
      params={"limit": 5},
  )

  result = response.json()
  print(f"Found {result['meta']['total']} contacts")
  ```
</CodeGroup>

## 3. Create a contact

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://app.leonar.app/api/v1/contacts" \
    -H "Authorization: Bearer leo_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "first_name": "Sophie",
      "last_name": "Martin",
      "title": "Senior Developer",
      "current_company": "Doctolib",
      "emails": [{"email": "sophie@example.com", "type": "work"}]
    }'
  ```

  ```typescript TypeScript theme={null}
  const contact = await fetch("https://app.leonar.app/api/v1/contacts", {
    method: "POST",
    headers: {
      Authorization: "Bearer leo_your_api_key",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      first_name: "Sophie",
      last_name: "Martin",
      title: "Senior Developer",
      current_company: "Doctolib",
      emails: [{ email: "sophie@example.com", type: "work" }],
    }),
  });

  const { data } = await contact.json();
  console.log(`Created contact: ${data.id}`);
  ```

  ```python Python theme={null}
  response = requests.post(
      "https://app.leonar.app/api/v1/contacts",
      headers={
          "Authorization": "Bearer leo_your_api_key",
          "Content-Type": "application/json",
      },
      json={
          "first_name": "Sophie",
          "last_name": "Martin",
          "title": "Senior Developer",
          "current_company": "Doctolib",
          "emails": [{"email": "sophie@example.com", "type": "work"}],
      },
  )

  data = response.json()["data"]
  print(f"Created contact: {data['id']}")
  ```
</CodeGroup>

## 4. Search contacts

Use the search endpoint for full-text search across contacts:

```bash theme={null}
curl -X POST "https://app.leonar.app/api/v1/contacts/search" \
  -H "Authorization: Bearer leo_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "developer python",
    "location": "Paris",
    "limit": 20
  }'
```

## 5. Read custom field definitions

Before writing `custom_data`, fetch the workspace definitions to discover valid keys:

```bash theme={null}
curl -X GET "https://app.leonar.app/api/v1/contacts/custom-fields" \
  -H "Authorization: Bearer leo_your_api_key"
```

## 6. Update custom fields safely

`custom_data` updates are merged into the existing object:

```bash theme={null}
curl -X PUT "https://app.leonar.app/api/v1/contacts/contact-uuid" \
  -H "Authorization: Bearer leo_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "custom_data": {
      "industry_code": "A12",
      "vip": true
    }
  }'
```

Send `null` to remove a non-required custom field key.

## Next steps

* [Authentication and scopes](/authentication) for fine-grained permissions
* [Custom fields guide](/guides/custom-fields) for contacts and companies
* [API Reference](/api-reference/introduction) for the full endpoint documentation
* [Scopes guide](/guides/scopes) to understand permission bundles
