Create Organization
Creates a new organization in your account.
Endpoint
POST /api/organizations
Authentication
Requires API Key authentication.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Organization name |
phone_number | string | Yes | Primary contact phone number |
street_address | string | Yes | Physical street address |
city | string | Yes | City |
state | string | Yes | State or province |
zip_code | string | Yes | ZIP or postal code |
country | string | Yes | Country |
Response
Returns the created organization object.
{
"success": true,
"data": {
"id": "org_abc123def456",
"account_id": "acc_xyz789",
"name": "Smith & Associates Law Firm",
"phone_number": "555-123-4567",
"street_address": "123 Main Street, Suite 400",
"city": "San Francisco",
"state": "CA",
"zip_code": "94102",
"country": "United States",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
}
Example
curl -X POST "https://api.silentwitness.ai/api/organizations" \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Smith & Associates Law Firm",
"phone_number": "555-123-4567",
"street_address": "123 Main Street, Suite 400",
"city": "San Francisco",
"state": "CA",
"zip_code": "94102",
"country": "United States"
}'
Errors
error_code | HTTP | error_type | Meaning |
|---|---|---|---|
org_invalid_body | 400 | invalid_request_error | Request body is not valid JSON. |
org_field_required | 400 | invalid_request_error | A required field is missing. error_param identifies which one. |
org_create_failed | 500 | api_error | Unexpected server error during creation. Include request_id when contacting support. |
Example Error
{
"success": false,
"error": "Name is required",
"error_code": "org_field_required",
"error_type": "invalid_request_error",
"error_param": "name",
"request_id": "req_9c1b3a7e4d2f4a80a9b3e7c1f8d2a4b6"
}
Notes
- All seven fields are required when creating an organization
- The
idandaccount_idare generated automatically - Pass the returned
idasorganization_idwhen creating cases