{
  "info": {
    "_postman_id": "fbx-api-2026-05-06",
    "name": "Fabrixa API",
    "description": "Official Postman collection for the Fabrixa REST API. Covers authentication, account management, product catalog, orders, webhooks, and returns. Pre-configured to switch between sandbox and production environments via the `{{baseUrl}}` variable.\n\nSandbox base: `https://sandbox.api.fabrixa.com/v1`\nProduction base: `https://api.fabrixa.com/v1`\n\nGet a sandbox API key: https://www.fabrixa.com/contact/?subject=api-key",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      { "key": "token", "value": "{{apiKey}}", "type": "string" }
    ]
  },
  "variable": [
    { "key": "baseUrl", "value": "https://sandbox.api.fabrixa.com/v1", "type": "string", "description": "Switch to https://api.fabrixa.com/v1 for production" },
    { "key": "apiKey", "value": "fbx_sandbox_REPLACE_ME", "type": "string", "description": "Bearer token issued by Fabrixa. Sandbox keys begin with fbx_sandbox_; production with fbx_live_" }
  ],
  "item": [
    {
      "name": "Account",
      "description": "Manage your Fabrixa account: read account info, update webhook endpoint, list configured brand assets.",
      "item": [
        {
          "name": "Get account",
          "request": {
            "method": "GET",
            "header": [],
            "url": { "raw": "{{baseUrl}}/account", "host": ["{{baseUrl}}"], "path": ["account"] },
            "description": "Returns the account associated with the current API key — including company name, contact, default shipping origin, and configured webhook URL."
          }
        },
        {
          "name": "Update webhook endpoint",
          "request": {
            "method": "PUT",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"webhook\": {\n    \"url\": \"https://your-domain.com/fabrixa/webhook\",\n    \"events\": [\"order.queued\", \"order.dispatched\", \"order.failed\", \"order.delivered\"]\n  }\n}"
            },
            "url": { "raw": "{{baseUrl}}/account/webhook", "host": ["{{baseUrl}}"], "path": ["account", "webhook"] },
            "description": "Configure where Fabrixa will send signed webhook events. Supports HMAC-SHA256 signature verification — read the signing secret from the response."
          }
        }
      ]
    },
    {
      "name": "Products",
      "description": "Browse the available base catalogue (apparel, home textiles, fabric per metre).",
      "item": [
        {
          "name": "List products",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/products?category=apparel&limit=20",
              "host": ["{{baseUrl}}"],
              "path": ["products"],
              "query": [
                { "key": "category", "value": "apparel", "description": "apparel | home-living | fabrics-per-meter" },
                { "key": "limit", "value": "20" }
              ]
            },
            "description": "Returns the list of base products available for printing. Each product carries variants (size + colour combinations), pricing tier, lead time, and certification metadata."
          }
        },
        {
          "name": "Get product",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/products/tees-tops",
              "host": ["{{baseUrl}}"],
              "path": ["products", "tees-tops"]
            },
            "description": "Returns full detail for one product, including all variants, GSM, fibre composition, certifications, and base price tiers."
          }
        }
      ]
    },
    {
      "name": "Orders",
      "description": "Create, retrieve, and manage production orders.",
      "item": [
        {
          "name": "Create order",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Idempotency-Key", "value": "{{$guid}}", "description": "A unique key per logical order — safe to retry the same key without creating duplicates." }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"order_ref\": \"shopify-1042\",\n  \"items\": [\n    {\n      \"product\": \"tees-tops\",\n      \"variant\": \"unisex-organic-cotton-180gsm-black-m\",\n      \"quantity\": 1,\n      \"artwork_url\": \"https://your-cdn.com/artwork/order-1042-tee.png\"\n    }\n  ],\n  \"shipping\": {\n    \"name\": \"Jane Customer\",\n    \"address1\": \"Markerkant 13 10\",\n    \"city\": \"Almere\",\n    \"postcode\": \"1314 AN\",\n    \"country\": \"NL\"\n  }\n}"
            },
            "url": { "raw": "{{baseUrl}}/orders", "host": ["{{baseUrl}}"], "path": ["orders"] },
            "description": "Creates a production order. Returns the Fabrixa order ID, current status (queued), expected dispatch window, and a webhook subscription URL.\n\nIdempotency-Key REQUIRED — a unique key per logical order. Safe to retry the same key without creating duplicates."
          }
        },
        {
          "name": "Get order",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/orders/ord_8e6f4b2a",
              "host": ["{{baseUrl}}"],
              "path": ["orders", "ord_8e6f4b2a"]
            },
            "description": "Returns the current state of a production order. Status values: queued, printing, sewing, qc, packed, dispatched, delivered, failed, cancelled."
          }
        },
        {
          "name": "List orders",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/orders?status=dispatched&limit=50",
              "host": ["{{baseUrl}}"],
              "path": ["orders"],
              "query": [
                { "key": "status", "value": "dispatched", "description": "Filter by status (optional)" },
                { "key": "limit", "value": "50" },
                { "key": "after", "value": "ord_xyz", "disabled": true, "description": "Cursor for pagination" }
              ]
            },
            "description": "Lists orders for the account. Supports filtering by status and cursor-based pagination."
          }
        },
        {
          "name": "Cancel order",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"reason\": \"customer_cancelled\"\n}" },
            "url": {
              "raw": "{{baseUrl}}/orders/ord_8e6f4b2a/cancel",
              "host": ["{{baseUrl}}"],
              "path": ["orders", "ord_8e6f4b2a", "cancel"]
            },
            "description": "Attempts to cancel an order. Cancellation is only possible while the order is in queued or printing state. Returns success or an error explaining why cancellation isn't possible."
          }
        }
      ]
    },
    {
      "name": "Webhooks",
      "description": "Test webhook delivery and signature verification.",
      "item": [
        {
          "name": "Test webhook",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"event\": \"order.dispatched\",\n  \"order_id\": \"ord_test_8e6f4b2a\"\n}" },
            "url": { "raw": "{{baseUrl}}/webhooks/test", "host": ["{{baseUrl}}"], "path": ["webhooks", "test"] },
            "description": "Sends a test webhook event to your configured endpoint. Useful for verifying signature handling without producing a real order. Payload is signed with HMAC-SHA256 using your webhook signing secret. Header: X-Fabrixa-Signature: sha256=..."
          }
        }
      ]
    },
    {
      "name": "Returns / Claims",
      "description": "Submit and track return / claim requests.",
      "item": [
        {
          "name": "Create claim",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"order_id\": \"ord_8e6f4b2a\",\n  \"reason\": \"misprint\",\n  \"description\": \"Print clarity issue on left sleeve — see attached photo.\",\n  \"evidence_urls\": [\n    \"https://your-cdn.com/claims/order-1042-photo.jpg\"\n  ],\n  \"preferred_remedy\": \"reprint\"\n}"
            },
            "url": { "raw": "{{baseUrl}}/claims", "host": ["{{baseUrl}}"], "path": ["claims"] },
            "description": "Submit a claim against an order. Reason values: misprint, wrong_item, damage_on_arrival, missing_item, other. Preferred remedies: reprint, credit, refund. Fabrixa team reviews within 1 business day."
          }
        },
        {
          "name": "Get claim",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/claims/clm_3e4f5g6h",
              "host": ["{{baseUrl}}"],
              "path": ["claims", "clm_3e4f5g6h"]
            },
            "description": "Returns the current state of a claim. Status values: submitted, under_review, approved, rejected, resolved."
          }
        }
      ]
    },
    {
      "name": "Health & status",
      "description": "Endpoints for monitoring API and production-network health.",
      "item": [
        {
          "name": "Ping",
          "request": {
            "method": "GET",
            "header": [],
            "url": { "raw": "{{baseUrl}}/ping", "host": ["{{baseUrl}}"], "path": ["ping"] },
            "description": "Returns 200 OK with current API version and timestamp. Use for liveness checks and authentication smoke-tests."
          }
        },
        {
          "name": "Production status",
          "request": {
            "method": "GET",
            "header": [],
            "url": { "raw": "{{baseUrl}}/status", "host": ["{{baseUrl}}"], "path": ["status"] },
            "description": "Returns current production network status: facility uptime (Portugal + Spain), current queue depth, average lead time over last 7 days, and any active incidents."
          }
        }
      ]
    }
  ]
}
