curl --request POST \
--url https://api.cufea.com/v1/partner/tenants \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"authorization": {
"authorized_at": "2026-11-20T15:04:00-05:00",
"evidence_ref": "fhyra:company/8812/consents/31",
"text_version": "fhyra-mandato-fe-v1",
"evidence_sha256": "<string>"
},
"check_digit": "8",
"contact_email": "<string>",
"legal_name": "<string>",
"nit": "900123456"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
authorization: {
authorized_at: '2026-11-20T15:04:00-05:00',
evidence_ref: 'fhyra:company/8812/consents/31',
text_version: 'fhyra-mandato-fe-v1',
evidence_sha256: '<string>'
},
check_digit: '8',
contact_email: '<string>',
legal_name: '<string>',
nit: '900123456'
})
};
fetch('https://api.cufea.com/v1/partner/tenants', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.cufea.com/v1/partner/tenants"
payload = {
"authorization": {
"authorized_at": "2026-11-20T15:04:00-05:00",
"evidence_ref": "fhyra:company/8812/consents/31",
"text_version": "fhyra-mandato-fe-v1",
"evidence_sha256": "<string>"
},
"check_digit": "8",
"contact_email": "<string>",
"legal_name": "<string>",
"nit": "900123456"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"check_digit": "<string>",
"contact_email": "<string>",
"created": true,
"dian_environment": "test",
"legal_name": "<string>",
"nit": "<string>",
"status": "active",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"test_set_accepted": true,
"active_keys": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"prefix": "<string>",
"revoked": true,
"stage": "sandbox",
"revoked_at": "2023-11-07T05:31:56Z"
}
],
"api_keys": [
{
"api_key": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"prefix": "<string>",
"revoked": true,
"stage": "sandbox",
"revoked_at": "2023-11-07T05:31:56Z"
}
],
"created_at": "2023-11-07T05:31:56Z"
}{
"check_digit": "<string>",
"contact_email": "<string>",
"created": true,
"dian_environment": "test",
"legal_name": "<string>",
"nit": "<string>",
"status": "active",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"test_set_accepted": true,
"active_keys": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"prefix": "<string>",
"revoked": true,
"stage": "sandbox",
"revoked_at": "2023-11-07T05:31:56Z"
}
],
"api_keys": [
{
"api_key": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"prefix": "<string>",
"revoked": true,
"stage": "sandbox",
"revoked_at": "2023-11-07T05:31:56Z"
}
],
"created_at": "2023-11-07T05:31:56Z"
}{
"code": "unauthorized",
"detail": "Missing or invalid API key.",
"request_id": "3668a7374b1e4314b2f932a5620da1f1",
"status": 401,
"title": "Unauthorized",
"type": "urn:cufea:problem:unauthorized"
}{
"code": "<string>",
"detail": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"type": "<string>",
"dian": {
"rule": "<string>",
"text": "<string>"
}
}{
"code": "<string>",
"detail": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"type": "<string>",
"dian": {
"rule": "<string>",
"text": "<string>"
}
}{
"code": "validation_error",
"detail": "The request is not valid; see `errors` for the offending fields.",
"errors": [
{
"loc": [
"body",
"customer"
],
"msg": "Field required"
},
{
"loc": [
"body",
"lines"
],
"msg": "List should have at least 1 item after validation, not 0"
}
],
"request_id": "88272d6eb903438690d3193e3113270a",
"status": 422,
"title": "Request validation failed",
"type": "urn:cufea:problem:validation_error"
}{
"code": "rate_limited",
"detail": "This API key made more than 120 requests in the current window. Retry after 17 seconds.",
"request_id": "5d1c0b6f2e8a4f0c9a7b3e2d1c0f9a8b",
"status": 429,
"title": "Too Many Requests",
"type": "urn:cufea:problem:rate_limited"
}{
"code": "<string>",
"detail": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"type": "<string>",
"dian": {
"rule": "<string>",
"text": "<string>"
}
}Provision a client company as a tenant
Creates the tenant of a client company, identified by its NIT, and stores the client’s written authorization of the partner (date, text version and where the partner keeps the signed copy). Idempotent per NIT: when this partner already has a tenant for the NIT, the same company data answers 200 with created: false and issues no key (a key is shown once and never stored); other data answers 409 tenant_nit_conflict. The tenant starts in the DIAN test stage with no issuer: set it with the tenant’s test key (PUT /v1/tenant/issuer), and its NIT must be this one (409 issuer_nit_locked otherwise).
curl --request POST \
--url https://api.cufea.com/v1/partner/tenants \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"authorization": {
"authorized_at": "2026-11-20T15:04:00-05:00",
"evidence_ref": "fhyra:company/8812/consents/31",
"text_version": "fhyra-mandato-fe-v1",
"evidence_sha256": "<string>"
},
"check_digit": "8",
"contact_email": "<string>",
"legal_name": "<string>",
"nit": "900123456"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
authorization: {
authorized_at: '2026-11-20T15:04:00-05:00',
evidence_ref: 'fhyra:company/8812/consents/31',
text_version: 'fhyra-mandato-fe-v1',
evidence_sha256: '<string>'
},
check_digit: '8',
contact_email: '<string>',
legal_name: '<string>',
nit: '900123456'
})
};
fetch('https://api.cufea.com/v1/partner/tenants', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.cufea.com/v1/partner/tenants"
payload = {
"authorization": {
"authorized_at": "2026-11-20T15:04:00-05:00",
"evidence_ref": "fhyra:company/8812/consents/31",
"text_version": "fhyra-mandato-fe-v1",
"evidence_sha256": "<string>"
},
"check_digit": "8",
"contact_email": "<string>",
"legal_name": "<string>",
"nit": "900123456"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"check_digit": "<string>",
"contact_email": "<string>",
"created": true,
"dian_environment": "test",
"legal_name": "<string>",
"nit": "<string>",
"status": "active",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"test_set_accepted": true,
"active_keys": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"prefix": "<string>",
"revoked": true,
"stage": "sandbox",
"revoked_at": "2023-11-07T05:31:56Z"
}
],
"api_keys": [
{
"api_key": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"prefix": "<string>",
"revoked": true,
"stage": "sandbox",
"revoked_at": "2023-11-07T05:31:56Z"
}
],
"created_at": "2023-11-07T05:31:56Z"
}{
"check_digit": "<string>",
"contact_email": "<string>",
"created": true,
"dian_environment": "test",
"legal_name": "<string>",
"nit": "<string>",
"status": "active",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"test_set_accepted": true,
"active_keys": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"prefix": "<string>",
"revoked": true,
"stage": "sandbox",
"revoked_at": "2023-11-07T05:31:56Z"
}
],
"api_keys": [
{
"api_key": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"prefix": "<string>",
"revoked": true,
"stage": "sandbox",
"revoked_at": "2023-11-07T05:31:56Z"
}
],
"created_at": "2023-11-07T05:31:56Z"
}{
"code": "unauthorized",
"detail": "Missing or invalid API key.",
"request_id": "3668a7374b1e4314b2f932a5620da1f1",
"status": 401,
"title": "Unauthorized",
"type": "urn:cufea:problem:unauthorized"
}{
"code": "<string>",
"detail": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"type": "<string>",
"dian": {
"rule": "<string>",
"text": "<string>"
}
}{
"code": "<string>",
"detail": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"type": "<string>",
"dian": {
"rule": "<string>",
"text": "<string>"
}
}{
"code": "validation_error",
"detail": "The request is not valid; see `errors` for the offending fields.",
"errors": [
{
"loc": [
"body",
"customer"
],
"msg": "Field required"
},
{
"loc": [
"body",
"lines"
],
"msg": "List should have at least 1 item after validation, not 0"
}
],
"request_id": "88272d6eb903438690d3193e3113270a",
"status": 422,
"title": "Request validation failed",
"type": "urn:cufea:problem:validation_error"
}{
"code": "rate_limited",
"detail": "This API key made more than 120 requests in the current window. Retry after 17 seconds.",
"request_id": "5d1c0b6f2e8a4f0c9a7b3e2d1c0f9a8b",
"status": 429,
"title": "Too Many Requests",
"type": "urn:cufea:problem:rate_limited"
}{
"code": "<string>",
"detail": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"type": "<string>",
"dian": {
"rule": "<string>",
"text": "<string>"
}
}Autorizaciones
Cuerpo
The client company to provision. One tenant per NIT and partner: repeating the call
with the same data answers the existing tenant (200, created: false).
Respuesta
The partner already had this tenant (created: false).