Create an organization (default project + policy)
POST /v1/orgs
Verified human session. only_if_no_org=true serializes first-organization onboarding per user: returns an existing membership's organization with 200 or creates the organization/default project/policy with 201. Omit the flag to explicitly create an additional organization. Org-scoped Idempotency-Key does not cover this bootstrap endpoint.
Operation ID: post__v1_orgs.
Authentication
Use one of these authentication alternatives. Schemes on the same line are required together:
sessionCookie(cookie: ordan_session)
Organization roles, key scopes, grant capabilities, policy and spend limits still apply. See Authentication.
Request
Body (required)
Content type: application/json
Type: object
Required means required within its containing object, when that object is present. Union/conditional constraints remain defined by the JSON Schema below.
| Field | Type | Presence | Description / constraints |
|---|---|---|---|
name | string | Required | minLength: 1. maxLength: 120 |
only_if_no_org | boolean | Optional | First-organization onboarding: atomically reuse an existing organization membership (200) or create one (201), scoped to the signed-in user. Safe to retry after a lost response.. default: false |
JSON Schema
json
{
"additionalProperties": true,
"properties": {
"name": {
"maxLength": 120,
"minLength": 1,
"type": "string"
},
"only_if_no_org": {
"default": false,
"description": "First-organization onboarding: atomically reuse an existing organization membership (200) or create one (201), scoped to the signed-in user. Safe to retry after a lost response.",
"type": "boolean"
}
},
"required": [
"name"
],
"type": "object"
}Request examples
These are request templates, not executed requests. Replace REPLACE_… and <…> placeholders, set the credential environment variables, and supply any conditional fields your action needs. JSON values are illustrative, not live records. Use a stable idempotency key per logical operation.
bash
curl --request POST --url 'https://api.ordan.io/v1/orgs' \
--header "Cookie: ordan_session=$ORDAN_SESSION" \
--header "Content-Type: application/json" \
--data-raw '{
"name": "<name>"
}'js
const response = await fetch("https://api.ordan.io/v1/orgs", {
method: "POST",
headers: {
"Cookie": "ordan_session=" + process.env.ORDAN_SESSION,
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "<name>"
}),
});
const text = await response.text();
if (!response.ok) throw new Error(`${response.status}: ${text}`);
const result = text ? JSON.parse(text) : null;python
import json
import os
from urllib.request import Request, urlopen
request = Request("https://api.ordan.io/v1/orgs",
method="POST",
headers={
"Cookie": "ordan_session=" + os.environ["ORDAN_SESSION"],
"Content-Type": "application/json",
},
data="{\n \"name\": \"<name>\"\n}".encode("utf-8"),
)
with urlopen(request, timeout=30) as response:
text = response.read().decode("utf-8")
result = json.loads(text) if text else NoneResponses
| Status | Meaning |
|---|---|
400 | Invalid request; device token polling uses RFC 8628 string errors |
402 | spend_limit_exceeded: inspect details.scope (org/grant/line) and outstanding_micros |
403 | Missing authority, policy_violation, approval_required (details.approval_request), limit_reached, destination_not_supported or feature_disabled (details.feature) |
409 | Conflict, idempotency in progress, or a2p_registration_pending; retrieve state instead of duplicating work |
422 | validation_error: the request is not valid; details name each field |
429 | Rate limited; back off and retain the same idempotency key |
502 | provider_error: unknown routes need verified quotes; ambiguous operations retain resource references and cost holds |
2XX | Success (created objects use 201) |
default | Error |
Status ranges such as 2XX are retained exactly as declared. See Errors and recovery for retries and pending outcomes.
400 response
Content type: application/json
Type: Error
Required means required within its containing object, when that object is present. Union/conditional constraints remain defined by the JSON Schema below.
| Field | Type | Presence | Description / constraints |
|---|---|---|---|
error | object | Required | Additional properties allowed |
error.code | string | Required | — |
error.details | object | Optional | Additional properties allowed |
error.message | string | Required | — |
JSON Schema
json
{
"$ref": "#/components/schemas/Error"
}2XX response
Content type: application/json
Type: object
JSON Schema
json
{
"additionalProperties": true,
"properties": {},
"type": "object"
}Illustrative response template
Placeholder values show the shape, not a live response. Nullable costs remain null rather than implying zero usage.
json
{}default response
Content type: application/json
Type: Error
Required means required within its containing object, when that object is present. Union/conditional constraints remain defined by the JSON Schema below.
| Field | Type | Presence | Description / constraints |
|---|---|---|---|
error | object | Required | Additional properties allowed |
error.code | string | Required | — |
error.details | object | Optional | Additional properties allowed |
error.message | string | Required | — |
JSON Schema
json
{
"$ref": "#/components/schemas/Error"
}