Show examples in:
JavascriptHTTP
Endpoint info
Available examples
Dashboard API > Account

Convert to organization

Warning: Experimental API

Please note that the Dashboard API is an experimental, prerelease API. This API method is considered unstable, and should be avoided in production environments and automations. Changes may occur at any time without warning.

Body parameters

typestringRequired

Must be exactly "organization_conversion".

attributes.namestringRequired

Name of the organization

Returns

Returns a Job ID. You can then poll for thecompletion of the jobthat will eventually return a resource object of type organization

Examples

The response contains the ID of the asynchronous job that started:

POST https://site-api.datocms.com/account/convert-to-organization HTTP/1.1
Authorization: Bearer YOUR-API-TOKEN
Accept: application/json
X-Api-Version: 3
Content-Type: application/vnd.api+json
{
"data": {
"type": "organization_conversion",
"attributes": {
"name": ""
}
}
}
Terminal window
curl -g 'https://site-api.datocms.com/account/convert-to-organization' \
-X POST \
-H "Authorization: Bearer YOUR-API-TOKEN" \
-H "Accept: application/json" \
-H "X-Api-Version: 3" \
-H "Content-Type: application/vnd.api+json" \
--data-binary '{"data":{"type":"organization_conversion","attributes":{"name":""}}}'
await fetch("https://site-api.datocms.com/account/convert-to-organization", {
method: "POST",
headers: {
Authorization: "Bearer YOUR-API-TOKEN",
Accept: "application/json",
"X-Api-Version": "3",
"Content-Type": "application/vnd.api+json",
},
body: JSON.stringify({
data: { type: "organization_conversion", attributes: { name: "" } },
}),
});
HTTP/1.1 202 Accepted
Content-Type: application/json
Cache-Control: cache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 28
{
"data": {
"type": "job",
"id": "4235"
}
}

To get the asynchronous job result, poll the job result endpoint. While the task is in progress, the endpoint returns a 404 status code. When the job completes, the status changes to 200 OK:

GET https://site-api.datocms.com/job-results/:job_result_id HTTP/1.1
Authorization: Bearer YOUR-API-TOKEN
Accept: application/json
X-Api-Version: 3
Terminal window
curl -g 'https://site-api.datocms.com/job-results/:job_result_id' \
\
-H "Authorization: Bearer YOUR-API-TOKEN" \
-H "Accept: application/json" \
-H "X-Api-Version: 3"
await fetch("https://site-api.datocms.com/job-results/:job_result_id", {
headers: {
Authorization: "Bearer YOUR-API-TOKEN",
Accept: "application/json",
"X-Api-Version": "3",
},
});
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: cache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 28
{
"data": {
"type": "job_result",
"id": "34",
"attributes": {
"status": 200,
"payload": {
"data": {
"type": "organization",
"id": "124",
"attributes": {
"name": ""
},
"meta": {
"discount_on_public_plans": 20,
"agency_partner": null
},
"relationships": {
"active_subscription": {
"data": {
"type": "per_owner_pricing_subscription",
"id": "124"
}
},
"billing_profile": {
"data": null
}
}
}
}
}
}
}