Delete or close organization (owner only)
curl --request DELETE \
--url https://api.example.com/organizations/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/organizations/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.example.com/organizations/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/organizations/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/organizations/{id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.example.com/organizations/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/organizations/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": "closed",
"closedAt": "2026-10-23T16:00:00.000Z",
"retainedUntil": "2033-01-01T05:59:59.000Z"
}Organizations
Delete Organization
⚠️ SECURITY: Only the organization OWNER can perform this action. If the organization has never stamped a production CFDI, it is deleted PERMANENTLY (sandbox invoices included). If it has production CFDI, it is CLOSED instead: it becomes read-only, its CFDI are retained and downloadable until retainedUntil, API keys, webhooks and OAuth apps are deactivated, and the Stripe subscription is set to cancel at the end of the paid period (no refunds). Closing an already-closed organization returns the existing close. Use GET /organizations/:id/close-preview to know which will happen.
DELETE
/
organizations
/
{id}
Delete or close organization (owner only)
curl --request DELETE \
--url https://api.example.com/organizations/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/organizations/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.example.com/organizations/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/organizations/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/organizations/{id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.example.com/organizations/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/organizations/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": "closed",
"closedAt": "2026-10-23T16:00:00.000Z",
"retainedUntil": "2033-01-01T05:59:59.000Z"
}Deletes an organization, or closes it when it has production CFDI.
An organization with stamped production CFDI is never erased: Timbrix must keep those CFDI available for the period required by the Código Fiscal de la Federación. In that case the organization is closed instead, and you can reopen it later.
When an organization is deleted, its Stripe subscription is canceled immediately, without proration or refund. If a production CFDI is stamped while the delete is running, the organization is closed instead and the response is
Authentication
This endpoint requires authentication via Bearer token:- Authorization:
Bearer <token>
Permissions
Only the organization owner can delete or close it. Use Close Preview to see which of the two will happen.Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Organization UUID |
Delete vs. close
| Situation | Result |
|---|---|
| No production CFDI | The organization and all its data are permanently deleted (status: "deleted"). |
| Has production CFDI | The organization is closed (status: "closed"). |
status: "closed".
When an organization is closed:
- Its CFDI stay readable and downloadable by members until
retainedUntil(31 December of the 6th year after stamping, Mexico City time). - The Stripe subscription is scheduled to cancel at the end of the billing period.
- API keys, webhooks and OAuth apps are deactivated.
- Any write on the organization fails with
403 ORGANIZATION_CLOSED.
What happens to your data after closing
- Certificate (CSD): the certificate, the private key and its password are deleted right after the organization is closed or deleted. If you reopen it, you must upload the CSD again.
- After 90 days: customers, products, webhooks (and their delivery history), API keys, OAuth apps and pending invitations are deleted. Invoices with their XML and PDF files, series, members, legal data and the organization itself are kept.
- Reopening: if you reopen before 90 days, you recover everything except the CSD. After 90 days, only the invoices remain. Closing the organization again reschedules the cleanup.
certificateWillBeDeleted and dataPurgeDays so you can warn your users before closing. GET /organizations/{id} returns data_purge_at (when the cleanup will run) and data_purged_at (when it ran).
Closing is refused with 409 ORGANIZATION_HAS_PENDING_OPERATIONS while a stamp or a cancellation is still pending.
Example Request
curl -X DELETE https://api.timbrix.mx/organizations/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer <your_token>"
import { Timbrix } from "@timbrix/sdk"
const client = new Timbrix({ bearerToken: "<your_token>" })
const result = await client.organizations.delete(
"550e8400-e29b-41d4-a716-446655440000"
)
console.log(result.status) // "deleted" | "closed"
Example Response
{ "status": "deleted" }
{
"status": "closed",
"closedAt": "2026-10-23T18:00:00.000Z",
"retainedUntil": "2033-01-01T05:59:59.000Z"
}
closedAt and retainedUntil are UTC instants (ISO 8601). In this example, 2033-01-01T05:59:59.000Z is 31 December 2032, 23:59:59 America/Mexico_City time. Show it in that time zone, not in UTC.
Status: 200 OK. Previously this endpoint returned 204 No Content.
Common Errors
403 Forbidden
Only the owner can delete the organization.{
"statusCode": 403,
"message": "Access denied. Only the organization owner can delete the organization",
"error": "FORBIDDEN"
}
404 Not Found
{
"statusCode": 404,
"message": "Organization not found",
"error": "NOT_FOUND"
}
409 ORGANIZATION_HAS_PENDING_OPERATIONS
A stamp or cancellation is still pending. Try again once it finishes.{
"statusCode": 409,
"message": "The organization has pending stamps or cancellations",
"error": "ORGANIZATION_HAS_PENDING_OPERATIONS"
}
409 CONFLICT
The owner of the organization changed while the request was running. Check its current state and retry.Authorizations
Response
{ status: 'deleted' } when deleted permanently, or { status: 'closed', closedAt, retainedUntil } when closed.