Finxa API Docs

Getting Started

Overview

The Finxa Admin API is a RESTful API that lets you programmatically manage your store's products, orders, customers, collections, discounts, shipping, and more. Build custom integrations, automate workflows, or connect your store to third-party services.

All API endpoints are available at:

Base URL
text
https://your-domain.com/api

Every response follows a consistent JSON envelope:

Success response
json
{
  "success": true,
  "data": { ... },
  "message": "Product created"
}
Error response
json
{
  "success": false,
  "error": "Product not found"
}

Authentication

To use the API, you need a Custom App. Create one from your Finxa dashboard under Settings → Apps.

Step 1: Create an App

Navigate to Dashboard → Apps → Create app. Give it a name and select the API scopes you need.

Step 2: Install & Get Credentials

Click "Install app" to activate it. You'll receive two credentials:

ParameterTypeDescription
API KeystringPublic identifier for your app. Starts with fxk_. Safe to store in config.
Secret KeystringPrivate access token. Starts with fxat_. Treat it like a password — never commit to version control.
⚠️The Secret Key is only shown once when you install the app. Store it securely. If you lose it, you'll need to rotate the key from the dashboard.

Step 3: Authenticate Requests

Include your secret key in the X-Finxa-Access-Token header:

Authenticated request
bash
curl https://your-domain.com/api/products \
  -H "X-Finxa-Access-Token: fxat_your_secret_key_here"
💡The API key (fxk_) is your app's public identifier. The secret key (fxat_) is what you send in the header. Don't confuse them.

Making Requests

All request and response bodies use JSON. Set the Content-Type header for requests that include a body:

POST / PATCH / PUT requests
bash
curl -X POST https://your-domain.com/api/products \
  -H "X-Finxa-Access-Token: fxat_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Premium T-Shirt",
    "status": "ACTIVE",
    "variants": [
      { "title": "Default", "price": 29.99, "inventory": 100 }
    ]
  }'

Response Format

Every response is a JSON object with a success boolean. Successful responses include a data field. Error responses include an error string.

ParameterTypeDescription
successRequiredbooleanWhether the request succeeded.
dataobject | arrayThe response payload. Present on success.
messagestringA human-readable success message. Not always present.
errorstringError description. Present on failure.

Paginated Responses

List endpoints support pagination via query parameters:

ParameterTypeDescription
pagenumberPage number (1-indexed). Default: 1
limitnumberItems per page. Default: 20, max: 100
Paginated response
json
{
  "success": true,
  "data": {
    "products": [ ... ],
    "pagination": {
      "total": 156,
      "page": 1,
      "limit": 20,
      "totalPages": 8
    }
  }
}

Rate Limits

The API uses rate limiting to ensure fair usage. Current limits:

ParameterTypeDescription
Standardlimit40 requests per 10-second window per app
BurstlimitUp to 80 requests in a burst, then throttled

When rate limited, you'll receive a 429 Too Many Requests response. Implement exponential backoff in your integration.

Errors

The API uses standard HTTP status codes:

