{
  "info": {
    "_postman_id": "6d3c1f0e-5b7a-4c2e-9a10-cbc0b1e0c626",
    "name": "CareerByteCode ByteConnect API",
    "version": "1.2.0",
    "description": "Every request is signed by the collection pre-request script (X-CBC-Key, X-CBC-Timestamp, X-CBC-Nonce, X-CBC-Signature). Set the collection variables keyId and keySecret (use a TEST key and keep keySecret secret). Guide: https://www.careerbytecode.in/byteconnect/docs/#sdks",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "exec": [
          "// ByteConnect signing: hex HMAC-SHA256(secret, METHOD\\nPATH_AND_QUERY\\nTIMESTAMP\\nNONCE\\nsha256_hex(BODY))",
          "const keyId = pm.variables.get('keyId');",
          "const secret = pm.variables.get('keySecret');",
          "if (!keyId || !secret) { throw new Error('Set the collection variables keyId and keySecret first.'); }",
          "const full = pm.variables.replaceIn(pm.request.url.toString());",
          "const pathAndQuery = full.replace(/^https?:\\/\\/[^\\/]+/, '');",
          "let body = '';",
          "if (pm.request.body && pm.request.body.mode === 'raw') { body = pm.variables.replaceIn(pm.request.body.raw || ''); }",
          "const ts = String(Math.floor(Date.now() / 1000));",
          "const nonce = CryptoJS.lib.WordArray.random(12).toString(CryptoJS.enc.Hex);",
          "const stringToSign = [pm.request.method.toUpperCase(), pathAndQuery, ts, nonce, CryptoJS.SHA256(body).toString(CryptoJS.enc.Hex)].join('\\n');",
          "const signature = CryptoJS.HmacSHA256(stringToSign, secret).toString(CryptoJS.enc.Hex);",
          "pm.request.headers.upsert({ key: 'X-CBC-Key', value: keyId });",
          "pm.request.headers.upsert({ key: 'X-CBC-Timestamp', value: ts });",
          "pm.request.headers.upsert({ key: 'X-CBC-Nonce', value: nonce });",
          "pm.request.headers.upsert({ key: 'X-CBC-Signature', value: signature });"
        ]
      }
    },
    {
      "listen": "test",
      "script": {
        "type": "text/javascript",
        "exec": [
          "const remaining = pm.response.headers.get('X-RateLimit-Remaining');",
          "if (remaining !== undefined && remaining !== null) { console.log('Rate limit remaining this minute: ' + remaining); }",
          "try { const j = pm.response.json(); if (j && j.data && j.data.next_cursor) { pm.collectionVariables.set('cursor', j.data.next_cursor); } if (j && j.data && j.data.order && j.data.order.id) { pm.collectionVariables.set('orderId', j.data.order.id); } } catch (e) {}"
        ]
      }
    }
  ],
  "variable": [
    { "key": "baseUrl", "value": "https://www.careerbytecode.in" },
    { "key": "keyId", "value": "cbc_test_xxxxxxxxxxxx" },
    { "key": "keySecret", "value": "" },
    { "key": "orderId", "value": "" },
    { "key": "cursor", "value": "" },
    { "key": "credentialId", "value": "CBC-AIENG-2026-0001" },
    { "key": "credentialCode", "value": "" }
  ],
  "item": [
    {
      "name": "Ping (check key, signature, address)",
      "request": { "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/api/v1/ping", "host": ["{{baseUrl}}"], "path": ["api", "v1", "ping"] } }
    },
    {
      "name": "Catalogue",
      "request": { "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/api/v1/catalogue", "host": ["{{baseUrl}}"], "path": ["api", "v1", "catalogue"] } }
    },
    {
      "name": "Catalogue (sandbox sample, test keys)",
      "request": { "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/api/v1/catalogue?sample=1", "host": ["{{baseUrl}}"], "path": ["api", "v1", "catalogue"], "query": [{ "key": "sample", "value": "1" }] } }
    },
    {
      "name": "Checkout (make an order)",
      "request": {
        "method": "POST",
        "header": [
          { "key": "Content-Type", "value": "application/json" },
          { "key": "X-CBC-Idempotency-Key", "value": "A-1001-try1" }
        ],
        "body": { "mode": "raw", "raw": "{\"item\":\"course:sample-cloud-devops-bootcamp\",\"partner_ref\":\"A-1001\"}" },
        "url": { "raw": "{{baseUrl}}/api/v1/checkout", "host": ["{{baseUrl}}"], "path": ["api", "v1", "checkout"] }
      }
    },
    {
      "name": "Orders (first page)",
      "request": { "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/api/v1/orders?limit=50", "host": ["{{baseUrl}}"], "path": ["api", "v1", "orders"], "query": [{ "key": "limit", "value": "50" }] } }
    },
    {
      "name": "Orders (next page, uses {{cursor}})",
      "request": { "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/api/v1/orders?limit=50&cursor={{cursor}}", "host": ["{{baseUrl}}"], "path": ["api", "v1", "orders"], "query": [{ "key": "limit", "value": "50" }, { "key": "cursor", "value": "{{cursor}}" }] } }
    },
    {
      "name": "Orders paid since a time",
      "request": { "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/api/v1/orders?status=paid&since=1791360000", "host": ["{{baseUrl}}"], "path": ["api", "v1", "orders"], "query": [{ "key": "status", "value": "paid" }, { "key": "since", "value": "1791360000" }] } }
    },
    {
      "name": "One order (uses {{orderId}})",
      "request": { "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/api/v1/orders/{{orderId}}", "host": ["{{baseUrl}}"], "path": ["api", "v1", "orders", "{{orderId}}"] } }
    },
    {
      "name": "Bulk seats: checkout with quantity (sales extras, when on for your account)",
      "request": {
        "method": "POST",
        "header": [
          { "key": "Content-Type", "value": "application/json" },
          { "key": "X-CBC-Idempotency-Key", "value": "ACME-BATCH-7-try1" }
        ],
        "body": { "mode": "raw", "raw": "{\"item\":\"course:sample-cloud-devops-bootcamp\",\"quantity\":25,\"partner_ref\":\"ACME-BATCH-7\"}" },
        "url": { "raw": "{{baseUrl}}/api/v1/checkout", "host": ["{{baseUrl}}"], "path": ["api", "v1", "checkout"] }
      }
    },
    {
      "name": "Bulk seats: the seats of an order (uses {{orderId}})",
      "request": { "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/api/v1/orders/{{orderId}}/seats", "host": ["{{baseUrl}}"], "path": ["api", "v1", "orders", "{{orderId}}", "seats"] } }
    },
    {
      "name": "Bulk seats: give seats to learners (paid order, uses {{orderId}})",
      "request": {
        "method": "POST",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "body": { "mode": "raw", "raw": "{\"emails\":[\"asha@college.example\",\"ravi@college.example\"]}" },
        "url": { "raw": "{{baseUrl}}/api/v1/orders/{{orderId}}/seats", "host": ["{{baseUrl}}"], "path": ["api", "v1", "orders", "{{orderId}}", "seats"] }
      }
    },
    {
      "name": "IP check (server proof)",
      "request": { "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/api/v1/ip-check", "host": ["{{baseUrl}}"], "path": ["api", "v1", "ip-check"] } }
    },
    {
      "name": "Data feed: open jobs (scope jobs)",
      "request": { "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/api/v1/jobs?limit=20", "host": ["{{baseUrl}}"], "path": ["api", "v1", "jobs"], "query": [{ "key": "limit", "value": "20" }] } }
    },
    {
      "name": "Data feed: open jobs, next page (uses {{cursor}})",
      "request": { "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/api/v1/jobs?limit=20&cursor={{cursor}}", "host": ["{{baseUrl}}"], "path": ["api", "v1", "jobs"], "query": [{ "key": "limit", "value": "20" }, { "key": "cursor", "value": "{{cursor}}" }] } }
    },
    {
      "name": "Data feed: remote DevOps jobs",
      "request": { "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/api/v1/jobs?category=cloud-devops&mode=remote", "host": ["{{baseUrl}}"], "path": ["api", "v1", "jobs"], "query": [{ "key": "category", "value": "cloud-devops" }, { "key": "mode", "value": "remote" }] } }
    },
    {
      "name": "Data feed: certificate check (scope credentials, uses {{credentialId}} and {{credentialCode}})",
      "request": { "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/api/v1/credentials/{{credentialId}}?code={{credentialCode}}", "host": ["{{baseUrl}}"], "path": ["api", "v1", "credentials", "{{credentialId}}"], "query": [{ "key": "code", "value": "{{credentialCode}}" }] } }
    },
    {
      "name": "Data feed: upcoming events (scope events)",
      "request": { "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/api/v1/events", "host": ["{{baseUrl}}"], "path": ["api", "v1", "events"] } }
    },
    {
      "name": "Data feed: ByteBlog posts (scope blog)",
      "request": { "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/api/v1/blog/posts?limit=10", "host": ["{{baseUrl}}"], "path": ["api", "v1", "blog", "posts"], "query": [{ "key": "limit", "value": "10" }] } }
    }
  ]
}
