Skip to main content
POST
/
api
/
categorias
Create Category
curl --request POST \
  --url https://api.example.com/api/categorias \
  --header 'Content-Type: application/json' \
  --data '
{
  "nombre": "<string>",
  "slug": "<string>"
}
'
{
  "201": {},
  "400": {},
  "401": {},
  "403": {},
  "categoria_id": 123,
  "nombre": "<string>",
  "slug": "<string>",
  "productos": [
    {}
  ]
}

Authentication

Admin only - This endpoint requires admin authentication. Include an Authorization header with a valid admin bearer token:
Authorization: Bearer YOUR_ADMIN_TOKEN

Request Body

nombre
string
required
The name of the category
slug
string
required
URL-friendly identifier for the category (e.g., “electronics”, “home-decor”)

Request Example

{
  "nombre": "Electronics",
  "slug": "electronics"
}

Response

Returns the newly created category object.
categoria_id
long
Unique identifier for the newly created category
nombre
string
Category name
slug
string
URL-friendly category identifier
productos
array
List of products in this category (empty for new categories)

Response Example

{
  "categoria_id": 1,
  "nombre": "Electronics",
  "slug": "electronics",
  "productos": []
}

cURL Example

curl -X POST https://api.iquea.com/api/categorias \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
  -d '{
    "nombre": "Electronics",
    "slug": "electronics"
  }'

Status Codes

201
Created
Category successfully created
401
Unauthorized
Missing or invalid authentication token
403
Forbidden
User does not have admin permissions
400
Bad Request
Invalid request body or missing required fields

Build docs developers (and LLMs) love