ParameterTypeDescription
200OKRequest succeeded.
201CreatedResource created successfully.
400Bad RequestInvalid request body or parameters.
401UnauthorizedMissing or invalid access token.
403ForbiddenInsufficient scopes for this action.
404Not FoundResource doesn't exist or doesn't belong to your store.
409ConflictResource conflict (duplicate email, can't delete with related records).
429Rate LimitedToo many requests. Retry after a short delay.
500Internal ErrorSomething went wrong on our side. Contact support.
Scope error example
json
{
  "success": false,
  "error": "Insufficient scopes. Required: write_products"
}

Products

Products represent items in your store. Every product has at least one variant (even simple products). Variants hold the price, inventory, SKU, and options like size/color.

List Products

GET/api/products

Retrieve a paginated list of products.

Required scopes:read_products

Query Parameters

ParameterTypeDescription
pagenumberPage number. Default: 1
limitnumberItems per page (max 100). Default: 20
statusstringFilter by status: DRAFT, ACTIVE, or ARCHIVED
searchstringSearch by title, handle, vendor, type, variant title, SKU, or barcode
Example request
bash
curl "https://your-domain.com/api/products?status=ACTIVE&limit=10" \
  -H "X-Finxa-Access-Token: fxat_your_secret_key"
Example response
json
{
  "success": true,
  "data": {
    "products": [
      {
        "id": "cmmm0ekmc0000ny1p7n1vdsbf",
        "title": "Premium T-Shirt",
        "handle": "premium-t-shirt",
        "status": "ACTIVE",
        "description": "A comfortable cotton t-shirt",
        "vendor": "Finxa Apparel",
        "productType": "Clothing",
        "tags": ["summer", "cotton"],
        "images": [],
        "options": [
          { "name": "Size", "position": 0, "values": ["S", "M", "L"] }
        ],
        "weight": null,
        "weightUnit": "kg",
        "isPhysical": true,
        "seoTitle": null,
        "seoDescription": null,
        "publishedAt": "2026-03-10T12:00:00.000Z",
        "createdAt": "2026-03-10T12:00:00.000Z",
        "updatedAt": "2026-03-10T12:30:00.000Z",
        "variants": [
          {
            "id": "clxyz123",
            "title": "Small",
            "sku": "TS-S",
            "barcode": null,
            "price": "29.990",
            "costPrice": "12.000",
            "compareAtPrice": null,
            "inventory": 50,
            "trackInventory": true,
            "taxable": true,
            "requiresShipping": true,
            "options": { "Size": "S" },
            "position": 0,
            "weight": null,
            "weightUnit": "kg"
          }
        ],
        "productImages": [],
        "_count": { "collections": 1 }
      }
    ],
    "pagination": {
      "total": 42,
      "page": 1,
      "limit": 10,
      "totalPages": 5
    }
  }
}

Get Product

GET/api/products/:productId

Retrieve a single product with all variants, images, and collection associations.

Required scopes:read_products
Example request
bash
curl "https://your-domain.com/api/products/cmmm0ekmc0000ny1p7n1vdsbf" \
  -H "X-Finxa-Access-Token: fxat_your_secret_key"

Create Product

POST/api/products

Create a new product with at least one variant.

Required scopes:write_products

Request Body

ParameterTypeDescription
titleRequiredstringProduct title (1-255 chars)
descriptionstringPlain text description
descriptionHtmlstringRich HTML description
handlestringURL slug (auto-generated from title if omitted). Lowercase, numbers, and hyphens only.
statusstringDRAFT (default), ACTIVE, or ARCHIVED
vendorstringProduct vendor/brand name
productTypestringProduct type/category
tagsstring[]Array of tag strings
imagesstring[]Array of image URLs
optionsobject[]Product options, e.g. [{ "name": "Size", "values": ["S","M","L"] }]
weightnumberProduct weight
weightUnitstringWeight unit: kg (default), g, lb, oz
isPhysicalbooleanWhether product requires shipping. Default: true
seoTitlestringSEO title (max 70 chars)
seoDescriptionstringSEO description (max 320 chars)
variantsRequiredobject[]At least one variant (see Variant Object below)

Variant Object

ParameterTypeDescription
titleRequiredstringVariant title, e.g. "Small" or "Red / Large"
priceRequirednumberPrice (≥ 0)
skustringStock keeping unit
barcodestringBarcode (UPC, EAN, etc.)
costPricenumberCost of goods for profit tracking
compareAtPricenumberOriginal price for sale display
inventorynumberStock quantity. Default: 0
trackInventorybooleanTrack stock levels. Default: true
taxablebooleanCharge tax on this variant. Default: true
requiresShippingbooleanRequires shipping. Default: true
optionsobjectKey-value pairs, e.g. { "Size": "S", "Color": "Red" }
imagestringVariant-specific image URL
positionnumberSort position. Default: 0
weightnumberPer-variant weight (overrides product weight)
weightUnitstringWeight unit override
Example: Create a product with size variants
bash
curl -X POST "https://your-domain.com/api/products" \
  -H "X-Finxa-Access-Token: fxat_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Classic Polo Shirt",
    "description": "A timeless polo in premium cotton.",
    "status": "ACTIVE",
    "vendor": "Finxa Apparel",
    "productType": "Clothing",
    "tags": ["polo", "cotton", "casual"],
    "options": [
      { "name": "Size", "position": 0, "values": ["S", "M", "L", "XL"] }
    ],
    "variants": [
      { "title": "Small",  "price": 35.00, "sku": "POLO-S",  "inventory": 25, "options": { "Size": "S" } },
      { "title": "Medium", "price": 35.00, "sku": "POLO-M",  "inventory": 40, "options": { "Size": "M" } },
      { "title": "Large",  "price": 35.00, "sku": "POLO-L",  "inventory": 30, "options": { "Size": "L" } },
      { "title": "XL",     "price": 37.50, "sku": "POLO-XL", "inventory": 15, "options": { "Size": "XL" } }
    ]
  }'

