import { Lapyme } from "lapyme";
const lapyme = new Lapyme({
bearerAuth: process.env["LAPYME_API_KEY"] ?? "",
});
const report = await lapyme.reports.query({
source: "sales",
period: {
startDate: "2026-01-01",
endDate: "2026-03-31",
},
dimensions: ["product"],
measures: ["total", "units", "count"],
includeTotals: true,
});curl --request POST \
--url https://api.lapyme.com.ar/api/v1/reports/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"source": "sales",
"period": {
"start_date": "2026-01-01",
"end_date": "2026-03-31"
},
"dimensions": [
"product"
],
"measures": [
"total",
"units",
"count"
],
"include_totals": true
}
'import requests
url = "https://api.lapyme.com.ar/api/v1/reports/query"
payload = {
"source": "sales",
"period": {
"start_date": "2026-01-01",
"end_date": "2026-03-31"
},
"dimensions": ["product"],
"measures": ["total", "units", "count"],
"include_totals": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
source: 'sales',
period: {start_date: '2026-01-01', end_date: '2026-03-31'},
dimensions: ['product'],
measures: ['total', 'units', 'count'],
include_totals: true
})
};
fetch('https://api.lapyme.com.ar/api/v1/reports/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lapyme.com.ar/api/v1/reports/query",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'source' => 'sales',
'period' => [
'start_date' => '2026-01-01',
'end_date' => '2026-03-31'
],
'dimensions' => [
'product'
],
'measures' => [
'total',
'units',
'count'
],
'include_totals' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.lapyme.com.ar/api/v1/reports/query"
payload := strings.NewReader("{\n \"source\": \"sales\",\n \"period\": {\n \"start_date\": \"2026-01-01\",\n \"end_date\": \"2026-03-31\"\n },\n \"dimensions\": [\n \"product\"\n ],\n \"measures\": [\n \"total\",\n \"units\",\n \"count\"\n ],\n \"include_totals\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.lapyme.com.ar/api/v1/reports/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source\": \"sales\",\n \"period\": {\n \"start_date\": \"2026-01-01\",\n \"end_date\": \"2026-03-31\"\n },\n \"dimensions\": [\n \"product\"\n ],\n \"measures\": [\n \"total\",\n \"units\",\n \"count\"\n ],\n \"include_totals\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lapyme.com.ar/api/v1/reports/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source\": \"sales\",\n \"period\": {\n \"start_date\": \"2026-01-01\",\n \"end_date\": \"2026-03-31\"\n },\n \"dimensions\": [\n \"product\"\n ],\n \"measures\": [\n \"total\",\n \"units\",\n \"count\"\n ],\n \"include_totals\": true\n}"
response = http.request(request)
puts response.read_body{
"request_id": "req_report_1",
"data": {
"rows": [
{
"id": "9c692e8b",
"ids": [
"9c692e8b-0f9a-4f7c-8b99-061a2eb188ae"
],
"labels": [
"Almohada Microfibra 80x50"
],
"measures": {
"total": 998300,
"units": 12,
"count": 8
}
},
{
"id": "3b4a1c2d",
"ids": [
"3b4a1c2d-1234-5678-abcd-ef1234567890"
],
"labels": [
"King size sheet"
],
"measures": {
"total": 450000,
"units": 5,
"count": 4
}
}
],
"totals": {
"total": 1448300,
"units": 17,
"count": 12
},
"metadata": {
"source": "sales",
"dimensions": [
"product"
],
"measures": [
"total",
"units",
"count"
],
"period": {
"start_date": "2026-01-01",
"end_date": "2026-03-31"
},
"date_basis": "commercial"
}
}
}{
"request_id": "req_report_1",
"error": {
"code": "INVALID_REQUEST",
"message": "Invalid request for querying reports",
"retryable": false,
"details": [
{
"field": "measures",
"code": "too_small",
"message": "Select at least one measure"
}
],
"type": "invalid_request_error"
}
}{
"request_id": "req_report_1",
"error": {
"code": "AUTHENTICATION_REQUIRED",
"message": "API key is required in the Authorization header",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}{
"request_id": "req_report_1",
"error": {
"code": "FORBIDDEN",
"message": "Your API key does not have permission for this operation",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}{
"request_id": "req_rate_limit_1",
"error": {
"type": "rate_limit_error",
"code": "RATE_LIMITED",
"message": "The organization request limit was reached. Try again later.",
"retryable": true,
"details": []
}
}{
"request_id": "req_report_1",
"error": {
"code": "INTERNAL_ERROR",
"message": "Could not run the report query",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}Consultar reporte
Ejecuta una consulta analítica agrupada sobre ventas, compras, pagos o inventario. El campo source determina qué dimensiones y métricas están disponibles.
import { Lapyme } from "lapyme";
const lapyme = new Lapyme({
bearerAuth: process.env["LAPYME_API_KEY"] ?? "",
});
const report = await lapyme.reports.query({
source: "sales",
period: {
startDate: "2026-01-01",
endDate: "2026-03-31",
},
dimensions: ["product"],
measures: ["total", "units", "count"],
includeTotals: true,
});curl --request POST \
--url https://api.lapyme.com.ar/api/v1/reports/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"source": "sales",
"period": {
"start_date": "2026-01-01",
"end_date": "2026-03-31"
},
"dimensions": [
"product"
],
"measures": [
"total",
"units",
"count"
],
"include_totals": true
}
'import requests
url = "https://api.lapyme.com.ar/api/v1/reports/query"
payload = {
"source": "sales",
"period": {
"start_date": "2026-01-01",
"end_date": "2026-03-31"
},
"dimensions": ["product"],
"measures": ["total", "units", "count"],
"include_totals": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
source: 'sales',
period: {start_date: '2026-01-01', end_date: '2026-03-31'},
dimensions: ['product'],
measures: ['total', 'units', 'count'],
include_totals: true
})
};
fetch('https://api.lapyme.com.ar/api/v1/reports/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lapyme.com.ar/api/v1/reports/query",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'source' => 'sales',
'period' => [
'start_date' => '2026-01-01',
'end_date' => '2026-03-31'
],
'dimensions' => [
'product'
],
'measures' => [
'total',
'units',
'count'
],
'include_totals' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.lapyme.com.ar/api/v1/reports/query"
payload := strings.NewReader("{\n \"source\": \"sales\",\n \"period\": {\n \"start_date\": \"2026-01-01\",\n \"end_date\": \"2026-03-31\"\n },\n \"dimensions\": [\n \"product\"\n ],\n \"measures\": [\n \"total\",\n \"units\",\n \"count\"\n ],\n \"include_totals\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.lapyme.com.ar/api/v1/reports/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source\": \"sales\",\n \"period\": {\n \"start_date\": \"2026-01-01\",\n \"end_date\": \"2026-03-31\"\n },\n \"dimensions\": [\n \"product\"\n ],\n \"measures\": [\n \"total\",\n \"units\",\n \"count\"\n ],\n \"include_totals\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lapyme.com.ar/api/v1/reports/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source\": \"sales\",\n \"period\": {\n \"start_date\": \"2026-01-01\",\n \"end_date\": \"2026-03-31\"\n },\n \"dimensions\": [\n \"product\"\n ],\n \"measures\": [\n \"total\",\n \"units\",\n \"count\"\n ],\n \"include_totals\": true\n}"
response = http.request(request)
puts response.read_body{
"request_id": "req_report_1",
"data": {
"rows": [
{
"id": "9c692e8b",
"ids": [
"9c692e8b-0f9a-4f7c-8b99-061a2eb188ae"
],
"labels": [
"Almohada Microfibra 80x50"
],
"measures": {
"total": 998300,
"units": 12,
"count": 8
}
},
{
"id": "3b4a1c2d",
"ids": [
"3b4a1c2d-1234-5678-abcd-ef1234567890"
],
"labels": [
"King size sheet"
],
"measures": {
"total": 450000,
"units": 5,
"count": 4
}
}
],
"totals": {
"total": 1448300,
"units": 17,
"count": 12
},
"metadata": {
"source": "sales",
"dimensions": [
"product"
],
"measures": [
"total",
"units",
"count"
],
"period": {
"start_date": "2026-01-01",
"end_date": "2026-03-31"
},
"date_basis": "commercial"
}
}
}{
"request_id": "req_report_1",
"error": {
"code": "INVALID_REQUEST",
"message": "Invalid request for querying reports",
"retryable": false,
"details": [
{
"field": "measures",
"code": "too_small",
"message": "Select at least one measure"
}
],
"type": "invalid_request_error"
}
}{
"request_id": "req_report_1",
"error": {
"code": "AUTHENTICATION_REQUIRED",
"message": "API key is required in the Authorization header",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}{
"request_id": "req_report_1",
"error": {
"code": "FORBIDDEN",
"message": "Your API key does not have permission for this operation",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}{
"request_id": "req_rate_limit_1",
"error": {
"type": "rate_limit_error",
"code": "RATE_LIMITED",
"message": "The organization request limit was reached. Try again later.",
"retryable": true,
"details": []
}
}{
"request_id": "req_report_1",
"error": {
"code": "INTERNAL_ERROR",
"message": "Could not run the report query",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}Authorizations
Incluí tu API key en el header Authorization con el prefijo Bearer.
Body
- Ventas
- Compras
- Pagos
- Inventario
sales Show child attributes
Show child attributes
Medidas a calcular. Al menos una.
1total, subtotal, taxAmount, count, units, cost, margin, avgTicket, marginPercent, discountAmount, lineDiscountAmount, lineDiscountRate, globalDiscountAmount, globalDiscountRate, discountedSalesCount, balance, uniqueCustomers, uniqueProducts Dimensiones de agrupación. Máximo 12. Acepta product_metafield: para campos personalizados select de producto y contact_metafield: para campos personalizados select de contacto.
12date, week, weekOfYear, month, monthOfYear, dayOfWeek, year, quarter, hourOfDay, customer, customerName, customerEmail, customerTaxCategory, province, city, product, productName, variant, variantSku, category, subcategory, defaultSupplierName, productType, salesperson, pointOfSale, warehouse, register, integrationSource, voucherType, currency, paymentStatus, caeStatus, invoiceStatus, formattedInvoiceNumber, taxRate, saleLineType Filtros por dimensión. Cada clave debe ser una dimensión filtrable para la fuente. También acepta product_metafield: para campos personalizados select de producto y contact_metafield: para campos personalizados select de contacto cuando la fuente lo soporta. El valor es un array de IDs o valores a incluir.
Show child attributes
Show child attributes
Si es true, la respuesta incluye totales agregados en el campo totals.
commercial usa la fecha de venta. fiscal usa la fecha contable del comprobante.
commercial, fiscal Was this page helpful?

