curl --request POST \
--url https://web-api.dev.soxai.site/api/orgs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"orgName": "Example Clinic",
"orgPhone": "+81-3-1234-5678",
"orgAddress": "1-2-3 Chiyoda, Tokyo",
"orgEmail": "contact@example.com"
}
'import requests
url = "https://web-api.dev.soxai.site/api/orgs"
payload = {
"orgName": "Example Clinic",
"orgPhone": "+81-3-1234-5678",
"orgAddress": "1-2-3 Chiyoda, Tokyo",
"orgEmail": "contact@example.com"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
orgName: 'Example Clinic',
orgPhone: '+81-3-1234-5678',
orgAddress: '1-2-3 Chiyoda, Tokyo',
orgEmail: 'contact@example.com'
})
};
fetch('https://web-api.dev.soxai.site/api/orgs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"message": "Org created successfully",
"org_id": "org_ab12cd34",
"org": {
"orgId": "org_ab12cd34",
"orgName": "SOXAI Research",
"orgEmail": "research@example.com",
"orgPhone": "03-0000-0000",
"orgAddress": "1-1-1 Chiyoda, Tokyo",
"companyId": "company_9f8e7d"
}
}{
"error": "bad-request",
"error_msg": "Invalid input: <reason>"
}{
"error": "http-error",
"error_msg": "Invalid authentication credentials. <reason>"
}{
"error": "forbidden",
"error_msg": "Not enough permission"
}{
"error": "conflict",
"error_msg": "Org 'SOXAI Research' already exists in this company"
}{
"error": "unprocessable-entity",
"error_msg": "body.<field>: <validation message>"
}{
"error": "rate-limited",
"error_msg": "Rate limit exceeded. Retry after <n> seconds."
}{
"error": "internal-server-error",
"error_msg": "Failed to fetch data: <error_message>"
}Create an organization
A request authenticated with a Sandbox soxai-api-key is answered 403 This endpoint is not available in the sandbox., because it changes state that every Sandbox caller shares. It is published here because the Sandbox runs the same build; use it in Production. See Sandbox.
Create an organization. An organization owns a member roster
(OrgUsers) and is the unit every org-scoped endpoint addresses by the org_id this call
returns.
The caller does not choose the owning company. A PartnerAdmin always creates the org under
its own company; an Admin always creates it with no company and can move it to one later
with PUT /api/orgs/{org_id}.
Parameters
- Body (
Org):orgName,orgPhone,orgAddressandorgEmailare required. orgIdandcompanyIdsent in the body are ignored.orgIdis assigned by the server;companyIdis taken from the caller as described above.
Response
200returns{"message", "org_id", "org"}.
Errors
| Status | Condition |
|---|---|
| 409 | An organization with the same orgName already exists in the same company. Organizations with no company form one group of their own. Nothing is written |
Authorization
- Scheme:
Authorization: Bearer <idToken>orsoxai-api-key: <api key>. - Accepted roles:
Admin,PartnerAdmin - Any other caller receives
403 Not enough permission.
curl --request POST \
--url https://web-api.dev.soxai.site/api/orgs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"orgName": "Example Clinic",
"orgPhone": "+81-3-1234-5678",
"orgAddress": "1-2-3 Chiyoda, Tokyo",
"orgEmail": "contact@example.com"
}
'import requests
url = "https://web-api.dev.soxai.site/api/orgs"
payload = {
"orgName": "Example Clinic",
"orgPhone": "+81-3-1234-5678",
"orgAddress": "1-2-3 Chiyoda, Tokyo",
"orgEmail": "contact@example.com"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
orgName: 'Example Clinic',
orgPhone: '+81-3-1234-5678',
orgAddress: '1-2-3 Chiyoda, Tokyo',
orgEmail: 'contact@example.com'
})
};
fetch('https://web-api.dev.soxai.site/api/orgs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"message": "Org created successfully",
"org_id": "org_ab12cd34",
"org": {
"orgId": "org_ab12cd34",
"orgName": "SOXAI Research",
"orgEmail": "research@example.com",
"orgPhone": "03-0000-0000",
"orgAddress": "1-1-1 Chiyoda, Tokyo",
"companyId": "company_9f8e7d"
}
}{
"error": "bad-request",
"error_msg": "Invalid input: <reason>"
}{
"error": "http-error",
"error_msg": "Invalid authentication credentials. <reason>"
}{
"error": "forbidden",
"error_msg": "Not enough permission"
}{
"error": "conflict",
"error_msg": "Org 'SOXAI Research' already exists in this company"
}{
"error": "unprocessable-entity",
"error_msg": "body.<field>: <validation message>"
}{
"error": "rate-limited",
"error_msg": "Rate limit exceeded. Retry after <n> seconds."
}{
"error": "internal-server-error",
"error_msg": "Failed to fetch data: <error_message>"
}Authorizations
Body
Response
The organization as created, with the org_id the other organization endpoints take.