Update Product

PATCH/api/products/:productId

Update product fields. Only send the fields you want to change.

Required scopes:write_products
Example: Update title and tags
bash
curl -X PATCH "https://your-domain.com/api/products/cmmm0ekmc0000ny1p7n1vdsbf" \
  -H "X-Finxa-Access-Token: fxat_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Premium Polo Shirt — Updated",
    "tags": ["polo", "premium", "new-arrival"]
  }'

Delete Product

DELETE/api/products/:productId

Permanently delete a product and all its variants. Products with existing orders cannot be deleted — archive them instead.

Required scopes:write_products
Example request
bash
curl -X DELETE "https://your-domain.com/api/products/cmmm0ekmc0000ny1p7n1vdsbf" \
  -H "X-Finxa-Access-Token: fxat_your_secret_key"
⚠️If a product has associated orders, the API returns 409 Conflict. Use PATCH with {"status": "ARCHIVED"} instead.

Add Variant

POST/api/products/:productId/variants

Add a new variant to an existing product.

Required scopes:write_products
Example request
bash
curl -X POST "https://your-domain.com/api/products/cmmm0ekmc0000ny1p7n1vdsbf/variants" \
  -H "X-Finxa-Access-Token: fxat_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "XXL",
    "price": 39.99,
    "sku": "POLO-XXL",
    "inventory": 10,
    "options": { "Size": "XXL" }
  }'

Update Variant

PATCH/api/products/:productId/variants/:variantId

Update an existing variant. Only send the fields you want to change.

Required scopes:write_products
Example: Update price and inventory
bash
curl -X PATCH "https://your-domain.com/api/products/cmmm0ekmc0000ny1p7n1vdsbf/variants/clxyz123" \
  -H "X-Finxa-Access-Token: fxat_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "price": 32.50,
    "inventory": 75,
    "costPrice": 14.00
  }'

Delete Variant

DELETE/api/products/:productId/variants/:variantId

Delete a variant. A product must always have at least one variant.

Required scopes:write_products
ℹ️You cannot delete the last variant on a product. The API returns 400 Bad Request if you try.

Bulk Sync Variants

PUT/api/products/:productId/variants/sync

Sync all variants in one call. Send the complete desired state — the API will create new variants, update existing ones, and delete any that aren't in your list.

Required scopes:write_products

This is an idempotent replace operation. Include an id on variants you want to update; omit it for new ones. Variants not in the list will be deleted.

