# API reference

> Fika Messaging REST API reference: endpoints for contacts, lists, segments, campaigns, templates, analytics and conversations, with IDs and responses.

Source: https://fikamessaging.com/docs/developers/api-reference

The API base URL is `https://api.fikamessaging.com`. All paths below are relative to its `/api/v1` prefix: `https://api.fikamessaging.com/api/v1`. Send `Authorization: Bearer YOUR_KEY`, `Accept: application/json`, and `Content-Type: application/json` for JSON request bodies. See [authentication and scopes](https://fikamessaging.com/docs/developers/authentication-and-scopes).

## Identifiers and responses

Marketing Email campaigns, templates, and conversations use UUIDs. Audience contacts, lists, segments, and saved audiences use numeric IDs. A campaign's sender and Reply-To fields use their numeric IDs, even though the campaign itself uses a UUID.

Resource responses use a `data` wrapper; list responses include pagination information. Check each response's returned identifiers instead of substituting names from the UI.

## Audience endpoints

| Resource path | Operations | Scope family |
| --- | --- | --- |
| `/contacts` | GET list, POST create; GET/PATCH/DELETE `/{id}` | `contacts` |
| `/lists` | GET list, POST create; GET/PATCH/DELETE `/{id}` | `lists` |
| `/lists/{id}/contacts` | GET members, POST add; DELETE `/{contact}` removes a member | `lists` |
| `/segments` | GET list, POST create; GET/PATCH/DELETE `/{id}`; GET `/{id}/contacts` | `segments` |
| `/audiences` | GET list, POST create; GET/PATCH/DELETE `/{id}`; GET `/{id}/contacts` | `audiences` |

Use the read scope for GET and write scope for mutations. A saved audience uses selected contacts, lists, and segments; a segment uses its matching conditions. These operations remain subject to audience validation rules.

## Transactional emails for internal Centipid products

These endpoints require an internal organization with an active Marketing Email subscription. An active workspace administrator must have a verified `@centipidtechnologies.com` email. Use normal marketing campaigns for promotional messages.

| Method | Path | Scope | Main inputs or result |
| --- | --- | --- | --- |
| POST | `/transactional-emails` | `transactional-emails:send` | Required `to`, `subject`, and at least one of `html` or `text`; optional `from`, `from_name`, `sender_identity_id`, `reply_to`, `attachments`. Requires an `Idempotency-Key` header. |
| GET | `/transactional-emails/{id}` | `transactional-emails:read` | Submission and delivery status for a message UUID in this workspace. |

The default verified workspace sender is used unless `from` (a verified sender email) or `sender_identity_id` is supplied. If both are supplied, they must identify the same sender. Attachments use `filename`, `content_type`, and base64 `content`; up to 10 files and 10 MiB total decoded content are supported. Recipients need not be contacts or marketing subscribers. Bounce and complaint suppressions still apply. Transactional emails do not receive campaign footers or marketing unsubscribe headers. Click tracking defaults off and can be enabled in workspace email preferences; delivery events remain enabled.

Reuse the same idempotency key and payload when retrying an individual email. A changed payload with the same key returns 422. Responses contain `data.id`, `status`, `delivery_status`, `provider_message_id`, `submitted_at`, and `failure_reason`. A `submitted` status means the provider accepted the email. An HTTP 202 result with `submitting` or `uncertain` means the outcome is not confirmed; inspect provider records before creating another send. Definite refusals have status `failed`; correct the cause before using a new key.

## Campaign endpoints

| Method | Path | Scope | Main inputs or result |
| --- | --- | --- | --- |
| GET | `/marketing-email/campaigns` | `campaigns:read` | Filters: status, created_by, created_from, created_to, search, per_page (1–100). |
| GET | `/marketing-email/campaigns/{id}` | `campaigns:read` | Email, audience, and allowed actions. |
| GET | `/marketing-email/campaigns/{id}/status` | `campaigns:read` | Status and delivery progress. |
| POST | `/marketing-email/campaigns` | `campaigns:write` | name, description, starting_point (`blank` or `template`), template_id when using a template. |
| PATCH | `/marketing-email/campaigns/{id}` | `campaigns:write` | Draft name and description. |
| PUT | `/marketing-email/campaigns/{id}/email` | `campaigns:write` | subject, sender_identity_id, reply_to_inbox_id or custom_reply_to_email, content_schema, footer_mode, custom_footer_schema; send_at when rescheduling. |
| PUT | `/marketing-email/campaigns/{id}/audience` | `campaigns:write` | sources: objects with type (`contact`, `list`, `segment`, `saved_audience`) and numeric id. |
| POST | `/marketing-email/campaigns/{id}/launch` | `campaigns:send` | Optional send_at; readiness checked; successful launch returns 202. |
| POST | `/marketing-email/campaigns/{id}/cancel` | `campaigns:send` | Cancels a scheduled campaign before dispatch starts. |

Launch with omitted `send_at` keeps the current setting; `null` requests immediate sending; an ISO-8601 time requests scheduling. The API applies the app's content, sender, audience, lifecycle, and subscription checks. There is no campaign pause/resume endpoint.

### Create a draft without sending

```bash
curl --fail-with-body   -X POST   -H "Authorization: Bearer $FIKA_API_KEY"   -H "Accept: application/json"   -H "Content-Type: application/json"   -H "Idempotency-Key: first-campaign-draft-001"   -d '{"name":"First API draft","starting_point":"blank"}'   'https://api.fikamessaging.com/api/v1/marketing-email/campaigns'
```

This creates a draft. It does not provide valid email content, recipients, or launch the campaign. Design through the app unless your integration produces a content schema compatible with the current builder.

## Template endpoints

Use GET/POST `/marketing-email/templates`, GET/PATCH `/{id}`, and POST `/{id}/publish`, `/{id}/archive`, or `/{id}/restore`. Read needs `templates:read`; mutations need `templates:write`.

Creation accepts name, subject, category, content_schema, optional footer_mode, and custom_footer_schema. Omitted patch fields retain their values; sending a subject update alone does not change footer mode. Publishing requires valid content.

## Analytics endpoints

GET `/marketing-email/analytics/dashboard`, `/campaigns`, `/campaigns/{id}`, and `/conversations` require `analytics:read`. Filters include `from`, `to`, campaign_id, status, created_by, and `compare=previous_period`. Dates use `Y-m-d` in the workspace timezone. Responses echo applied filters.

## Conversation endpoints

GET `/marketing-email/conversations`, `/{id}`, and `/{id}/timeline` require `conversations:read`. The list supports status, assignee (user ID or `unassigned`), and campaign_id.

GET `/{id}/notes/{note}` requires `conversations:notes:read` for note text.

POST `/{id}/replies` requires `conversations:write`. Supply text or rich-text body, optional subject, include_footer, and supported status (`pending` or `resolved`). The conversation's inbox must support sending. Assignment does not change. Hosted-inbox outbound replies are currently unsupported.

## Idempotency and concurrent edits

The Marketing Email create, launch, cancel, and reply POST routes marked for idempotency accept an `Idempotency-Key` of 1–255 letters, digits, dots, colons, dashes, or underscores. Reusing it with the same request replays the response and adds `Idempotent-Replayed: true`; changing the method, path, or raw request body with the same key returns 422. Keys are retained for 24 hours per credential. Do not assume every audience mutation has idempotency support.

API edits use the current record's concurrency values. Coordinate simultaneous app and API edits; the API can overwrite a user's intervening changes.

## Errors

| Status | Check |
| --- | --- |
| 401 | Missing/invalid/revoked key, disabled API access, or creator no longer eligible. |
| 402 | Required Marketing Email subscription is inactive. |
| 403 | Missing scope; check required_scope in the response. |
| 404 | Resource not found in the accessible context. |
| 409 | Lifecycle conflict or a request with the same idempotency key still being processed. |
| 422 | Validation or lifecycle issue; inspect message and errors. |
| 429 | Rate limit; reduce request frequency and retry later. |

Keep `X-Request-ID` with failed request details. Avoid blindly retrying a launch or customer reply after an uncertain result; use its idempotency key and inspect status.
