Skip to content
Menu

Search the site

Type to search guides, blog, API and product.

↑ ↓ to move · Enter to open · Esc to close

API Reference

API

Products

Read your product catalog and semantic search

View as Markdown

The products endpoints expose your agent's catalog: list it, fetch a single product, or run a semantic search over it. Only active (published) products are returned: drafts are never exposed.

Publishable key: for catalog read endpoints the API key acts like a publishable key (it identifies your tenant and meters usage; catalog data is public). It is safe to use from browser code, just like a Stripe publishable key.

MethodPathDescription
GET/v1/productsList active products
GET/v1/products/:idGet a single product
GET/v1/products/searchSemantic search over the catalog

List Products

Returns a paginated list of active products. Filter by category tag or kind:

ParameterTypeDescription
limitnumber1-100, default 50
offsetnumberPagination offset, default 0
tagstringFilter by category tag
kindstring'product' or 'service'
GET/v1/products
curl "https://rest-api.tbit.app/v1/products?limit=20&tag=fiestas&kind=product" \
  -H "X-API-Key: $TBIT_API_KEY"
const response = await fetch('https://rest-api.tbit.app/v1/products?limit=20&tag=fiestas&kind=product', {
  headers: {
    'X-API-Key': process.env.TBIT_API_KEY,
  },
});
const data = await response.json();
import axios from 'axios';

const { data } = await axios.get(
  'https://rest-api.tbit.app/v1/products?limit=20&tag=fiestas&kind=product',
  {
    headers: {
      'X-API-Key': process.env.TBIT_API_KEY,
    },
  },
);
import os
import requests

response = requests.get(
    'https://rest-api.tbit.app/v1/products?limit=20&tag=fiestas&kind=product',
    headers={'X-API-Key': os.environ['TBIT_API_KEY']},
)
data = response.json()
<?php
$ch = curl_init('https://rest-api.tbit.app/v1/products?limit=20&tag=fiestas&kind=product');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'X-API-Key: ' . getenv('TBIT_API_KEY'),
    ],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
Response
{
  "data": [
    {
      "_id": "prod_id_1",
      "kind": "product",
      "title": "Kit fiesta dinosaurios",
      "description": "Decoración completa para fiesta infantil",
      "media": [
        { "url": "https://api.tbit.app/media/dino-kit.jpg", "alt": "Kit fiesta", "type": "image", "position": 0 }
      ],
      "category_tags": ["fiestas", "infantil"],
      "currency": "COP",
      "base_price": 95000,
      "compare_at_price": 120000,
      "variants": [
        {
          "id": "var_id_1",
          "title": "Grande",
          "price": 95000,
          "selected_options": [{ "name": "Tamaño", "value": "Grande" }]
        }
      ],
      "created_at": "2024-09-01T12:00:00Z",
      "updated_at": "2024-09-01T12:00:00Z"
    }
  ],
  "pagination": {
    "total": 134,
    "limit": 20,
    "offset": 0,
    "has_more": true
  }
}

Get a Product

Fetch a single product by id. Drafts, unknown ids, and products belonging to another agent all return a 404:

GET/v1/products/prod_id_1
curl "https://rest-api.tbit.app/v1/products/prod_id_1" \
  -H "X-API-Key: $TBIT_API_KEY"
const response = await fetch('https://rest-api.tbit.app/v1/products/prod_id_1', {
  headers: {
    'X-API-Key': process.env.TBIT_API_KEY,
  },
});
const data = await response.json();
import axios from 'axios';

const { data } = await axios.get(
  'https://rest-api.tbit.app/v1/products/prod_id_1',
  {
    headers: {
      'X-API-Key': process.env.TBIT_API_KEY,
    },
  },
);
import os
import requests

response = requests.get(
    'https://rest-api.tbit.app/v1/products/prod_id_1',
    headers={'X-API-Key': os.environ['TBIT_API_KEY']},
)
data = response.json()
<?php
$ch = curl_init('https://rest-api.tbit.app/v1/products/prod_id_1');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'X-API-Key: ' . getenv('TBIT_API_KEY'),
    ],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
Response
{
  "error": {
    "code": "NOT_FOUND"
  }
}

Search uses vector embeddings, not keyword matching: a query like "fiesta de dinosaurios" finds dinosaur-themed party products even if no product title contains those exact words. Search is rate limited to 30 requests per minute per key (on top of the global 100/min limit). Each result may include a relevance score:

GET/v1/products/search
curl "https://rest-api.tbit.app/v1/products/search?q=fiesta%20de%20dinosaurios&limit=10" \
  -H "X-API-Key: $TBIT_API_KEY"
const response = await fetch('https://rest-api.tbit.app/v1/products/search?q=fiesta%20de%20dinosaurios&limit=10', {
  headers: {
    'X-API-Key': process.env.TBIT_API_KEY,
  },
});
const data = await response.json();
import axios from 'axios';

const { data } = await axios.get(
  'https://rest-api.tbit.app/v1/products/search?q=fiesta%20de%20dinosaurios&limit=10',
  {
    headers: {
      'X-API-Key': process.env.TBIT_API_KEY,
    },
  },
);
import os
import requests

response = requests.get(
    'https://rest-api.tbit.app/v1/products/search?q=fiesta%20de%20dinosaurios&limit=10',
    headers={'X-API-Key': os.environ['TBIT_API_KEY']},
)
data = response.json()
<?php
$ch = curl_init('https://rest-api.tbit.app/v1/products/search?q=fiesta%20de%20dinosaurios&limit=10');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'X-API-Key: ' . getenv('TBIT_API_KEY'),
    ],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
Response
{
  "data": [
    {
      "_id": "prod_id_1",
      "kind": "product",
      "title": "Kit fiesta dinosaurios",
      "currency": "COP",
      "base_price": 95000,
      "score": 0.91
    }
  ]
}

All endpoints return product objects with the following shape. base_price is a plain number in the catalog currency (e.g. COP, no minor units). compare_at_price is only present when the product is on sale and is always higher than base_price:

FieldTypeDescription
_idstringProduct id
kindstring'product' or 'service'
titlestringProduct title
descriptionstringProduct description
mediaarrayArray of { url, alt?, type: 'image' | 'video', position? }
category_tagsstring[]Category tags
currencystringISO 4217 currency code
base_pricenumberPrice as a plain number (e.g. COP, no minor units)
compare_at_pricenumber?Only when on sale; always higher than base_price
variantsarrayArray of { id, title, price, compare_at_price?, selected_options: [{ name, value }] }
created_atstringISO 8601 timestamp
updated_atstringISO 8601 timestamp