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

Inventario

Consulta de productos y stock por empresa con filtros de busqueda y bodega.

Base URL: https://troyansys.com/api/v1

GET

Listar productos

Obtiene productos paginados con categoria.

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

Parametros Query

Campo Tipo Req. Descripcion
per_page integer No Cantidad por pagina (1 a 100).
search string No Filtro por nombre o SKU.

Ejemplos de uso

Bearer
cURL
curl -X GET "https://troyansys.com/api/v1/products?per_page=20&search=lapiz" \
  -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/products?per_page=20&search=lapiz', [
    '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/products?per_page=20&search=lapiz");
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/products?per_page=20&search=lapiz" \
  -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/products?per_page=20&search=lapiz', [
    '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/products?per_page=20&search=lapiz");
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": 10,
            "sku": "LPZ-001",
            "name": "Lapiz HB",
            "sale_price": "0.4500",
            "category": {
                "id": 3,
                "name": "Utiles"
            }
        }
    ],
    "total": 1
}
GET

Ver producto por ID

Consulta detalle de un producto.

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

Ejemplos de uso

Bearer
cURL
curl -X GET "https://troyansys.com/api/v1/products/10" \
  -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/products/10', [
    '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/products/10");
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/products/10" \
  -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/products/10', [
    '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/products/10");
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": 10,
    "sku": "LPZ-001",
    "name": "Lapiz HB",
    "description": "Producto de demostracion",
    "sale_price": "0.4500"
}
GET

Listar stock

Consulta stock por bodega y producto.

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

Parametros Query

Campo Tipo Req. Descripcion
per_page integer No Cantidad por pagina.
warehouse_id integer No Filtro por deposito/bodega.
product_id integer No Filtro por producto.

Ejemplos de uso

Bearer
cURL
curl -X GET "https://troyansys.com/api/v1/stocks?per_page=20&warehouse_id=1" \
  -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/stocks?per_page=20&warehouse_id=1', [
    '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/stocks?per_page=20&warehouse_id=1");
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/stocks?per_page=20&warehouse_id=1" \
  -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/stocks?per_page=20&warehouse_id=1', [
    '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/stocks?per_page=20&warehouse_id=1");
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": 55,
            "warehouse_id": 1,
            "product_id": 10,
            "quantity": "120.000",
            "warehouse": {
                "id": 1,
                "name": "Bodega Principal",
                "code": "BOD-001"
            },
            "product": {
                "id": 10,
                "name": "Lapiz HB",
                "sku": "LPZ-001"
            }
        }
    ],
    "total": 1
}
GET

Listar bodegas

Obtiene bodegas disponibles para inventario/ventas/compras.

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

Parametros Query

Campo Tipo Req. Descripcion
per_page integer No Cantidad por pagina.
include_inactive boolean No Incluye bodegas inactivas si es true.

Ejemplos de uso

Bearer
cURL
curl -X GET "https://troyansys.com/api/v1/warehouses?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/warehouses?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/warehouses?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/warehouses?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/warehouses?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/warehouses?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

{
    "current_page": 1,
    "data": [
        {
            "id": 1,
            "code": "BOD-001",
            "name": "Bodega Principal",
            "is_active": true
        }
    ],
    "total": 1
}
GET

Consultar disponibilidad puntual

Devuelve cantidad disponible por producto/variante en una bodega.

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

Parametros Query

Campo Tipo Req. Descripcion
warehouse_id integer Si Bodega a consultar.
product_id string|integer No Producto o combinacion product_id|variant_id.
product_variant_id integer No Variante del producto.
product_ids[] array No Lista de productos.
variant_ids[] array No Lista de variantes.

Ejemplos de uso

Bearer
cURL
curl -X GET "https://troyansys.com/api/v1/stocks/availability?warehouse_id=1&product_id=10%7C31" \
  -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/stocks/availability?warehouse_id=1&product_id=10%7C31', [
    '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/stocks/availability?warehouse_id=1&product_id=10%7C31");
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/stocks/availability?warehouse_id=1&product_id=10%7C31" \
  -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/stocks/availability?warehouse_id=1&product_id=10%7C31', [
    '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/stocks/availability?warehouse_id=1&product_id=10%7C31");
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": {
        "warehouse_id": 1,
        "items": [
            {
                "product_id": 10,
                "product_variant_id": 31,
                "quantity": 7
            }
        ]
    }
}
GET

Historial de compras por producto

Retorna compras historicas de un producto con evolucion de costos.

Endpoint Bearer
https://troyansys.com/api/v1/products/10/purchase-history
Endpoint API Key
https://troyansys.com/api/v1/company/products/10/purchase-history

Parametros Query

Campo Tipo Req. Descripcion
per_page integer No Cantidad por pagina.
date_from date No Desde YYYY-MM-DD.
date_to date No Hasta YYYY-MM-DD.
supplier_id integer No Filtro por proveedor.
warehouse_id integer No Filtro por bodega.

Ejemplos de uso

Bearer
cURL
curl -X GET "https://troyansys.com/api/v1/products/10/purchase-history?date_from=2026-01-01&date_to=2026-03-31" \
  -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/products/10/purchase-history?date_from=2026-01-01&date_to=2026-03-31', [
    '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/products/10/purchase-history?date_from=2026-01-01&date_to=2026-03-31");
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/products/10/purchase-history?date_from=2026-01-01&date_to=2026-03-31" \
  -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/products/10/purchase-history?date_from=2026-01-01&date_to=2026-03-31', [
    '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/products/10/purchase-history?date_from=2026-01-01&date_to=2026-03-31");
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

{
    "summary": {
        "lines_count": 5,
        "latest_cost": 3.55,
        "average_cost": 3.21,
        "min_cost": 2.95,
        "max_cost": 3.8
    },
    "data": [
        {
            "id": 101,
            "date": "2026-03-01",
            "quantity": 20,
            "unit_cost": 3.55,
            "total_cost": 71,
            "variation_percent_vs_previous": 4.41
        }
    ]
}