Example: Replace all variants
bash
curl -X PUT "https://your-domain.com/api/products/cmmm0ekmc0000ny1p7n1vdsbf/variants/sync" \
  -H "X-Finxa-Access-Token: fxat_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "variants": [
      { "id": "existing_id_1", "title": "Small",  "price": 29.99, "inventory": 50 },
      { "id": "existing_id_2", "title": "Medium", "price": 29.99, "inventory": 40 },
      { "title": "Large",  "price": 29.99, "inventory": 30 },
      { "title": "XL",     "price": 34.99, "inventory": 20 }
    ]
  }'
💡Use bulk sync when managing multiple size/color variants. It's more efficient than individual create/update/delete calls and runs in a single database transaction.

Collections

Collections group products together. They can be manual (hand-picked products) or smart (auto-populated based on rules like tag, vendor, or price).

List Collections

GET/api/collections

Retrieve all collections for your store.

Required scopes:read_collections
Example request
bash
curl "https://your-domain.com/api/collections" \
  -H "X-Finxa-Access-Token: fxat_your_secret_key"

Get Collection

GET/api/collections/:collectionId

Retrieve a single collection with its products.

Required scopes:read_collections

Create Collection

POST/api/collections

Create a new collection.

Required scopes:write_collections

Request Body

ParameterTypeDescription
titleRequiredstringCollection title
handlestringURL slug (auto-generated if omitted)
descriptionstringPlain text description
descriptionHtmlstringRich HTML description
imagestringCollection image URL
collectionTypestringMANUAL (default) or SMART
sortOrderstringMANUAL, BEST_SELLING, ALPHA_ASC, ALPHA_DESC, PRICE_ASC, PRICE_DESC, CREATED_ASC, CREATED_DESC
seoTitlestringSEO title
seoDescriptionstringSEO description
Example: Create a summer collection
bash
curl -X POST "https://your-domain.com/api/collections" \
  -H "X-Finxa-Access-Token: fxat_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Summer Collection 2026",
    "description": "Lightweight essentials for the summer season.",
    "collectionType": "MANUAL",
    "sortOrder": "MANUAL"
  }'

Update Collection

PATCH/api/collections/:collectionId

Update collection fields.

Required scopes:write_collections

Delete Collection

DELETE/api/collections/:collectionId

Delete a collection. Products in the collection are not deleted.

Required scopes:write_collections

Add Product to Collection

POST/api/collections/:collectionId/products

Add one or more products to a manual collection.

Required scopes:write_collections
Example request
bash
curl -X POST "https://your-domain.com/api/collections/col_abc123/products" \
  -H "X-Finxa-Access-Token: fxat_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "productIds": ["prod_id_1", "prod_id_2"]
  }'

Remove Product from Collection

DELETE/api/collections/:collectionId/products/:productId

Remove a product from a collection.

Required scopes:write_collections

Orders

Orders represent customer purchases. Each order has line items, a status, payment information, and shipping details.

Order Statuses

ParameterTypeDescription
DRAFTstatusDraft order, not yet placed
PENDINGstatusOrder placed, awaiting payment
PAIDstatusPayment received
PROCESSINGstatusBeing prepared for shipment
FULFILLEDstatusShipped to customer
COMPLETEDstatusDelivered and finalized
CANCELLEDstatusOrder cancelled
REFUNDEDstatusFull refund issued
PARTIALLY_REFUNDEDstatusPartial refund issued

List Orders

GET/api/orders

Retrieve a paginated list of orders.

Required scopes:read_orders

Query Parameters

ParameterTypeDescription
pagenumberPage number. Default: 1
limitnumberItems per page. Default: 20
statusstringFilter by order status
Example request
bash
curl "https://your-domain.com/api/orders?status=PAID&limit=10" \
  -H "X-Finxa-Access-Token: fxat_your_secret_key"

Get Order

GET/api/orders/:id

Retrieve a single order with all details.

Required scopes:read_orders

Create Draft Order

POST/api/orders/draft

Create a draft order with line items.

