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

# Introduction

> IndiePitcher REST API documentation

## Welcome

IndiePitcher REST API allows you to send emails, manage your contacts, and generate portal session to manage user's contact lists.

Please note that most destructive operations are currently not supported through the REST API for sesucurity reasons. Please use the [IndiePitcher dashboard](https://app.indiepitcher.com).

## Base URL

All requests contain the following base URL:

```
https://api.indiepitcher.com/v1
```

## Authentication

* Create a free account at [IndiePitcher](https://app.indiepitcher.com) to get your API key. API keys are tied to a project.
* After you've generated your API key you can use it to authenticate your requests by including it in the `Authorization` header.

```http theme={null}
Authorization: Bearer sc_xxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

<Warning>Do not expose the API key and make calls to our API from your frontend code. You risk your API key being exploited by spammers and us having to reset/disable your API key. We also have CORS security rules in place.</Warning>

## Rate Limits

Rate limits are applied to all requests to the IndiePitcher API. The rate limits are as follows:

* **10 requests per second across API keys tied to a project.**

After reaching the rate limit, you will receive a `429 Too Many Requests` response. The rate limit will reset after 1 second. We recommend using endpoints that support batch operations to reduce the number of requests made.

## SDKs

SDKs are available for the following languages:

* [Node.js](https://github.com/IndiePitcher/indiepitcher-node) (requests from web browsers are blocked by CORS)
* [Swift](https://github.com/IndiePitcher/indiepitcher-swift) (server-side usage only)
* [Python](https://github.com/IndiePitcher/indiepitcher-python) (sync and async)

## OpenAPI spec

* [https://api.indiepitcher.com/openapi.yaml](https://api.indiepitcher.com/openapi.yaml)

## Quick Start Guide

### Send a simple email

<CodeGroup>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.indiepitcher.com/v1/email/transactional \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "to": "petr@indiepitcher.com",
      "subject": "You have been invited to IndiePitcher",
      "body": "This is a sample body that supports **markdown**. Plain html is also supported.",
      "bodyFormat": "markdown"
    }'
  ```

  ```javascript Node.js theme={null}
  import { IndiePitcher } from 'indiepitcher';
  const indiePitcher = new IndiePitcher('sk_xxxxxxxxxxxxxxxxxxxx');

  await indiePitcher.sendEmail({
    to: 'petr@indiepitcher.com',
    subject: 'You have been invited to IndiePitcher',
    body: 'This is a sample body that supports **markdown**. Plain html is also supported.',
    bodyFormat: 'markdown',
  });
  ```

  ```swift Server-side Swift theme={null}
  import IndiePitcherSwift
  let indiePitcher = IndiePitcher(apiKey: "sk_xxxxxxxxxxxxxxxxxxxx")

  try await indiePitcher.sendEmail(
    data: .init(
      to: "petr@indiepitcher.com", 
      subject: "You have been invited to IndiePitcher", 
      body: "This is a sample body that supports **markdown**. Plain html is also supported.",
      bodyFormat: .markdown
    ))
  ```

  ```python Python theme={null}
  from indiepitcher import IndiePitcherClient, SendEmail, EmailBodyFormat

  client = IndiePitcherClient(api_key="your_api_key")

  # or for async environments
  # client = IndiePitcherAsyncClient(api_key="your_api_key")

  email = SendEmail(
      to="recipient@example.com",
      subject="Hello from IndiePitcher!",
      body="This is a **markdown** email sent via the IndiePitcher Python SDK.",
      body_format=EmailBodyFormat.MARKDOWN
  )

  client.send_email(email)
  ```
</CodeGroup>

## Learn More

* [Add a contact](/api-reference/endpoints/create-contact)
* [Send an email to a contact](/api-reference/endpoints/send-email-to-contact)
* [Send an email to contacts subscribed to a mailing list](/api-reference/endpoints/send-email-to-mailing-list)
