---
title: "Create a label, optionally with auto-filing rules"
method: POST
path: "/labels"
tags: ["Labels and filing rules"]
---

# Create a label, optionally with auto-filing rules

`POST /labels`

## Request

- Base URL: `https://sendhq.cc/api/v1`
- URL: `https://sendhq.cc/api/v1/labels`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/sendhq/apis/sendhq-api/docs/labels/post.ts> (a function with typed inputs; its response is checked against the schema)

Create a folder-style label. Set `skip_inbox: true` to make it a bucket: received mail that gets this label (from a rule, from a reply to a conversation sent with the label, or added by hand) is archived so it appears only in the label, never the Inbox. Optional `rules` file new sent or received mail automatically: every condition set on a rule must match (inbox_id, direction, and case-insensitive from/to/subject substrings). Set `apply_to_existing` to file retained mail too.

## Request body

- object
  - `name` string, required
  - `color` string, required
  - `skip_inbox` boolean, required
  - `rules` object[], required
    - `inbox_id` string, required
  - `apply_to_existing` boolean, required

## Response `201`

Successful response

- object
  - `id` string, required
  - `name` string, required
  - `color` string, required
  - `skipInbox` boolean, required
  - `totalCount` integer, required
  - `unreadCount` integer, required
  - `rules` unknown[], required
    - unknown

## Other responses

- `400`: Invalid request
- `401`: Missing or invalid authentication
- `402`: A paid entitlement is required for this recipient or feature
- `403`: The workspace, domain, policy, or suppression state forbids the operation
- `404`: Tenant-scoped resource not found
- `409`: Resource state or idempotency conflict
- `413`: Attachment count or bytes exceed the accepted limit
- `422`: Request validation or suppression check failed
- `423`: Sending is paused for this sender identity or workspace; the message gives the reason and how to appeal
- `429`: A monthly, daily, or trial usage limit was reached
- `500`: Unexpected server error
- `502`: An upstream provider operation failed
- `503`: A required provider or signing configuration is unavailable
- `default`: An error response using SendHQ's standard JSON envelope

---

[API](https://skmtc.dev/sendhq/apis/sendhq-api.md) - [All operations](https://skmtc.dev/sendhq/apis/sendhq-api/llms.txt) - [OpenAPI document](https://skmtc.dev/sendhq/apis/sendhq-api/revisions/98e39e48cb9a?raw)