Required scopes:write_orders
Example: Create a draft order
bash
curl -X POST "https://your-domain.com/api/orders/draft" \
  -H "X-Finxa-Access-Token: fxat_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "customerId": "cust_abc123",
    "items": [
      { "variantId": "var_xyz789", "quantity": 2 }
    ],
    "shippingAddress": {
      "line1": "123 Main St",
      "city": "Manama",
      "country": "BH"
    }
  }'

Update Order Status

PATCH/api/orders/:id/status

Transition an order to a new status.

Required scopes:write_orders
Example: Mark as fulfilled
bash
curl -X PATCH "https://your-domain.com/api/orders/order_abc123/status" \
  -H "X-Finxa-Access-Token: fxat_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{ "status": "FULFILLED" }'
ℹ️Not all status transitions are valid. The API enforces a state machine — for example, you can't go from COMPLETED back to DRAFT.

Complete Order

POST/api/orders/:id/complete

Mark a fulfilled order as completed.

Required scopes:write_orders

Update Order Items

PUT/api/orders/:id/items

Replace or adjust line items (exchange); inventory and totals update on save.

Required scopes:write_orders

Update Order Notes

PATCH/api/orders/:id/notes

Add or update internal notes on an order.

Required scopes:write_orders
Example request
bash
curl -X PATCH "https://your-domain.com/api/orders/order_abc123/notes" \
  -H "X-Finxa-Access-Token: fxat_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{ "notes": "Customer requested gift wrapping" }'

Update Order Shipping

PATCH/api/orders/:id/shipping

Add or update tracking information.

Required scopes:write_orders
Example: Add tracking info
bash
curl -X PATCH "https://your-domain.com/api/orders/order_abc123/shipping" \
  -H "X-Finxa-Access-Token: fxat_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "trackingNumber": "1Z999AA10123456784",
    "trackingUrl": "https://track.example.com/1Z999AA10123456784",
    "trackingCarrier": "Aramex"
  }'

Customers

Customers represent people who have purchased from your store or that you've added manually. Each customer has a unique email per store.

List Customers

GET/api/customers

Retrieve a paginated list of customers with order counts and total spent.

Required scopes:read_customers

Query Parameters

ParameterTypeDescription
pagenumberPage number. Default: 1
limitnumberItems per page (max 100). Default: 20
searchstringSearch by email, first name, last name, or phone

Get Customer

GET/api/customers/:id

Retrieve a customer with their order history and total spent.

Required scopes:read_customers

Create Customer

POST/api/customers

Create a new customer.

Required scopes:write_customers

Request Body

ParameterTypeDescription
emailRequiredstringCustomer email address (unique per store)
firstNamestringFirst name
lastNamestringLast name
phonestringPhone number
notesstringInternal notes
addressobjectAddress: { line1, line2?, city, state?, country, postalCode? }
Example: Create a customer
bash
curl -X POST "https://your-domain.com/api/customers" \
  -H "X-Finxa-Access-Token: fxat_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "firstName": "Ahmed",
    "lastName": "Al-Khalifa",
    "phone": "+97312345678",
    "address": {
      "line1": "Building 42, Road 3601",
      "city": "Manama",
      "country": "BH",
      "postalCode": "0360"
    }
  }'

Update Customer

PATCH/api/customers/:id

Update customer fields. Only send the fields you want to change.

Required scopes:write_customers

Delete Customer

DELETE/api/customers/:id

Delete a customer permanently.

Required scopes:write_customers
⚠️Deleting a customer doesn't delete their orders. Existing orders will show customerId: null.

Discounts

Create discount codes (percentage or fixed amount) that customers can apply at checkout. Discounts support usage limits, date ranges, minimum order amounts, and can be targeted to specific products or collections.

List Discounts

GET/api/discounts

Retrieve all discount codes.

Required scopes:read_discounts

Get Discount

GET/api/discounts/:id

Retrieve a single discount with product/collection associations.

Required scopes:read_discounts

Create Discount

POST/api/discounts

