Codigos HTTP esperados
200/201 exito, 401 auth invalida, 403 modulo/tenant restringido, 422 validacion.
Busca por endpoint, modulo o verbo HTTP (ej: /reports/inventory, ventas, POST).
Actualizado con los endpoints activos de la plataforma. Total disponibles: 73.
| Contexto | Header requerido | Uso |
|---|---|---|
| Usuario cliente (Bearer) | Authorization: Bearer {token} X-Company-Id: {id} |
Apps moviles y sesiones por usuario. |
| Empresa (API Key) | X-API-Key: {api_key_empresa} | Integraciones server-to-server. |
| Base URL | https://troyansys.com/api/v1 | Todos los endpoints documentados usan este prefijo. |
200/201 exito, 401 auth invalida, 403 modulo/tenant restringido, 422 validacion.
POST /documents/invoices: crea comprobante, valida stock y ejecuta flujo SRI/email segun configuracion de empresa.
Cada modulo muestra sus metodos, payloads, ejemplos cURL/PHP/.NET y respuesta esperada.
Consulta de comprobantes, lookups comerciales y creacion de facturas por API con flujo SRI, stock y envio por correo.
Base URL: https://troyansys.com/api/v1
Obtiene comprobantes de venta paginados.
| Campo | Tipo | Req. | Descripcion |
|---|---|---|---|
| per_page | integer | No | Cantidad por pagina. |
| type | string | No | invoice, sales_order, quotation (y alias sales_note segun implementacion). |
| status | string | No | draft, issued, cancelled. |
curl -X GET "https://troyansys.com/api/v1/documents?per_page=20&type=invoice&status=issued" \
-H "Accept: application/json" \
-H "Authorization: Bearer {token}" \
-H "X-Company-Id: 1"
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://troyansys.com/api/v1/documents?per_page=20&type=invoice&status=issued', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer {token}',
'X-Company-Id' => '1'
],
]);
$data = json_decode((string) $response->getBody(), true);
print_r($data);
using System.Net.Http.Headers;
using System.Text;
var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://troyansys.com/api/v1/documents?per_page=20&type=invoice&status=issued");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "{token}");
request.Headers.Add("X-Company-Id", "1");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
curl -X GET "https://troyansys.com/api/v1/company/documents?per_page=20&type=invoice&status=issued" \
-H "Accept: application/json" \
-H "X-API-Key: {api_key_empresa}"
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://troyansys.com/api/v1/company/documents?per_page=20&type=invoice&status=issued', [
'headers' => [
'Accept' => 'application/json',
'X-API-Key' => '{api_key_empresa}'
],
]);
$data = json_decode((string) $response->getBody(), true);
print_r($data);
using System.Net.Http.Headers;
using System.Text;
var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://troyansys.com/api/v1/company/documents?per_page=20&type=invoice&status=issued");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
request.Headers.Add("X-API-Key", "{api_key_empresa}");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
{
"current_page": 1,
"data": [
{
"id": 100,
"type": "invoice",
"series": "001-001",
"number": "000000321",
"status": "issued",
"sri_status": "authorized",
"payment_status": "pending",
"total": "46.0000"
}
]
}
Obtiene detalle de un comprobante con items, estado SRI, estado de pago y metadatos de envio.
curl -X GET "https://troyansys.com/api/v1/documents/100" \
-H "Accept: application/json" \
-H "Authorization: Bearer {token}" \
-H "X-Company-Id: 1"
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://troyansys.com/api/v1/documents/100', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer {token}',
'X-Company-Id' => '1'
],
]);
$data = json_decode((string) $response->getBody(), true);
print_r($data);
using System.Net.Http.Headers;
using System.Text;
var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://troyansys.com/api/v1/documents/100");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "{token}");
request.Headers.Add("X-Company-Id", "1");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
curl -X GET "https://troyansys.com/api/v1/company/documents/100" \
-H "Accept: application/json" \
-H "X-API-Key: {api_key_empresa}"
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://troyansys.com/api/v1/company/documents/100', [
'headers' => [
'Accept' => 'application/json',
'X-API-Key' => '{api_key_empresa}'
],
]);
$data = json_decode((string) $response->getBody(), true);
print_r($data);
using System.Net.Http.Headers;
using System.Text;
var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://troyansys.com/api/v1/company/documents/100");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
request.Headers.Add("X-API-Key", "{api_key_empresa}");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
{
"id": 100,
"type": "invoice",
"series": "001-001",
"number": "000000321",
"status": "issued",
"issue_date": "2026-02-25",
"sri_status": "authorized",
"payment_status": "partial",
"total": "46.0000",
"customer": {
"id": 2,
"name": "Cliente Demo",
"identification": "0999999999"
},
"items": [
{
"id": 1,
"product_id": 10,
"description": "Lapiz HB",
"quantity": "2.000",
"unit_price": "12.5000",
"tax_rate": "15.0000"
}
],
"sri_response": {
"status": "authorized",
"mail": {
"status": "sent"
}
}
}
Lista clientes activos para autocompletado de documentos de venta.
| Campo | Tipo | Req. | Descripcion |
|---|---|---|---|
| q | string | No | Filtro por nombre, identificacion, RUC, cedula o codigo. |
| per_page | integer | No | Cantidad por pagina (1 a 100). |
curl -X GET "https://troyansys.com/api/v1/documents/lookups/customers?q=cliente&per_page=20" \
-H "Accept: application/json" \
-H "Authorization: Bearer {token}" \
-H "X-Company-Id: 1"
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://troyansys.com/api/v1/documents/lookups/customers?q=cliente&per_page=20', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer {token}',
'X-Company-Id' => '1'
],
]);
$data = json_decode((string) $response->getBody(), true);
print_r($data);
using System.Net.Http.Headers;
using System.Text;
var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://troyansys.com/api/v1/documents/lookups/customers?q=cliente&per_page=20");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "{token}");
request.Headers.Add("X-Company-Id", "1");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
curl -X GET "https://troyansys.com/api/v1/company/documents/lookups/customers?q=cliente&per_page=20" \
-H "Accept: application/json" \
-H "X-API-Key: {api_key_empresa}"
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://troyansys.com/api/v1/company/documents/lookups/customers?q=cliente&per_page=20', [
'headers' => [
'Accept' => 'application/json',
'X-API-Key' => '{api_key_empresa}'
],
]);
$data = json_decode((string) $response->getBody(), true);
print_r($data);
using System.Net.Http.Headers;
using System.Text;
var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://troyansys.com/api/v1/company/documents/lookups/customers?q=cliente&per_page=20");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
request.Headers.Add("X-API-Key", "{api_key_empresa}");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
{
"data": [
{
"id": 2,
"name": "Cliente Demo",
"identification": "0999999999",
"ruc": null,
"cedula": "0999999999",
"code": "CLI-0002"
}
],
"meta": {
"current_page": 1,
"last_page": 1,
"per_page": 20,
"total": 1
}
}
Devuelve establecimientos habilitados para el tipo de documento seleccionado.
| Campo | Tipo | Req. | Descripcion |
|---|---|---|---|
| type | string | No | Tipo de documento: invoice, sales_order, quotation, credit_note o debit_note. |
curl -X GET "https://troyansys.com/api/v1/documents/lookups/establishments?type=invoice" \
-H "Accept: application/json" \
-H "Authorization: Bearer {token}" \
-H "X-Company-Id: 1"
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://troyansys.com/api/v1/documents/lookups/establishments?type=invoice', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer {token}',
'X-Company-Id' => '1'
],
]);
$data = json_decode((string) $response->getBody(), true);
print_r($data);
using System.Net.Http.Headers;
using System.Text;
var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://troyansys.com/api/v1/documents/lookups/establishments?type=invoice");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "{token}");
request.Headers.Add("X-Company-Id", "1");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
curl -X GET "https://troyansys.com/api/v1/company/documents/lookups/establishments?type=invoice" \
-H "Accept: application/json" \
-H "X-API-Key: {api_key_empresa}"
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://troyansys.com/api/v1/company/documents/lookups/establishments?type=invoice', [
'headers' => [
'Accept' => 'application/json',
'X-API-Key' => '{api_key_empresa}'
],
]);
$data = json_decode((string) $response->getBody(), true);
print_r($data);
using System.Net.Http.Headers;
using System.Text;
var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://troyansys.com/api/v1/company/documents/lookups/establishments?type=invoice");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
request.Headers.Add("X-API-Key", "{api_key_empresa}");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
{
"data": [
{
"id": 1,
"code": "001",
"name": "Establecimiento 001"
}
]
}
Devuelve puntos de emision disponibles y su serie para facturacion.
| Campo | Tipo | Req. | Descripcion |
|---|---|---|---|
| type | string | No | Tipo de documento. |
| establishment | string(3) | No | Codigo de establecimiento (001). |
| establishment_code | string(3) | No | Alias de establishment para compatibilidad. |
| establishment_id | integer | No | Alias numerico de establecimiento. |
curl -X GET "https://troyansys.com/api/v1/documents/lookups/points-of-sale?type=invoice&establishment=001" \
-H "Accept: application/json" \
-H "Authorization: Bearer {token}" \
-H "X-Company-Id: 1"
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://troyansys.com/api/v1/documents/lookups/points-of-sale?type=invoice&establishment=001', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer {token}',
'X-Company-Id' => '1'
],
]);
$data = json_decode((string) $response->getBody(), true);
print_r($data);
using System.Net.Http.Headers;
using System.Text;
var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://troyansys.com/api/v1/documents/lookups/points-of-sale?type=invoice&establishment=001");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "{token}");
request.Headers.Add("X-Company-Id", "1");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
curl -X GET "https://troyansys.com/api/v1/company/documents/lookups/points-of-sale?type=invoice&establishment=001" \
-H "Accept: application/json" \
-H "X-API-Key: {api_key_empresa}"
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://troyansys.com/api/v1/company/documents/lookups/points-of-sale?type=invoice&establishment=001', [
'headers' => [
'Accept' => 'application/json',
'X-API-Key' => '{api_key_empresa}'
],
]);
$data = json_decode((string) $response->getBody(), true);
print_r($data);
using System.Net.Http.Headers;
using System.Text;
var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://troyansys.com/api/v1/company/documents/lookups/points-of-sale?type=invoice&establishment=001");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
request.Headers.Add("X-API-Key", "{api_key_empresa}");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
{
"data": [
{
"id": 2,
"establishment_id": 1,
"name": "Punto 001-002",
"code": "002",
"series": "001-002"
}
]
}
Calcula la siguiente numeracion disponible para una serie y tipo de documento.
| Campo | Tipo | Req. | Descripcion |
|---|---|---|---|
| type | string | No | Tipo de documento (default invoice). |
| series | string | No | Serie en formato 001-001. |
| establishment | string(3) | No | Codigo de establecimiento para resolver serie. |
| point_of_sale | string(3) | No | Codigo de punto de emision para resolver serie. |
curl -X GET "https://troyansys.com/api/v1/documents/sequence-preview?type=invoice&series=001-002" \
-H "Accept: application/json" \
-H "Authorization: Bearer {token}" \
-H "X-Company-Id: 1"
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://troyansys.com/api/v1/documents/sequence-preview?type=invoice&series=001-002', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer {token}',
'X-Company-Id' => '1'
],
]);
$data = json_decode((string) $response->getBody(), true);
print_r($data);
using System.Net.Http.Headers;
using System.Text;
var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://troyansys.com/api/v1/documents/sequence-preview?type=invoice&series=001-002");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "{token}");
request.Headers.Add("X-Company-Id", "1");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
curl -X GET "https://troyansys.com/api/v1/company/documents/sequence-preview?type=invoice&series=001-002" \
-H "Accept: application/json" \
-H "X-API-Key: {api_key_empresa}"
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://troyansys.com/api/v1/company/documents/sequence-preview?type=invoice&series=001-002', [
'headers' => [
'Accept' => 'application/json',
'X-API-Key' => '{api_key_empresa}'
],
]);
$data = json_decode((string) $response->getBody(), true);
print_r($data);
using System.Net.Http.Headers;
using System.Text;
var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://troyansys.com/api/v1/company/documents/sequence-preview?type=invoice&series=001-002");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
request.Headers.Add("X-API-Key", "{api_key_empresa}");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
{
"type": "invoice",
"series": "001-002",
"establishment": "001",
"emission_point": "002",
"next_number": "000000217",
"display_number": "001-002-000000217"
}
Crea factura y ejecuta flujo: registro, validacion stock, intento SRI, generacion PDF/XML y envio email.
| Campo | Tipo | Req. | Descripcion |
|---|---|---|---|
| warehouse_id | integer | Si | Bodega de salida para validar/afectar stock. |
| customer_id | integer | No | Cliente del comprobante. |
| source_document_id | integer | No | Documento origen para conversion (orden -> factura). |
| series | string | No | Serie 001-001. Si no se envia se usa configuracion de empresa. |
| number | string | No | Numero manual (si aplica). En factura normalmente se autogenera por secuencia. |
| issue_date | date | No | Fecha de emision YYYY-MM-DD. |
| due_date | date | No | Fecha de vencimiento. |
| due_days | integer | No | Dias para calcular vencimiento desde issue_date. |
| reference | string | No | Referencia interna/externa. |
| seller_name | string | No | Nombre de vendedor. |
| order_reference | string | No | Referencia de OC/OV externa. |
| notes | string | No | Observaciones del comprobante. |
| currency | string(3) | No | Moneda (default USD). |
| delivered | boolean | No | Marca de entregado. |
| submit_mode | string | No | issued (default) o draft. |
| register_initial_payment | boolean | No | Registra pago inicial al emitir (facturas/notas aplicables). |
| initial_payment_amount | numeric | No | Monto de pago inicial. |
| initial_payment_date | date | No | Fecha del pago inicial. |
| initial_payment_method | string | No | Metodo del pago inicial. |
| initial_payment_reference | string | No | Referencia bancaria/comercial del pago inicial. |
| initial_payment_notes | string | No | Notas del pago inicial. |
| items | array | Si | Detalle de productos. |
| items[].product_id | integer | No | Producto existente de la empresa. |
| items[].description | string | No | Descripcion libre si no envia product_id. |
| items[].quantity | numeric | Si | Cantidad > 0. |
| items[].unit_price | numeric | No | Precio unitario. Si omite usa precio del producto. |
| items[].tax_rate | numeric | No | IVA de la linea (0-100). Si omite usa IVA del producto. |
| items[].discount_mode | string | No | percent o amount. |
| items[].discount_value | numeric | No | Valor de descuento segun discount_mode. |
| items[].discount_rate | numeric | No | Compatibilidad para descuento porcentual legacy. |
curl -X POST "https://troyansys.com/api/v1/documents/invoices" \
-H "Accept: application/json" \
-H "Authorization: Bearer {token}" \
-H "X-Company-Id: 1" \
-H "Content-Type: application/json" \
-d '{
"warehouse_id": 1,
"customer_id": 2,
"series": "001-001",
"issue_date": "2026-02-22",
"reference": "Pedido APP-0001",
"due_days": 7,
"register_initial_payment": true,
"initial_payment_amount": 5,
"initial_payment_method": "transferencia",
"items": [
{
"product_id": 10,
"quantity": 2,
"unit_price": 12.5,
"tax_rate": 15,
"discount_mode": "amount",
"discount_value": 1.25
},
{
"product_id": 18,
"quantity": 1,
"unit_price": 8,
"tax_rate": 0,
"discount_mode": "percent",
"discount_value": 10
}
]
}'
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://troyansys.com/api/v1/documents/invoices', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer {token}',
'X-Company-Id' => '1',
'Content-Type' => 'application/json'
],
'json' => array (
'warehouse_id' => 1,
'customer_id' => 2,
'series' => '001-001',
'issue_date' => '2026-02-22',
'reference' => 'Pedido APP-0001',
'due_days' => 7,
'register_initial_payment' => true,
'initial_payment_amount' => 5.0,
'initial_payment_method' => 'transferencia',
'items' =>
array (
0 =>
array (
'product_id' => 10,
'quantity' => 2,
'unit_price' => 12.5,
'tax_rate' => 15,
'discount_mode' => 'amount',
'discount_value' => 1.25,
),
1 =>
array (
'product_id' => 18,
'quantity' => 1,
'unit_price' => 8,
'tax_rate' => 0,
'discount_mode' => 'percent',
'discount_value' => 10,
),
),
),
]);
$data = json_decode((string) $response->getBody(), true);
print_r($data);
using System.Net.Http.Headers;
using System.Text;
var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://troyansys.com/api/v1/documents/invoices");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "{token}");
request.Headers.Add("X-Company-Id", "1");
var json = "{\"warehouse_id\":1,\"customer_id\":2,\"series\":\"001-001\",\"issue_date\":\"2026-02-22\",\"reference\":\"Pedido APP-0001\",\"due_days\":7,\"register_initial_payment\":true,\"initial_payment_amount\":5,\"initial_payment_method\":\"transferencia\",\"items\":[{\"product_id\":10,\"quantity\":2,\"unit_price\":12.5,\"tax_rate\":15,\"discount_mode\":\"amount\",\"discount_value\":1.25},{\"product_id\":18,\"quantity\":1,\"unit_price\":8,\"tax_rate\":0,\"discount_mode\":\"percent\",\"discount_value\":10}]}";
request.Content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
curl -X POST "https://troyansys.com/api/v1/company/documents/invoices" \
-H "Accept: application/json" \
-H "X-API-Key: {api_key_empresa}" \
-H "Content-Type: application/json" \
-d '{
"warehouse_id": 1,
"customer_id": 2,
"series": "001-001",
"issue_date": "2026-02-22",
"reference": "Pedido APP-0001",
"due_days": 7,
"register_initial_payment": true,
"initial_payment_amount": 5,
"initial_payment_method": "transferencia",
"items": [
{
"product_id": 10,
"quantity": 2,
"unit_price": 12.5,
"tax_rate": 15,
"discount_mode": "amount",
"discount_value": 1.25
},
{
"product_id": 18,
"quantity": 1,
"unit_price": 8,
"tax_rate": 0,
"discount_mode": "percent",
"discount_value": 10
}
]
}'
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://troyansys.com/api/v1/company/documents/invoices', [
'headers' => [
'Accept' => 'application/json',
'X-API-Key' => '{api_key_empresa}',
'Content-Type' => 'application/json'
],
'json' => array (
'warehouse_id' => 1,
'customer_id' => 2,
'series' => '001-001',
'issue_date' => '2026-02-22',
'reference' => 'Pedido APP-0001',
'due_days' => 7,
'register_initial_payment' => true,
'initial_payment_amount' => 5.0,
'initial_payment_method' => 'transferencia',
'items' =>
array (
0 =>
array (
'product_id' => 10,
'quantity' => 2,
'unit_price' => 12.5,
'tax_rate' => 15,
'discount_mode' => 'amount',
'discount_value' => 1.25,
),
1 =>
array (
'product_id' => 18,
'quantity' => 1,
'unit_price' => 8,
'tax_rate' => 0,
'discount_mode' => 'percent',
'discount_value' => 10,
),
),
),
]);
$data = json_decode((string) $response->getBody(), true);
print_r($data);
using System.Net.Http.Headers;
using System.Text;
var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://troyansys.com/api/v1/company/documents/invoices");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
request.Headers.Add("X-API-Key", "{api_key_empresa}");
var json = "{\"warehouse_id\":1,\"customer_id\":2,\"series\":\"001-001\",\"issue_date\":\"2026-02-22\",\"reference\":\"Pedido APP-0001\",\"due_days\":7,\"register_initial_payment\":true,\"initial_payment_amount\":5,\"initial_payment_method\":\"transferencia\",\"items\":[{\"product_id\":10,\"quantity\":2,\"unit_price\":12.5,\"tax_rate\":15,\"discount_mode\":\"amount\",\"discount_value\":1.25},{\"product_id\":18,\"quantity\":1,\"unit_price\":8,\"tax_rate\":0,\"discount_mode\":\"percent\",\"discount_value\":10}]}";
request.Content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
{
"message": "Factura creada correctamente.",
"data": {
"id": 120,
"type": "invoice",
"series": "001-001",
"number": "000000120",
"status": "issued",
"issue_date": "2026-02-22",
"total": 34.79,
"sri_status": "authorized",
"sri_access_key": "0422026010993374929001200100200000012061955378919",
"sri_authorization_number": "0422026010993374929001200100200000012061955378919",
"sri_authorized_at": "2026-02-22T10:11:15-05:00",
"mail_status": "sent",
"files": {
"xml_path": "companies/5/documents/sales/xml/2026/02/0422...xml",
"pdf_path": "companies/5/documents/sales/pdf/2026/02/c5-Factura-001-002-000000216.pdf"
},
"stock_movement_id": 91,
"stock_applied_at": "2026-02-22T10:10:22-05:00"
}
}
Devuelve documentos emitidos por cobrar, filtros de estado y cobros recientes.
| Campo | Tipo | Req. | Descripcion |
|---|---|---|---|
| per_page | integer | No | Cantidad por pagina. |
| type | string | No | invoice, sales_order o debit_note. |
| status | string | No | pending, partial o paid. |
| search | string | No | Busqueda por serie/numero/cliente. |
| document_id | integer | No | Documento seleccionado para detalle de saldo/anticipos. |
curl -X GET "https://troyansys.com/api/v1/payments?status=pending&search=001-001" \
-H "Accept: application/json" \
-H "Authorization: Bearer {token}" \
-H "X-Company-Id: 1"
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://troyansys.com/api/v1/payments?status=pending&search=001-001', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer {token}',
'X-Company-Id' => '1'
],
]);
$data = json_decode((string) $response->getBody(), true);
print_r($data);
using System.Net.Http.Headers;
using System.Text;
var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://troyansys.com/api/v1/payments?status=pending&search=001-001");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "{token}");
request.Headers.Add("X-Company-Id", "1");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
curl -X GET "https://troyansys.com/api/v1/company/payments?status=pending&search=001-001" \
-H "Accept: application/json" \
-H "X-API-Key: {api_key_empresa}"
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://troyansys.com/api/v1/company/payments?status=pending&search=001-001', [
'headers' => [
'Accept' => 'application/json',
'X-API-Key' => '{api_key_empresa}'
],
]);
$data = json_decode((string) $response->getBody(), true);
print_r($data);
using System.Net.Http.Headers;
using System.Text;
var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://troyansys.com/api/v1/company/payments?status=pending&search=001-001");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
request.Headers.Add("X-API-Key", "{api_key_empresa}");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
{
"meta": {
"current_page": 1,
"last_page": 1,
"per_page": 20,
"total": 1
},
"selected_document": {
"id": 120,
"series": "001-001",
"number": "000000120",
"total": 46,
"paid_amount": 10,
"balance": 36,
"available_advance": 5
}
}
Registra cobro con soporte de cruce de anticipos y excedente como propina o nuevo anticipo.
| Campo | Tipo | Req. | Descripcion |
|---|---|---|---|
| document_id | integer | Si | Comprobante a cobrar. |
| payment_date | date | Si | Fecha de cobro YYYY-MM-DD. |
| amount | numeric | No | Monto de cobro directo. |
| apply_advance_amount | numeric | No | Monto a cruzar desde anticipos disponibles. |
| overpayment_mode | string | No | tip o advance si amount supera el saldo. |
| payment_method | string | No | efectivo, transferencia, tarjeta, etc. |
| reference | string | No | Referencia de pago. |
| notes | string | No | Observaciones internas. |
curl -X POST "https://troyansys.com/api/v1/payments" \
-H "Accept: application/json" \
-H "Authorization: Bearer {token}" \
-H "X-Company-Id: 1" \
-H "Content-Type: application/json" \
-d '{
"document_id": 120,
"payment_date": "2026-03-17",
"amount": 40,
"apply_advance_amount": 5,
"overpayment_mode": "advance",
"payment_method": "transferencia",
"reference": "TRX-API-001"
}'
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://troyansys.com/api/v1/payments', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer {token}',
'X-Company-Id' => '1',
'Content-Type' => 'application/json'
],
'json' => array (
'document_id' => 120,
'payment_date' => '2026-03-17',
'amount' => 40.0,
'apply_advance_amount' => 5.0,
'overpayment_mode' => 'advance',
'payment_method' => 'transferencia',
'reference' => 'TRX-API-001',
),
]);
$data = json_decode((string) $response->getBody(), true);
print_r($data);
using System.Net.Http.Headers;
using System.Text;
var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://troyansys.com/api/v1/payments");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "{token}");
request.Headers.Add("X-Company-Id", "1");
var json = "{\"document_id\":120,\"payment_date\":\"2026-03-17\",\"amount\":40,\"apply_advance_amount\":5,\"overpayment_mode\":\"advance\",\"payment_method\":\"transferencia\",\"reference\":\"TRX-API-001\"}";
request.Content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
curl -X POST "https://troyansys.com/api/v1/company/payments" \
-H "Accept: application/json" \
-H "X-API-Key: {api_key_empresa}" \
-H "Content-Type: application/json" \
-d '{
"document_id": 120,
"payment_date": "2026-03-17",
"amount": 40,
"apply_advance_amount": 5,
"overpayment_mode": "advance",
"payment_method": "transferencia",
"reference": "TRX-API-001"
}'
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://troyansys.com/api/v1/company/payments', [
'headers' => [
'Accept' => 'application/json',
'X-API-Key' => '{api_key_empresa}',
'Content-Type' => 'application/json'
],
'json' => array (
'document_id' => 120,
'payment_date' => '2026-03-17',
'amount' => 40.0,
'apply_advance_amount' => 5.0,
'overpayment_mode' => 'advance',
'payment_method' => 'transferencia',
'reference' => 'TRX-API-001',
),
]);
$data = json_decode((string) $response->getBody(), true);
print_r($data);
using System.Net.Http.Headers;
using System.Text;
var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://troyansys.com/api/v1/company/payments");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
request.Headers.Add("X-API-Key", "{api_key_empresa}");
var json = "{\"document_id\":120,\"payment_date\":\"2026-03-17\",\"amount\":40,\"apply_advance_amount\":5,\"overpayment_mode\":\"advance\",\"payment_method\":\"transferencia\",\"reference\":\"TRX-API-001\"}";
request.Content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
{
"message": "Pago registrado para 001-001-000000120.",
"data": {
"document": {
"id": 120,
"series": "001-001",
"number": "000000120",
"status": "issued"
},
"applied_advance_amount": 5,
"excess_amount": 2,
"created_advance_amount": 2,
"balance_pending": 0
}
}
Autocompletado de comprobantes pendientes de pago para flujo de cobros.
| Campo | Tipo | Req. | Descripcion |
|---|---|---|---|
| q | string | No | Texto libre por serie, numero o cliente. |
| page | integer | No | Pagina de resultados. |
curl -X GET "https://troyansys.com/api/v1/payments/lookups/documents?q=cliente+demo" \
-H "Accept: application/json" \
-H "Authorization: Bearer {token}" \
-H "X-Company-Id: 1"
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://troyansys.com/api/v1/payments/lookups/documents?q=cliente+demo', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer {token}',
'X-Company-Id' => '1'
],
]);
$data = json_decode((string) $response->getBody(), true);
print_r($data);
using System.Net.Http.Headers;
using System.Text;
var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://troyansys.com/api/v1/payments/lookups/documents?q=cliente+demo");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "{token}");
request.Headers.Add("X-Company-Id", "1");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
curl -X GET "https://troyansys.com/api/v1/company/payments/lookups/documents?q=cliente+demo" \
-H "Accept: application/json" \
-H "X-API-Key: {api_key_empresa}"
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://troyansys.com/api/v1/company/payments/lookups/documents?q=cliente+demo', [
'headers' => [
'Accept' => 'application/json',
'X-API-Key' => '{api_key_empresa}'
],
]);
$data = json_decode((string) $response->getBody(), true);
print_r($data);
using System.Net.Http.Headers;
using System.Text;
var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://troyansys.com/api/v1/company/payments/lookups/documents?q=cliente+demo");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
request.Headers.Add("X-API-Key", "{api_key_empresa}");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
{
"results": [
{
"id": 120,
"text": "001-001-000000120 | Cliente Demo | Saldo $36.00"
}
],
"pagination": {
"more": false
}
}
Intenta con otra palabra clave o selecciona un resultado del buscador global.