Create a customer
# Create a customer
`POST https://app.terania.ai/api/v1/customers`
Scope: `customer:create`.
## Body
- `kind`: `person` or `organisation`.
- `displayName`
- `email` (optional)
Any other field is refused with 400: "Unknown field: name." Addresses, tags, owners and custom fields cannot be written over the API.
## Returns
201 with `{ id, displayName }`.
```bash
curl -X POST https://app.terania.ai/api/v1/customers \
-H "Authorization: Bearer $TERANIA_KEY" \
-H "Content-Type: application/json" \
-d '{"kind":"organisation","displayName":"Sample Customer Ltd","email":"accounts@samplecustomer.example"}'
```
Customers, leads and deals accept creates and updates. There are no delete endpoints for any of them. Base URL: https://app.terania.ai/api/v1. For request rules see conventions.
Security
API key, as a Bearer header
Send Authorization: Bearer <key>. The word Bearer is not case-sensitive. A key in the query string (key, api_key or token) is refused with 401 before anything else happens.
Example: Authorization: Bearer $TERANIA_KEY
Accepted permissioncustomer:create
Without it the answer is 403 write_forbidden. A scope is a filter, not a grant: it can only narrow what the person who made the key can do.
Body
kindstring
person or organisation.
displayNamestringemailstringoptional- Not accepted: any other field. Addresses, tags, owners and custom fields cannot be written over the API. An unknown field answers 400: "Unknown field: name."
- The body is JSON,
Content-Type: application/json, at most 16,384 bytes.
Headers
Authorizationstringrequired
Bearer and your key. Keys begin with qk_.
Content-Typestring
application/json.
Idempotency-Keystringnot supported here
This endpoint refuses it with 400 invalid_request: "Idempotency-Key is not supported on this endpoint yet." It works on POST /cases, POST /tasks and POST /missions.
Returns
201 Createdobject
Returns { id, displayName }.
idstring
An opaque string. Treat it as such.
displayNamestringResponse headers
On every API v1 response, success or error.
API-VersionRateLimit-Limit
The limit for the bucket that is closest to running out.
RateLimit-Remaining
Requests left in the window.
RateLimit-Reset
Seconds until the window resets.
Answers
| Status | code | error sentence |
|---|---|---|
| 201 | none | The new customer: { id, displayName }. |
| 400 | bad_request | That request body could not be read. |
| 400 | invalid_request | "Unknown field: name." Or "Send the changes as a JSON object." Or "Idempotency-Key is not supported on this endpoint yet." |
| 401 | unauthorized | This request needs a valid API key. |
| 403 | write_forbidden | This API key is not allowed to make this change. |
| 429 | rate_limited | Too many requests. Try again shortly. Wait for Retry-After seconds. |
Every error is JSON with error, code and, when available, requestId. Branch on code, not on the sentence.
Try the documented answers
Related
How Terania API v1 requests work: the Bearer header, cursor pagination, closed write bodies, Idempotency-Key, ids and server to server use.
ErrorsThe Terania API error body and every code: bad_request, invalid_request, unauthorized, forbidden, write_forbidden, not_found, rate_limited and more.
Rate limitsTerania API rate limits: 100 requests a minute per key and 600 per client address, the RateLimit headers, the 429 body and how to back off.
Next: webhooks
Terania sends 39 event kinds to your https address, signed with HMAC-SHA256, IDs only.