Autenticacion 6 metodos Base de conocimiento 3 metodos Inventario 6 metodos Ventas 10 metodos Compras 4 metodos Contabilidad 5 metodos Reporteria 5 metodos

Ventas

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

GET

Listar comprobantes de venta

Obtiene comprobantes de venta paginados.

Endpoint Bearer
https://troyansys.com/api/v1/documents
Endpoint API Key
https://troyansys.com/api/v1/company/documents

Parametros Query

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.

Ejemplos de uso

Bearer
cURL
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 (Guzzle)
<?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);
.NET (HttpClient)
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);
API Key
cURL
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 (Guzzle)
<?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);
.NET (HttpClient)
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);

Respuesta esperada

{
    "current_page": 1,
    "data": [
        {
            "id": 100,
            "type": "invoice",
            "series": "001-001",
            "number": "000000321",
            "status": "issued",
            "sri_status": "authorized",
            "payment_status": "pending",
            "total": "46.0000"
        }
    ]
}
GET

Ver comprobante de venta

Obtiene detalle de un comprobante con items, estado SRI, estado de pago y metadatos de envio.

Endpoint Bearer
https://troyansys.com/api/v1/documents/100
Endpoint API Key
https://troyansys.com/api/v1/company/documents/100

Ejemplos de uso

Bearer
cURL
curl -X GET "https://troyansys.com/api/v1/documents/100" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer {token}" \
  -H "X-Company-Id: 1"
PHP (Guzzle)
<?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);
.NET (HttpClient)
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);
API Key
cURL
curl -X GET "https://troyansys.com/api/v1/company/documents/100" \
  -H "Accept: application/json" \
  -H "X-API-Key: {api_key_empresa}"
PHP (Guzzle)
<?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);
.NET (HttpClient)
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);

Respuesta esperada

{
    "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"
        }
    }
}
GET

Lookup clientes

Lista clientes activos para autocompletado de documentos de venta.

Endpoint Bearer
https://troyansys.com/api/v1/documents/lookups/customers
Endpoint API Key
https://troyansys.com/api/v1/company/documents/lookups/customers

Parametros Query

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).

Ejemplos de uso

Bearer
cURL
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 (Guzzle)
<?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);
.NET (HttpClient)
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);
API Key
cURL
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 (Guzzle)
<?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);
.NET (HttpClient)
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);

Respuesta esperada

{
    "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
    }
}
GET

Lookup establecimientos

Devuelve establecimientos habilitados para el tipo de documento seleccionado.

Endpoint Bearer
https://troyansys.com/api/v1/documents/lookups/establishments
Endpoint API Key
https://troyansys.com/api/v1/company/documents/lookups/establishments

Parametros Query

Campo Tipo Req. Descripcion
type string No Tipo de documento: invoice, sales_order, quotation, credit_note o debit_note.

Ejemplos de uso

Bearer
cURL
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 (Guzzle)
<?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);
.NET (HttpClient)
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);
API Key
cURL
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 (Guzzle)
<?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);
.NET (HttpClient)
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);

Respuesta esperada

{
    "data": [
        {
            "id": 1,
            "code": "001",
            "name": "Establecimiento 001"
        }
    ]
}
GET

Lookup puntos de emision

Devuelve puntos de emision disponibles y su serie para facturacion.

Endpoint Bearer
https://troyansys.com/api/v1/documents/lookups/points-of-sale
Endpoint API Key
https://troyansys.com/api/v1/company/documents/lookups/points-of-sale

Parametros Query

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.

Ejemplos de uso

Bearer
cURL
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 (Guzzle)
<?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);
.NET (HttpClient)
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);
API Key
cURL
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 (Guzzle)
<?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);
.NET (HttpClient)
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);

Respuesta esperada

{
    "data": [
        {
            "id": 2,
            "establishment_id": 1,
            "name": "Punto 001-002",
            "code": "002",
            "series": "001-002"
        }
    ]
}
GET

Previsualizar secuencia

Calcula la siguiente numeracion disponible para una serie y tipo de documento.

Endpoint Bearer
https://troyansys.com/api/v1/documents/sequence-preview
Endpoint API Key
https://troyansys.com/api/v1/company/documents/sequence-preview

Parametros Query

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.

Ejemplos de uso

Bearer
cURL
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 (Guzzle)
<?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);
.NET (HttpClient)
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);
API Key
cURL
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 (Guzzle)
<?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);
.NET (HttpClient)
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);

Respuesta esperada

{
    "type": "invoice",
    "series": "001-002",
    "establishment": "001",
    "emission_point": "002",
    "next_number": "000000217",
    "display_number": "001-002-000000217"
}
POST

Crear factura

Crea factura y ejecuta flujo: registro, validacion stock, intento SRI, generacion PDF/XML y envio email.

Endpoint Bearer
https://troyansys.com/api/v1/documents/invoices
Endpoint API Key
https://troyansys.com/api/v1/company/documents/invoices

Body JSON

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.

Ejemplos de uso

Bearer
cURL
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 (Guzzle)
<?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);
.NET (HttpClient)
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);
API Key
cURL
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 (Guzzle)
<?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);
.NET (HttpClient)
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);

Respuesta esperada

{
    "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"
    }
}
GET

Listar cobros y documentos por cobrar

Devuelve documentos emitidos por cobrar, filtros de estado y cobros recientes.

Endpoint Bearer
https://troyansys.com/api/v1/payments
Endpoint API Key
https://troyansys.com/api/v1/company/payments

Parametros Query

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.

Ejemplos de uso

Bearer
cURL
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 (Guzzle)
<?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);
.NET (HttpClient)
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);
API Key
cURL
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 (Guzzle)
<?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);
.NET (HttpClient)
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);

Respuesta esperada

{
    "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
    }
}
POST

Registrar cobro

Registra cobro con soporte de cruce de anticipos y excedente como propina o nuevo anticipo.

Endpoint Bearer
https://troyansys.com/api/v1/payments
Endpoint API Key
https://troyansys.com/api/v1/company/payments

Body JSON

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.

Ejemplos de uso

Bearer
cURL
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 (Guzzle)
<?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);
.NET (HttpClient)
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);
API Key
cURL
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 (Guzzle)
<?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);
.NET (HttpClient)
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);

Respuesta esperada

{
    "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
    }
}
GET

Lookup documentos por cobrar

Autocompletado de comprobantes pendientes de pago para flujo de cobros.

Endpoint Bearer
https://troyansys.com/api/v1/payments/lookups/documents
Endpoint API Key
https://troyansys.com/api/v1/company/payments/lookups/documents

Parametros Query

Campo Tipo Req. Descripcion
q string No Texto libre por serie, numero o cliente.
page integer No Pagina de resultados.

Ejemplos de uso

Bearer
cURL
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 (Guzzle)
<?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);
.NET (HttpClient)
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);
API Key
cURL
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 (Guzzle)
<?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);
.NET (HttpClient)
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);

Respuesta esperada

{
    "results": [
        {
            "id": 120,
            "text": "001-001-000000120 | Cliente Demo | Saldo $36.00"
        }
    ],
    "pagination": {
        "more": false
    }
}