Skip to main content
POST
/
api
/
v1
/
products
La Pyme SDK
import { Lapyme } from "lapyme";

const lapyme = new Lapyme({
  bearerAuth: process.env["LAPYME_API_KEY"] ?? "",
});

const product = await lapyme.products.create({
  idempotencyKey: crypto.randomUUID(),
  body: {
    name: "Remera basica",
    sku: "REM-BASICA-M",
    productType: "product",
    price: 1250000,
    cost: 700000,
    currency: "PES",
  },
});
{
  "request_id": "<string>",
  "data": {
    "product": {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "name": "<string>",
      "description": "<string>",
      "category": {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "name": "<string>"
      },
      "sku": "<string>",
      "barcode": "<string>",
      "currency": "<string>",
      "cost": 123,
      "price": 123,
      "tax_rate": {
        "id": 123,
        "value": 123
      },
      "default_supplier": {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "name": "<string>"
      },
      "is_active": true,
      "organization_slug": "<string>",
      "created_at": "2023-11-07T05:31:56Z",
      "updated_at": "2023-11-07T05:31:56Z",
      "object": "<string>",
      "variant_group_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "variant_options": {},
      "is_exempt": true,
      "stock_summary": {
        "total_quantity": 123,
        "warehouse_count": 1,
        "by_warehouse": [
          {
            "warehouse_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "warehouse_name": "<string>",
            "quantity": 123,
            "on_hand": 123,
            "reserved_quantity": 123,
            "incoming_quantity": 123
          }
        ]
      },
      "effective_price": 123,
      "applied_price_list": {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "name": "<string>",
        "is_automatic": true,
        "adjustment_percentage": 123,
        "tax_inclusive": true
      }
    },
    "idempotent_replay": true
  },
  "warnings": [
    "<unknown>"
  ]
}

Authorizations

Authorization
string
header
required

Incluí tu API key en el header Authorization con el prefijo Bearer.

Headers

Idempotency-Key
string
required

Clave única para evitar duplicados al reintentar la misma creación de producto.

X-Request-Id
string

ID opcional de la solicitud para trazabilidad. Si se omite, el servidor genera uno.

Body

application/json
name
string
required
sku
string
required
description
string | null
category_id
string<uuid> | null
visibility
enum<string>
default:both
Available options:
both,
sales,
purchases
image_url
string | null

External product image URL reference. La Pyme displays it best effort and does not copy, ingest, or host the image.

product_type
enum<string>
default:product
Available options:
product,
service,
combo,
kit
barcode
string | null
unit_of_measure
enum<string>
default:07
Available options:
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
41,
47,
48,
49,
50,
51,
52,
53,
54,
55,
61,
62,
63,
97,
98,
99,
00,
01,
02,
03,
04,
05,
06,
07,
08,
09
currency
enum<string>
default:PES
Available options:
PES,
DOL
cost
integer
default:0
Required range: x >= 0
price
integer

Manual sale price in cents. Mutually exclusive with markup_percentage; send price for manual pricing or markup_percentage for markup pricing.

Required range: x >= 0
promotional_price
integer | null
Required range: x >= 0
markup_percentage
number | null

Markup percentage used to calculate the sale price from cost, tax, and organization rounding rules. Mutually exclusive with price; send null to switch back to manual pricing.

Required range: 0 <= x <= 1000
tax_rate_id
integer
default:5
is_exempt
boolean
default:false
default_supplier_id
string<uuid> | null
default_sales_account_id
string<uuid> | null
default_purchase_account_id
string<uuid> | null
warehouse_stocks
object[]
is_active
boolean
default:true

Response

Producto creado exitosamente

request_id
string
required
data
object
required
warnings
any[]
required