Ta3i
.com
免费开店

Products API

Manage your store's products programmatically via the Ta3i API.

The Products Object

The products API allows you to create, read, update, and delete products in your store. Each product belongs to a store and can have multiple variants, images, and categories.

List All Products

GET/v1/products

Returns a paginated list of all products in your store.

Query Parameters

limitoptional

Number of products per page (max 100)

integerDefault: 10
pageoptional

Page number

integerDefault: 1
statusoptional

Filter: active, draft, or all

stringDefault: all
category_idoptional

Filter by category ID

string
searchoptional

Search products by name

string
Responsejson
{
  "data": [
    {
      "id": "prod_01h2x3abc",
      "name": "T-Shirt Classic",
      "slug": "t-shirt-classic",
      "description": "A comfortable cotton t-shirt",
      "price": 2500.00,
      "compare_price": 3000.00,
      "cost_price": 1500.00,
      "sku": "TS-001",
      "barcode": "1234567890123",
      "stock": 150,
      "track_stock": true,
      "status": "active",
      "is_digital": false,
      "weight": 0.3,
      "images": ["https://cdn.ta3i.com/prod_01h2x3abc/main.jpg"],
      "categories": [
        {"id": "cat_01h2x3xyz", "name": "Clothing"}
      ],
      "variants": [
        {
          "id": "var_01h2x3def",
          "name": "Size: Large",
          "price": 2700.00,
          "stock": 50,
          "sku": "TS-001-L"
        }
      ],
      "created_at": "2024-01-15T10:00:00Z",
      "updated_at": "2024-06-01T15:30:00Z"
    }
  ],
  "meta": {
    "total": 45,
    "page": 1,
    "limit": 10,
    "total_pages": 5
  }
}

Get a Single Product

GET/v1/products/:id
idrequired

The product ID (starts with prod_)

string

Create a Product

POST/v1/products

Request Body

namerequired

Product name

string
pricerequired

Product price in DZD

number
descriptionoptional

Product description

string
stockoptional

Initial stock quantity

integerDefault: 0
imagesoptional

Array of image URLs

arrayDefault: []
bash
curl -X POST https://api.ta3i.com/v1/products \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "New Product",
    "price": 1500,
    "description": "A great product",
    "stock": 100
  }'
⚠️

The API key must be kept secret. Never expose it in client-side code or share it publicly.

Update a Product

PUT/v1/products/:id

Updates an existing product. Only send the fields you want to update.

Delete a Product

DELETE/v1/products/:id

Permanently deletes a product. This action cannot be undone.

Responsejson
{
  "success": true,
  "message": "Product deleted successfully"
}