# Introduction

The Zero API allows you to programmatically access and manage your workspaces, companies, contacts, and deals.

## Base URL

All API requests should be made to:

```
https://api.zero.inc
```

## Authentication

All API requests require a Bearer token in the `Authorization` header:

```
Authorization: Bearer <your-api-token>
```

You can generate an API key in your account settings.

## Rate Limiting

API requests are limited to 600 per minute.

## Quick Start

A typical workflow to get started with the API:

{% stepper %}
{% step %}

### Get your workspace ID

Retrieve your workspaces to find the workspace ID you'll use in subsequent requests:

```bash
curl -X GET "https://api.zero.inc/api/workspaces?fields=id,name" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

{% endstep %}

{% step %}

### Use the workspace ID in requests

Once you have your workspace ID, use it to fetch or create data:

```bash
curl -X GET "https://api.zero.inc/api/companies?workspaceId=WORKSPACE_UUID&limit=10" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

{% endstep %}
{% endstepper %}

## Query Parameters

All `GET` endpoints support the following query parameters for filtering and pagination:

| Parameter | Type        | Default   | Description                              |
| --------- | ----------- | --------- | ---------------------------------------- |
| `fields`  | string      | `*` (all) | Comma-separated list of fields to return |
| `where`   | JSON string | —         | Filter conditions                        |
| `limit`   | number      | `100`     | Maximum records to return                |
| `offset`  | number      | `0`       | Pagination offset                        |
| `orderBy` | JSON string | —         | Sort order, e.g. `{"name":"asc"}`        |

### Selecting Fields

Request only the fields you need to optimize response size:

```bash
curl "https://api.zero.inc/api/contacts?fields=id,name,email,title"
```

### Including Related Data

You can include related objects using dot notation in the `fields` parameter:

```bash
# Get contacts with their company information
curl "https://api.zero.inc/api/contacts?fields=id,name,email,company.name,company.domain"

# Get deals with company and contacts
curl "https://api.zero.inc/api/deals?fields=id,name,value,company.name,contacts.name"
```

### Filtering with `where`

Use the `where` parameter with a JSON string to filter results:

```bash
curl 'https://api.zero.inc/api/companies?where={"workspaceId":"your-workspace-uuid"}'
```

### Sorting with `orderBy`

Sort results using the `orderBy` parameter:

```bash
curl 'https://api.zero.inc/api/deals?orderBy={"value":"desc"}'
```

## Response Format

All endpoints return responses in a consistent format:

```json
{
  "data": [...],
  "total": 42
}
```

For single-record operations (create, update), the response contains the record directly:

```json
{
  "data": {
    "id": "uuid"
  }
}
```

## Deleting Records

All delete operations support both soft delete (archive) and hard delete:

```bash
# Soft delete (archive) - record can be recovered
curl -X DELETE "https://api.zero.inc/api/companies/COMPANY_UUID?archive=true" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

# Hard delete - permanent removal
curl -X DELETE "https://api.zero.inc/api/companies/COMPANY_UUID" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

## Need Help?

If you have questions or need assistance, contact our support team.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zero.inc/features/api/introduction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