Create a new discount code.

Required scopes:write_discounts

Request Body

ParameterTypeDescription
titleRequiredstringInternal title for the discount
codeRequiredstringDiscount code customers will enter (unique per store)
typeRequiredstringPERCENTAGE or FIXED_AMOUNT
valueRequirednumberDiscount value (e.g. 10 for 10% or 5.000 for 5 BHD)
triggerstringCODE (default) or AUTOMATIC
appliesTostringORDER (default), PRODUCT, or COLLECTION
minimumOrderAmountnumberMinimum order total to apply. Default: 0
usageLimitnumberMax total uses (null = unlimited)
onePerCustomerbooleanLimit one use per customer. Default: false
startsAtstringISO 8601 start date
endsAtstringISO 8601 end date
productIdsstring[]Product IDs for product-level discounts
collectionIdsstring[]Collection IDs for collection-level discounts
Example: Create 15% off discount
bash
curl -X POST "https://your-domain.com/api/discounts" \
  -H "X-Finxa-Access-Token: fxat_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Summer Sale",
    "code": "SUMMER15",
    "type": "PERCENTAGE",
    "value": 15,
    "minimumOrderAmount": 20,
    "startsAt": "2026-06-01T00:00:00Z",
    "endsAt": "2026-08-31T23:59:59Z"
  }'

Update Discount

PATCH/api/discounts/:id

Update a discount. Only send the fields you want to change.

Required scopes:write_discounts

Delete Discount

DELETE/api/discounts/:id

Delete a discount code.

Required scopes:write_discounts

Shipping

Manage shipping zones and rates. A shipping zone defines which countries/regions are eligible and what rates to charge.

List Shipping Zones

GET/api/shipping/zones

Retrieve all shipping zones with their rates.

Required scopes:read_shipping

Get Shipping Zone

GET/api/shipping/zones/:id

Retrieve a single shipping zone.

Required scopes:read_shipping

Create Shipping Zone

POST/api/shipping/zones

Create a new shipping zone with rates.

Required scopes:write_shipping
Example: Create a domestic shipping zone
bash
curl -X POST "https://your-domain.com/api/shipping/zones" \
  -H "X-Finxa-Access-Token: fxat_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Bahrain Domestic",
    "countries": ["BH"],
    "rates": [
      { "name": "Standard Shipping", "price": 1.500, "minOrderAmount": 0 },
      { "name": "Free Shipping",     "price": 0,     "minOrderAmount": 25 }
    ]
  }'

Update Shipping Zone

PATCH/api/shipping/zones/:id

Update a shipping zone and its rates.

Required scopes:write_shipping

Delete Shipping Zone

DELETE/api/shipping/zones/:id

Delete a shipping zone.

Required scopes:write_shipping

Pages (CMS)

Create and manage static pages for your storefront — About Us, Contact, FAQ, Shipping Policy, etc. Pages support rich HTML content.

List Pages

GET/api/pages/:storeId

Retrieve all pages for your store.

Required scopes:read_content

Get Page

GET/api/pages/:storeId/:pageId

Retrieve a single page.

Required scopes:read_content

Create Page

POST/api/pages/:storeId

Create a new page.

Required scopes:write_content

Request Body

ParameterTypeDescription
titleRequiredstringPage title
handlestringURL slug (auto-generated from title if omitted)
bodystringRich HTML content
publishedbooleanWhether the page is published. Default: false
seoTitlestringSEO title
seoDescriptionstringSEO description
Example: Create an About page
bash
curl -X POST "https://your-domain.com/api/pages/YOUR_STORE_ID" \
  -H "X-Finxa-Access-Token: fxat_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "About Us",
    "body": "<h2>Our Story</h2><p>We started in 2024 with a mission to...</p>",
    "published": true
  }'

Update Page

PUT/api/pages/:storeId/:pageId

Update a page.

Required scopes:write_content

Delete Page

