Writing data through the public API
The public API supports writes for the modules where it's safe and useful. Writes use the same Bearer-token auth as reads but need the matching :write scope (or *:write) on the API key. The full list, each with its request body and response, is at https://turtini.com/docs/api; the most common ones:
POST /v1/contacts — create a CRM contact
Body: { firstName, lastName, email, phone?, accountId?, title?, linkedinUrl? }
Returns: { id, ...contact } at 201
POST /v1/articles — create a draft article
Body: { title, body, summary?, articleTypeId?, visibility?, tags? }
Status is always 'draft' — admins still approve and publish in-app
Author is recorded as "API: <key name>" so you can audit which integration created what
Returns: { id, ...article } at 201
POST /v1/articles/update — edit an article your org wrote (scope articles:write)
Body: { articleId, title?, body?, summary?, tags?, visibility?, articleTypeId?, author? }
Send only the fields to change. null clears summary, tags or articleTypeId. Any other field is refused with 400.
It never publishes: status cannot be set, and a published article, or a draft scheduled to publish, answers 409. To change a live article, edit it in Turtini or unpublish it first, so live text never changes without review.
author sets the byline: the user id or email of a member of your org. Anyone else answers 404.
The article must belong to the key's org; any other id answers 404
Returns: { id, ...article } at 200
POST /v1/events — create an event
Body: { title, date, startTime?, endTime?, endDate?, location?, description?, status?, visibility?, slug? }
date is an ISO date (YYYY-MM-DD) or datetime. Defaults: status='draft', visibility='private' — promote to public from the Events admin
Ticket types and prices are set separately, with POST /v1/events/ticketing (scope ticketing:write)
Returns: { id, ...event } at 201
POST /v1/events/update — edit an event on your org's calendar (scope events:write)
Body: { eventId, title?, date?, startTime?, endTime?, endDate?, location?, description?, status?, visibility?, slug? }
Send only the fields to change. null clears startTime, endTime, endDate, location or description. status and visibility work as they do on create.
An event whose address is private keeps it private: a new location is saved to the admin-only address, not shown on the event
The event must belong to the key's org; any other id answers 404
Returns: { id, ...event } at 200
POST /v1/notes — append a note to an account, opportunity or contact
Body: { entity: 'account' | 'opportunity' | 'contact', entityId, text }
Idempotency-Key (optional, recommended):
Pass an Idempotency-Key header on a POST, a UUID v4 per logical operation. For 24 hours, a request with the same key in the same org gets the first request's stored response back and runs nothing, whatever its body. This is what makes retries safe across network failures. Without the header, every request runs.
curl https://api.turtini.com/v1/contacts \
-X POST \
-H "Authorization: Bearer turtini_<your-key>" \
-H "Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000" \
-H "Content-Type: application/json" \
-d '{"firstName":"Ada","lastName":"Lovelace","email":"[email protected]"}'
Concurrent retries: if two requests with the same Idempotency-Key arrive at once, the second waits up to 5 seconds for the first to finish and returns its stored response; if the first is still running after that, it answers 409 idempotency_pending.
Cross-org safety: writes that reference another record (e.g. POST /v1/contacts with accountId) verify the referenced record belongs to the same org as the key, and refuse it otherwise.
Common errors (every one is { "error": { "code", "message" } }):
• 400 — the body is not JSON, or a required field is missing or malformed
• 401 — missing, invalid or revoked key, or the key lacks the scope (e.g. POST /v1/articles needs articles:write or *:write)
• 404 — a referenced record was not found in your org
• 409 — a request with the same Idempotency-Key is still running
There is no per-key request rate limit and the API does not send 429 itself. The service runs on a bounded number of instances, so under very heavy load the hosting platform can answer 429 or 503; retry those with backoff.
If you're writing client code, use @turtini/sdk — it handles Idempotency-Key generation, retries, and typed errors for you. See "@turtini/sdk — typed Public API client".