Crear Customer, Subscription e Invoice
Changed onPara cargar Invoices en Toku normalmente se crean primero un Customer, luego una Subscription y, si aplica, una Invoice, en llamadas separadas. Este endpoint consolida ese flujo: crea las tres entidades en una sola petición y de forma atómica (si algún paso falla, se revierte toda la operación).
- El Customer es obligatorio; la Invoice es opcional.
- La Subscription se asocia automáticamente al Customer recién creado, y la Invoice a ambos.
Devuelve los identificadores públicos de todas las entidades creadas. Es idempotente por los identificadores de cada entidad: si alguna ya existía, se actualiza y la respuesta es 200 en lugar de 201.
Límite de tasa: 20 solicitudes por segundo. Al superarlo, la API responde 429. Ver Límites de tasa.
Request
- Base URLhttps://api.trytoku.com
- URLhttps://api.trytoku.com/entities
- AuthAPI key in header x-api-key
Headers
Llave de API de una Account, para operar sobre esa Account en lugar de la principal.
Versión del API para esta petición, como cualquier fecha YYYY-MM-DD. Fija el contrato de la respuesta; si se omite, se deriva de la fecha de creación de la organización.
Request body
Example request
{
"customer": {
"external_id": "18579878K",
"government_id": "18579878K",
"mail": "jon@snow.got",
"name": "Jon Snow",
"phone_number": "+56987654321"
},
"invoice": {
"amount": 19990,
"due_date": "2025-03-10",
"expiration_date": "2025-03-10 00:00:00",
"invoice_external_id": "F-2025-000123",
"link_payment": "https://portal.pagos.com/tu-empresa",
"metadata": {
"sucursal": "Providencia"
},
"product_id": "plan-oro-marzo-2025"
},
"subscription": {
"amount": 19990,
"due_day": 5,
"interval": 1,
"is_recurring": true,
"product_id": "plan-oro-2025"
}
}Response
Alguna entidad ya existía y fue actualizada.
Example response
{
"id_customer": "cus_ejC08yLqOWoFhVx4Fx42E3IR9X50tNx2",
"id_invoice": "in_9K0bTq3xR7yA2sVpLmZ4wE1nHdJf6UcQ",
"id_subscription": "sub_Y_EgOXMloD5-IJn6d9S2IxkNvp9p0iiP"
}Changes
- breaking
request body became required
- breaking
for the
headerrequest parameterx-account-key, default valuewas added - breaking
added to the
/request propertyallOflist - breaking
added to the
/request propertyallOflist - breaking
added to the
/request propertyallOflist - breaking
added to the
/request propertyallOflist - breaking
the
/request property's minLength was increased from0to1 - breaking
added the pattern
^((https://)|(http://))[a-zA-Z0-9.\-_~+#,%&=*;:@!/()?_{}\[\]|~]+$to the request propertyinvoice/link_payment - breaking
added the pattern
^(?:[^ \n](?:[^\n]*[^ \n])?)?$to the request property/ - breaking
added the pattern
^\S+$to the request property/ - breaking
the
/request property type changed fromstringto no type - breaking
the
/request property type changed fromstringto no type - breaking
the
/request property type changed fromstringtonumber - breaking
the
/request property type changed fromstringto no type - breaking
the
/request property type changed fromstringtointeger - breaking
the
/request property type changed fromstringto no type - breaking
the
/request property type changed fromstringtointeger - breaking
the
/request property type changed fromstringtoboolean - warning
deleted the
headerrequest parameterx-api-key - warning
the
/request property's exclusiveMaximum was set to1000000000000000.00 - warning
the
/request property's exclusiveMaximum was set to1000000000000000.00 - warning
the
/request property's maxLength was set to128 - warning
the
/request property's maxLength was set to64 - warning
the
/request property's maxLength was set to128 - warning
the
/request property's maxLength was set to16 - warning
the
/request property's maxLength was set to256 - warning
the
/request property's maxLength was set to256 - warning
the
/request property's maxLength was set to256 - warning
the
/request property's maxLength was set to8 - warning
the
/request property's max was set to31.00 - warning
the
/request property's max was set to52.00 - warning
the
/request property's min was set to0.00 - warning
the
/request property's min was set to0.00 - warning
the
/request property's min was set to1.00 - warning
the
/request property's min was set to1.00 - info
api operation id
post_entitiesremoved and replaced withcreate_unified_entities - info
api tag
Customersadded - info
endpoint deprecated
- info
added the new optional
headerrequest parameterx-api-version - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
the request property
/became optional - info
the request property
/became optional - info
the
request property default valuefalsewas added - info
the
request property default valuefalsewas added - info
the
request property default value{}was added - info
added the media type
application/jsonfor the response with the status - info
added the media type
application/jsonfor the response with the status - info
added the media type
application/jsonfor the response with the status - info
added the media type
application/jsonfor the response with the status - info
added the non-success response with the status
- info
added the non-success response with the status
- info
added the non-success response with the status
- info
removed the non-success response with the status
- breaking