DELETE/api/pages/:storeId/:pageId

Delete a page permanently.

Required scopes:write_content

Scopes Reference

When creating a Custom App, you select which scopes it needs. Scopes control what resources the app can access. A write_ scope always includes the corresponding read_ scope.

ScopeAccessDescription
read_productsReadView products, variants, images, and inventory levels
write_productsRead + WriteCreate, update, and delete products, variants, and images
read_collectionsReadView collections and their products
write_collectionsRead + WriteCreate, update, and delete collections
read_ordersReadView orders, line items, and fulfillment status
write_ordersRead + WriteUpdate order status, add tracking, manage fulfillment
read_customersReadView customer profiles and addresses
write_customersRead + WriteCreate, update, and delete customers
read_discountsReadView discount codes and rules
write_discountsRead + WriteCreate, update, and delete discounts
read_shippingReadView shipping zones, rates, and rules
write_shippingRead + WriteCreate, update, and delete shipping zones and rates
read_contentReadView pages and CMS content
write_contentRead + WriteCreate, update, and delete pages
read_storeReadView store configuration, tax rates, and payment methods
write_storeRead + WriteUpdate store settings, tax rates, and payment methods
read_marketsReadView markets, price lists, and localization settings
write_marketsRead + WriteCreate, update, and delete markets and price lists
read_analyticsReadView storefront sessions, page views, and traffic data
read_webhooksReadView webhook subscriptions
write_webhooksRead + WriteCreate, update, and delete webhook subscriptions

Quick Start Guide

Get up and running in 5 minutes. This example creates a product, then lists all products using Node.js.

quick-start.js
javascript
const API_URL = "https://your-domain.com/api";
const TOKEN = "fxat_your_secret_key_here";

const headers = {
  "X-Finxa-Access-Token": TOKEN,
  "Content-Type": "application/json",
};

// 1. Create a product
async function createProduct() {
  const res = await fetch(`${API_URL}/products`, {
    method: "POST",
    headers,
    body: JSON.stringify({
      title: "My First Product",
      status: "ACTIVE",
      variants: [
        { title: "Default", price: 19.99, inventory: 50 }
      ],
    }),
  });
  const data = await res.json();
  console.log("Created:", data.data.id);
  return data.data;
}

// 2. List all products
async function listProducts() {
  const res = await fetch(`${API_URL}/products`, { headers });
  const data = await res.json();
  console.log(`Found ${data.data.pagination.total} products`);
  return data.data.products;
}

// 3. Update a product
async function updateProduct(productId) {
  const res = await fetch(`${API_URL}/products/${productId}`, {
    method: "PATCH",
    headers,
    body: JSON.stringify({
      description: "Updated via the API!",
      tags: ["api-managed"],
    }),
  });
  const data = await res.json();
  console.log("Updated:", data.data.title);
}

// Run it
const product = await createProduct();
await updateProduct(product.id);
await listProducts();
quick-start.py
python
import requests

API_URL = "https://your-domain.com/api"
HEADERS = {
    "X-Finxa-Access-Token": "fxat_your_secret_key_here",
    "Content-Type": "application/json",
}

# Create a product
res = requests.post(f"{API_URL}/products", headers=HEADERS, json={
    "title": "My First Product",
    "status": "ACTIVE",
    "variants": [
        {"title": "Default", "price": 19.99, "inventory": 50}
    ],
})
product = res.json()["data"]
print(f"Created: {product['id']}")

# List all products
res = requests.get(f"{API_URL}/products", headers=HEADERS)
data = res.json()["data"]
print(f"Found {data['pagination']['total']} products")

# Update a product
res = requests.patch(f"{API_URL}/products/{product['id']}", headers=HEADERS, json={
    "description": "Updated via the API!",
    "tags": ["api-managed"],
})
print(f"Updated: {res.json()['data']['title']}")
F
Finxa Developers

Build powerful integrations with the Finxa Commerce API.