Destroy an organization
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
Must be exactly "organization_destroy_request".
Current password
OTP code
"123456"
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/organizations/:organization_id/destroy HTTP/1.1Authorization: Bearer YOUR-API-TOKENAccept: application/jsonX-Api-Version: 3Content-Type: application/vnd.api+json
{ "data": { "type": "organization_destroy_request", "attributes": { "password": "" } }}curl -g 'https://site-api.datocms.com/organizations/:organization_id/destroy' \ -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_destroy_request","attributes":{"password":""}}}'await fetch( "https://site-api.datocms.com/organizations/:organization_id/destroy", { 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_destroy_request", attributes: { password: "" }, }, }), },);HTTP/1.1 202 AcceptedContent-Type: application/jsonCache-Control: cache-control: max-age=0, private, must-revalidateX-RateLimit-Limit: 30X-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.1Authorization: Bearer YOUR-API-TOKENAccept: application/jsonX-Api-Version: 3curl -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 OKContent-Type: application/jsonCache-Control: cache-control: max-age=0, private, must-revalidateX-RateLimit-Limit: 30X-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 } } } } } }}