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

# API introduction

> LithoBlocks API — manage templates, entities, and organizations with scope-based authorization.

The LithoBlocks API lets you manage templates, entities, and organizations programmatically with scope-based authorization. Use it to create and update templates, compile messages, manage entities, and administer your organization. The API supports both **compile** (get JSON blocks and send from your own system) and **send** (LithoBlocks posts via its Slack app with full platform features); see [Compile vs send](/architecture/compile-vs-send) for when to use which.

## Base URLs

* **Production:** `https://api.lithoblocks.com`
* **Staging:** `https://staging.api.lithoblocks.com`
* **Local development:** `http://localhost:8787`

## API paths and JSON

Documented routes use the **`/v1`** prefix (for example `GET /v1/templates`, `POST /v1/templates/send`). **New integrations should use these URLs.** Older clients may still call the same operations without `/v1` (for example `GET /templates`); those URLs remain supported for backward compatibility but are not listed in the OpenAPI reference.

Request and response bodies in the reference use **snake\_case** keys (for example `template_id`, `created_at`). During a deprecation window, many inputs still accept legacy **camelCase** keys (for example `templateId`). Prefer snake\_case for new code.

**Compile and send** use fixed paths with the template id in the JSON body, not in the URL path: `POST /v1/templates/compile` and `POST /v1/templates/send` with `template_id` and `data` (see each operation in the sidebar for full schemas, including send destinations such as `channel_id`).

## Authentication

All endpoints use **LithoBlocks API keys** with Bearer authentication.

### Getting an API key

1. Log into your LithoBlocks organization dashboard
2. Go to **API Keys** in your account settings
3. Create an API key and select the scopes you need
4. Copy the key (it is shown only once)

### Using your API key

Send the key in the `Authorization` header:

```
Authorization: Bearer lb_live_sk_example_key_here
```

### Scopes and roles

Scopes are tied to your organization role:

* **All roles:** `templates:read`, `messages:create`, `entities:read`
* **Member+:** `templates:write`, `entities:write`
* **Admin+:** `organizations:admin`, `users:admin`

When creating an API key, you can only select scopes your role allows. Use the minimum scopes needed for your use case.

<Warning>
  Never share API keys or commit them to version control. Store them in environment variables and rotate them regularly.
</Warning>

## Organization isolation

All API access is scoped to your organization. You can only access resources in the organization where the API key was created. Cross-organization access is not supported.

## Endpoints

The **LithoBlocks API** section in the sidebar lists all endpoints generated from the OpenAPI specification. Use the playground on each endpoint page to try requests with your API key.

## Next steps

<CardGroup cols={2}>
  <Card title="Templates" icon="file-lines" href="/guides/templates-blocks">
    Build templates in the UI, then manage them via the API.
  </Card>

  <Card title="Quickstart" icon="rocket" href="/quickstart">
    Get started with templates and Slack.
  </Card>
</CardGroup>
