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

# API Overview

> Overview of available endpoints

## API Structure

The Sendly SDK is organized into resources, each with its own methods:

```
Sendly
├── emails
│   ├── send()
│   ├── get()
│   ├── list()
│   ├── inbound
│   │   ├── list()
│   │   └── get()
│   └── envelope
│       └── list()
├── domains
│   ├── create()
│   ├── list()
│   ├── get()
│   ├── update()
│   ├── verify()
│   └── delete()
├── logs
│   └── list()
└── webhooks
    ├── create()
    ├── list()
    ├── get()
    ├── update()
    └── delete()
```

## Main Resources

### Emails

Manage email sending and tracking.

**Use cases:**

* Send transactional emails
* Track deliveries
* Manage bounces
* Monitor opens and clicks

### Domains

Configure and verify sending domains.

**Use cases:**

* Add your own domain
* Configure DNS records
* Verify authenticity
* Enable tracking

### Webhooks

Receive real-time event notifications.

**Use cases:**

* Delivery notifications
* Bounce alerts
* Status updates
* Click and open events

### Logs

Access a historical record of all requests.

**Use cases:**

* Sending audits
* Debugging issues
* Usage analytics

## Authentication

All requests require authentication with an API key:

```javascript theme={null}
const client = new Sendly('se_your_api_key')
```

## Response Format

### Successful Response

```json theme={null}
{
  "id": "email_123",
  "status": "DELIVERED",
  "created_at": "2024-01-15T10:30:00Z",
  "to": "user@example.com"
}
```

### Error Response

```json theme={null}
{
  "code": "INVALID_EMAIL",
  "message": "The provided email is invalid",
  "status": 400
}
```

## Error Handling

```javascript theme={null}
import { Sendly, SendlyError } from '@sendlyapp/sdk'

try {
  await client.emails.send({...})
} catch (error) {
  if (error instanceof SendlyError) {
    console.error(`Error ${error.status}: ${error.code}`)
    console.error(error.message)
  }
}
```

## Rate Limiting

* **Limit**: 1000 requests per minute
* **Response headers**:
  * `X-RateLimit-Limit`: Total limit
  * `X-RateLimit-Remaining`: Remaining requests
  * `X-RateLimit-Reset`: Reset timestamp

## Pagination

List responses include pagination information:

```javascript theme={null}
const response = await client.emails.list({
  limit: 50,
  page: 1,
  sortBy: 'created_at',
  sortOrder: 'desc'
})

// response.data: Email[]
// response.pagination.page: number
// response.pagination.limit: number
// response.pagination.total: number
```

## Idempotency

For critical operations like sending emails, use idempotency keys:

```javascript theme={null}
await client.emails.send({
  from: 'noreply@yourdomain.com',
  to: 'user@example.com',
  subject: 'Important email',
  html: '<p>Content</p>',
  idempotencyKey: 'unique-key-123' // Prevents duplicates
})
```

## Timeouts

* **Connection timeout**: 30 seconds
* **Read timeout**: 60 seconds

## Base Endpoints

* **API**: `https://api.usesendly.app/v1`
* **Dashboard**: `https://app.usesendly.com`

## Versions

We are currently on **v1** of the API. Changes will be announced in advance.

## Support

Need help? Contact [support@usesendly.app](mailto:support@usesendly.app)
