Tiendas
Crear Tienda
Aprenda a crear una nueva tienda en su cuenta usando el endpoint POST /stores.
POST
/
stores
Create store
curl --request POST \
--url https://api.cabrapi.com.br/v1/stores \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "<string>",
"domain": {
"value": "<string>"
},
"image": "<string>",
"metadata": {},
"name": "<string>"
}
'import requests
url = "https://api.cabrapi.com.br/v1/stores"
payload = {
"description": "<string>",
"domain": { "value": "<string>" },
"image": "<string>",
"metadata": {},
"name": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
description: '<string>',
domain: {value: '<string>'},
image: '<string>',
metadata: {},
name: '<string>'
})
};
fetch('https://api.cabrapi.com.br/v1/stores', 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.cabrapi.com.br/v1/stores",
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([
'description' => '<string>',
'domain' => [
'value' => '<string>'
],
'image' => '<string>',
'metadata' => [
],
'name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.cabrapi.com.br/v1/stores"
payload := strings.NewReader("{\n \"description\": \"<string>\",\n \"domain\": {\n \"value\": \"<string>\"\n },\n \"image\": \"<string>\",\n \"metadata\": {},\n \"name\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.cabrapi.com.br/v1/stores")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"<string>\",\n \"domain\": {\n \"value\": \"<string>\"\n },\n \"image\": \"<string>\",\n \"metadata\": {},\n \"name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cabrapi.com.br/v1/stores")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"<string>\",\n \"domain\": {\n \"value\": \"<string>\"\n },\n \"image\": \"<string>\",\n \"metadata\": {},\n \"name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": "STORE_CREATED",
"store": {
"createdAt": "2023-11-07T05:31:56Z",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"position": 123,
"template": "PERSONALIZADO",
"updatedAt": "2023-11-07T05:31:56Z",
"description": "<string>",
"domain": "<string>",
"image": "<string>",
"metadata": {}
}
}{
"code": "STORE_NOT_FOUND"
}{
"code": "STORE_NOT_FOUND"
}{
"code": "STORE_NOT_FOUND"
}{
"code": "STORE_NOT_FOUND"
}{
"code": "STORE_NOT_FOUND"
}{
"code": "STORE_NOT_FOUND"
}🏗️ Crear Tienda
Este endpoint permite crear una nueva tienda asociada a su cuenta. Es ideal para:- Provisionar tiendas automáticamente
- Crear tiendas en flujos de onboarding
- Integrar CRMs y sistemas externos con caBRAPI
🔐 Autenticación
Esta ruta requiere autenticación mediante API Key, enviada en el header de la solicitud:Authorization: TU_API_KEY_AQUI
📥 Body de la Solicitud
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
template | string | Sí | Valores aceptados: PERSONALIZADO o N/A. |
name | string | No | Nombre de la tienda (mín. 4, máx. 32). |
description | string | null | No | Descripción de la tienda (mín. 12, máx. 256). |
image | string | null | No | URL de la imagen de la tienda (mín. 12, máx. 512). |
metadata | object | null | No | Metadatos personalizados de la tienda. |
domain | object | null | Condicional | Obligatorio cuando template = PERSONALIZADO. |
Estructura de domain
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
type | string | Sí | Valores aceptados: CUSTOM o DEFAULT. |
value | string | Sí | Dominio o subdominio (mín. 8, máx. 75). |
📋 Ejemplo de Solicitud
curl --location "https://api.cabrapi.com.br/v1/stores" \
--header "Authorization: TU_API_KEY_AQUI" \
--header "Content-Type: application/json" \
--data '{
"name": "Minha Loja",
"description": "Loja oficial da minha marca",
"image": "https://example.com/store.png",
"template": "PERSONALIZADO",
"domain": {
"type": "DEFAULT",
"value": "minha-loja"
}
}'
📊 Ejemplo de Respuesta (201)
{
"code": "STORE_CREATED",
"store": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"name": "Minha Loja",
"position": 1,
"description": "Loja oficial da minha marca",
"image": "https://example.com/store.png",
"domain": "minha-loja-web.cabrapi.com.br",
"template": "PERSONALIZADO",
"metadata": null,
"createdAt": "2026-02-28T12:00:00.000Z",
"updatedAt": "2026-02-28T12:00:00.000Z"
}
}
❌ Posibles Errores
| Status | Code | Cuándo ocurre |
|---|---|---|
400 | INVALID_DATA | Body JSON inválido o ningún campo enviado. |
400 | INVALID_DATA_NAME_MIN | name tiene menos de 4 caracteres. |
400 | INVALID_DATA_NAME_MAX | name tiene más de 32 caracteres. |
400 | INVALID_DATA_DESCRIPTION_MIN | description tiene menos de 12 caracteres. |
400 | INVALID_DATA_DESCRIPTION_MAX | description tiene más de 256 caracteres. |
400 | INVALID_DATA_IMAGE | image fuera del rango permitido (12 a 512 caracteres). |
400 | INVALID_DATA_TEMPLATE | template ausente o distinto de PERSONALIZADO y N/A. |
400 | INVALID_DATA_DOMAIN | domain.type distinto de CUSTOM/DEFAULT o domain.value inválido (8 a 75 caracteres). |
400 | DOMAIN_REQUIRED | template es PERSONALIZADO y no se envió domain. |
400 | DOMAIN_ALREADY_EXISTS | El dominio ya está siendo usado por otra tienda. |
400 | NAME_ALREADY_EXISTS | Ya existe una tienda con ese nombre para el mismo usuario. |
401 | API_KEY_NOT_PROVIDED | Header Authorization no enviado. |
401 | INVALID_API_KEY | API Key inválida o no encontrada. |
401 | UNAUTHENTICATED | Sesión/usuario no autenticado en el contexto de la solicitud. |
403 | USER_DISABLED | Cuenta de usuario desactivada o eliminada. |
403 | NO_ACTIVE_SUBSCRIPTION | Cuenta sin plan activo. |
403 | STORE_LIMIT_REACHED | Se alcanzó el límite de tiendas del plan. |
429 | RATE_LIMIT_EXCEEDED | Límite de solicitudes por minuto del plan excedido. |
500 | INTERNAL_SERVER_ERROR | Fallo interno al procesar la solicitud. |
503 | SERVICE_UNAVAILABLE | Servicio temporalmente no disponible. |
🔗 Enlaces Útiles
- Documentación de Autenticación
- Buscar Tiendas
- Obtener Tienda por ID
- Actualizar Tienda
- Eliminar Tienda
Cuerpo
application/json
¿Esta página le ayudó?
⌘I
Create store
curl --request POST \
--url https://api.cabrapi.com.br/v1/stores \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "<string>",
"domain": {
"value": "<string>"
},
"image": "<string>",
"metadata": {},
"name": "<string>"
}
'import requests
url = "https://api.cabrapi.com.br/v1/stores"
payload = {
"description": "<string>",
"domain": { "value": "<string>" },
"image": "<string>",
"metadata": {},
"name": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
description: '<string>',
domain: {value: '<string>'},
image: '<string>',
metadata: {},
name: '<string>'
})
};
fetch('https://api.cabrapi.com.br/v1/stores', 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.cabrapi.com.br/v1/stores",
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([
'description' => '<string>',
'domain' => [
'value' => '<string>'
],
'image' => '<string>',
'metadata' => [
],
'name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.cabrapi.com.br/v1/stores"
payload := strings.NewReader("{\n \"description\": \"<string>\",\n \"domain\": {\n \"value\": \"<string>\"\n },\n \"image\": \"<string>\",\n \"metadata\": {},\n \"name\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.cabrapi.com.br/v1/stores")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"<string>\",\n \"domain\": {\n \"value\": \"<string>\"\n },\n \"image\": \"<string>\",\n \"metadata\": {},\n \"name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cabrapi.com.br/v1/stores")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"<string>\",\n \"domain\": {\n \"value\": \"<string>\"\n },\n \"image\": \"<string>\",\n \"metadata\": {},\n \"name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": "STORE_CREATED",
"store": {
"createdAt": "2023-11-07T05:31:56Z",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"position": 123,
"template": "PERSONALIZADO",
"updatedAt": "2023-11-07T05:31:56Z",
"description": "<string>",
"domain": "<string>",
"image": "<string>",
"metadata": {}
}
}{
"code": "STORE_NOT_FOUND"
}{
"code": "STORE_NOT_FOUND"
}{
"code": "STORE_NOT_FOUND"
}{
"code": "STORE_NOT_FOUND"
}{
"code": "STORE_NOT_FOUND"
}{
"code": "STORE_NOT_FOUND"
}