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: "ARS",
},
});curl --request POST \
--url https://api.lapyme.com.ar/api/v1/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"product_type": "combo",
"name": "<string>",
"sku": "<string>",
"components": [
{
"product_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123
}
],
"barcode": "<string>",
"image_url": "<string>",
"category_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"is_active": true,
"pricing_mode": "automatic",
"price": 1,
"price_adjustment_percentage": 4950
}
'import requests
url = "https://api.lapyme.com.ar/api/v1/products"
payload = {
"product_type": "combo",
"name": "<string>",
"sku": "<string>",
"components": [
{
"product_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123
}
],
"barcode": "<string>",
"image_url": "<string>",
"category_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"is_active": True,
"pricing_mode": "automatic",
"price": 1,
"price_adjustment_percentage": 4950
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
product_type: 'combo',
name: '<string>',
sku: '<string>',
components: [{product_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', quantity: 123}],
barcode: '<string>',
image_url: '<string>',
category_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
is_active: true,
pricing_mode: 'automatic',
price: 1,
price_adjustment_percentage: 4950
})
};
fetch('https://api.lapyme.com.ar/api/v1/products', 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/products",
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([
'product_type' => 'combo',
'name' => '<string>',
'sku' => '<string>',
'components' => [
[
'product_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'quantity' => 123
]
],
'barcode' => '<string>',
'image_url' => '<string>',
'category_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'is_active' => true,
'pricing_mode' => 'automatic',
'price' => 1,
'price_adjustment_percentage' => 4950
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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/products"
payload := strings.NewReader("{\n \"product_type\": \"combo\",\n \"name\": \"<string>\",\n \"sku\": \"<string>\",\n \"components\": [\n {\n \"product_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123\n }\n ],\n \"barcode\": \"<string>\",\n \"image_url\": \"<string>\",\n \"category_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"is_active\": true,\n \"pricing_mode\": \"automatic\",\n \"price\": 1,\n \"price_adjustment_percentage\": 4950\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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/products")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"product_type\": \"combo\",\n \"name\": \"<string>\",\n \"sku\": \"<string>\",\n \"components\": [\n {\n \"product_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123\n }\n ],\n \"barcode\": \"<string>\",\n \"image_url\": \"<string>\",\n \"category_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"is_active\": true,\n \"pricing_mode\": \"automatic\",\n \"price\": 1,\n \"price_adjustment_percentage\": 4950\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lapyme.com.ar/api/v1/products")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"product_type\": \"combo\",\n \"name\": \"<string>\",\n \"sku\": \"<string>\",\n \"components\": [\n {\n \"product_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123\n }\n ],\n \"barcode\": \"<string>\",\n \"image_url\": \"<string>\",\n \"category_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"is_active\": true,\n \"pricing_mode\": \"automatic\",\n \"price\": 1,\n \"price_adjustment_percentage\": 4950\n}"
response = http.request(request)
puts response.read_body{
"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>",
"image_url": "<string>",
"currency": "<string>",
"cost": 123,
"price": 123,
"tax_rate": {
"id": 123,
"value": 123
},
"default_supplier": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"product_type": "product",
"visibility": "both",
"is_active": true,
"organization_slug": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"components": [
{
"product_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"sku": "<string>",
"quantity": 123
}
],
"object": "product",
"tags": [
{
"object": "tag",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"scope": "customer",
"name": "<string>",
"slug": "<string>",
"color": "slate",
"description": "<string>",
"archived_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"variant_group_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"variant_options": {},
"is_exempt": true,
"metafields": [
{
"key": "<string>",
"value": "<string>"
}
],
"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,
"price_source": "automatic",
"applied_price_list": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"is_automatic": true,
"automatic_pricing_mode": "base_price_adjustment",
"adjustment_percentage": 123,
"source_price_list_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tax_inclusive": true
}
},
"idempotent_replay": true
},
"warnings": [
"<unknown>"
]
}{
"request_id": "req_product_create_1",
"error": {
"code": "INVALID_REQUEST",
"message": "Invalid request for creating products",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}{
"request_id": "req_product_create_1",
"error": {
"code": "AUTHENTICATION_REQUIRED",
"message": "API key is required in the Authorization header",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}{
"request_id": "req_product_create_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_product_create_1",
"error": {
"code": "NOT_FOUND",
"message": "Category not found",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}{
"request_id": "req_product_create_1",
"error": {
"code": "CONFLICT",
"message": "A product with this SKU already exists",
"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_product_create_1",
"error": {
"code": "INTERNAL_ERROR",
"message": "Could not process the product",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}Crear producto
Crea un producto simple, servicio o kit; un producto con hasta tres opciones y 250 variantes; o un combo con su composición completa y no vacía. La creación de un combo persiste producto, precio y componentes de forma atómica.
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: "ARS",
},
});curl --request POST \
--url https://api.lapyme.com.ar/api/v1/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"product_type": "combo",
"name": "<string>",
"sku": "<string>",
"components": [
{
"product_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123
}
],
"barcode": "<string>",
"image_url": "<string>",
"category_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"is_active": true,
"pricing_mode": "automatic",
"price": 1,
"price_adjustment_percentage": 4950
}
'import requests
url = "https://api.lapyme.com.ar/api/v1/products"
payload = {
"product_type": "combo",
"name": "<string>",
"sku": "<string>",
"components": [
{
"product_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123
}
],
"barcode": "<string>",
"image_url": "<string>",
"category_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"is_active": True,
"pricing_mode": "automatic",
"price": 1,
"price_adjustment_percentage": 4950
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
product_type: 'combo',
name: '<string>',
sku: '<string>',
components: [{product_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', quantity: 123}],
barcode: '<string>',
image_url: '<string>',
category_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
is_active: true,
pricing_mode: 'automatic',
price: 1,
price_adjustment_percentage: 4950
})
};
fetch('https://api.lapyme.com.ar/api/v1/products', 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/products",
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([
'product_type' => 'combo',
'name' => '<string>',
'sku' => '<string>',
'components' => [
[
'product_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'quantity' => 123
]
],
'barcode' => '<string>',
'image_url' => '<string>',
'category_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'is_active' => true,
'pricing_mode' => 'automatic',
'price' => 1,
'price_adjustment_percentage' => 4950
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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/products"
payload := strings.NewReader("{\n \"product_type\": \"combo\",\n \"name\": \"<string>\",\n \"sku\": \"<string>\",\n \"components\": [\n {\n \"product_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123\n }\n ],\n \"barcode\": \"<string>\",\n \"image_url\": \"<string>\",\n \"category_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"is_active\": true,\n \"pricing_mode\": \"automatic\",\n \"price\": 1,\n \"price_adjustment_percentage\": 4950\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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/products")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"product_type\": \"combo\",\n \"name\": \"<string>\",\n \"sku\": \"<string>\",\n \"components\": [\n {\n \"product_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123\n }\n ],\n \"barcode\": \"<string>\",\n \"image_url\": \"<string>\",\n \"category_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"is_active\": true,\n \"pricing_mode\": \"automatic\",\n \"price\": 1,\n \"price_adjustment_percentage\": 4950\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lapyme.com.ar/api/v1/products")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"product_type\": \"combo\",\n \"name\": \"<string>\",\n \"sku\": \"<string>\",\n \"components\": [\n {\n \"product_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123\n }\n ],\n \"barcode\": \"<string>\",\n \"image_url\": \"<string>\",\n \"category_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"is_active\": true,\n \"pricing_mode\": \"automatic\",\n \"price\": 1,\n \"price_adjustment_percentage\": 4950\n}"
response = http.request(request)
puts response.read_body{
"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>",
"image_url": "<string>",
"currency": "<string>",
"cost": 123,
"price": 123,
"tax_rate": {
"id": 123,
"value": 123
},
"default_supplier": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"product_type": "product",
"visibility": "both",
"is_active": true,
"organization_slug": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"components": [
{
"product_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"sku": "<string>",
"quantity": 123
}
],
"object": "product",
"tags": [
{
"object": "tag",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"scope": "customer",
"name": "<string>",
"slug": "<string>",
"color": "slate",
"description": "<string>",
"archived_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"variant_group_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"variant_options": {},
"is_exempt": true,
"metafields": [
{
"key": "<string>",
"value": "<string>"
}
],
"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,
"price_source": "automatic",
"applied_price_list": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"is_automatic": true,
"automatic_pricing_mode": "base_price_adjustment",
"adjustment_percentage": 123,
"source_price_list_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tax_inclusive": true
}
},
"idempotent_replay": true
},
"warnings": [
"<unknown>"
]
}{
"request_id": "req_product_create_1",
"error": {
"code": "INVALID_REQUEST",
"message": "Invalid request for creating products",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}{
"request_id": "req_product_create_1",
"error": {
"code": "AUTHENTICATION_REQUIRED",
"message": "API key is required in the Authorization header",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}{
"request_id": "req_product_create_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_product_create_1",
"error": {
"code": "NOT_FOUND",
"message": "Category not found",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}{
"request_id": "req_product_create_1",
"error": {
"code": "CONFLICT",
"message": "A product with this SKU already exists",
"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_product_create_1",
"error": {
"code": "INTERNAL_ERROR",
"message": "Could not process the product",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}Authorizations
Incluí tu API key en el header Authorization con el prefijo Bearer.
Headers
Clave única para evitar duplicados al reintentar la misma creación de producto.
Required string length:
1 - 255ID opcional de la solicitud para trazabilidad. Si se omite, el servidor genera uno.
Required string length:
1 - 255Body
application/json
- Option 1
- Option 2
- Option 3
Allowed value:
"combo"Required string length:
1 - 255Required string length:
1 - 100Minimum array length:
1Show child attributes
Show child attributes
Maximum string length:
100External product image URL reference. La Pyme displays it best effort and does not copy, ingest, or host the image.
Maximum string length:
2000Available options:
automatic, manual Precio manual en centavos; obligatorio en modo manual.
Required range:
x >= 0Required range:
-100 <= x <= 10000Was this page helpful?

