{
  "info": {
    "_postman_id": "7158fcb7-6e3e-4bd9-8cab-7bf91b2dfbad",
    "name": "CapitalXTend.Pro CRM Partner API v1",
    "description": "Server-to-server collection for approved advertisers, affiliates and partners. Store apiKey in a private Postman environment or secret vault; never commit or share it. Use a globally unique Idempotency-Key for every logical mutation and reuse the same key and body only for retries.",
    "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://capitalxtend.pro/api/crm/v1", "type": "string" },
    { "key": "apiKey", "value": "", "type": "string" },
    { "key": "externalId", "value": "AFF:LEAD-10482", "type": "string" },
    { "key": "secondExternalId", "value": "AFF:LEAD-10483", "type": "string" },
    { "key": "startDate", "value": "2026-08-10", "type": "string" },
    { "key": "endDate", "value": "2026-09-10", "type": "string" },
    { "key": "leadIdempotencyKey", "value": "lead-aff-10482-v1", "type": "string" },
    { "key": "commentIdempotencyKey", "value": "comment-aff-10482-0001", "type": "string" },
    { "key": "nextCursor", "value": "", "type": "string" }
  ],
  "item": [
    {
      "name": "1 · Connection",
      "item": [
        {
          "name": "Health check",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json", "type": "text" },
              { "key": "X-Request-Id", "value": "postman-health-0001", "type": "text" }
            ],
            "url": {
              "raw": "{{baseUrl}}/health",
              "host": ["{{baseUrl}}"],
              "path": ["health"]
            },
            "description": "Requires health:read. Confirms the active tenant, API-key prefix and granted scopes."
          },
          "response": []
        }
      ]
    },
    {
      "name": "2 · Leads",
      "item": [
        {
          "name": "Create lead",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Accept", "value": "application/json", "type": "text" },
              { "key": "Content-Type", "value": "application/json", "type": "text" },
              { "key": "Idempotency-Key", "value": "{{leadIdempotencyKey}}", "type": "text" },
              { "key": "X-Request-Id", "value": "postman-lead-create-0001", "type": "text" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"externalId\": \"{{externalId}}\",\n  \"firstName\": \"Ayse\",\n  \"lastName\": \"Yilmaz\",\n  \"email\": \"ayse@example.com\",\n  \"phone\": \"+905551112233\",\n  \"age\": 31,\n  \"source\": \"affiliate\",\n  \"campaign\": \"TR-Q3-Search\",\n  \"utmSource\": \"google\",\n  \"utmMedium\": \"cpc\",\n  \"utmCampaign\": \"yatirim-2026\",\n  \"landingPage\": \"https://partner.example/landing\",\n  \"preferredLanguage\": \"tr-TR\",\n  \"timezone\": \"Europe/Istanbul\",\n  \"tags\": [\"TR\", \"search\"],\n  \"marketingConsent\": true,\n  \"consentAt\": \"2026-09-07T10:15:00+03:00\",\n  \"consentSource\": \"lead-form-v3\"\n}",
              "options": { "raw": { "language": "json" } }
            },
            "url": {
              "raw": "{{baseUrl}}/leads",
              "host": ["{{baseUrl}}"],
              "path": ["leads"]
            },
            "description": "Requires leads:write. Before sending, change externalId and leadIdempotencyKey to values unique in your own source system. Do not send status; CRM assigns NEW automatically. When retrying the same logical request, keep both the body and Idempotency-Key unchanged."
          },
          "response": []
        },
        {
          "name": "Get lead",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json", "type": "text" },
              { "key": "X-Request-Id", "value": "postman-lead-get-0001", "type": "text" }
            ],
            "url": {
              "raw": "{{baseUrl}}/leads/{{externalId}}",
              "host": ["{{baseUrl}}"],
              "path": ["leads", "{{externalId}}"]
            },
            "description": "Requires leads:read. Postman URL-encodes the path variable. The response contains only externalId, status, createdAt and updatedAt for a lead owned by this partner tenant. All customer and internal operational fields are excluded."
          },
          "response": []
        }
      ]
    },
    {
      "name": "3 · Operational lead statuses",
      "item": [
        {
          "name": "Get one status",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json", "type": "text" },
              { "key": "X-Request-Id", "value": "postman-status-get-0001", "type": "text" }
            ],
            "url": {
              "raw": "{{baseUrl}}/lead-statuses/{{externalId}}",
              "host": ["{{baseUrl}}"],
              "path": ["lead-statuses", "{{externalId}}"]
            },
            "description": "Requires lead-statuses:read. Returns the current operational CRM status: NEW, RECOVER, CALLBACK, IN_CALL, NO_ANSWER, NEVER_ANSWERS, NOT_INTERESTED, INVALID, WRONG_NUMBER, FAKE_INFO, DEPOSITOR or ACTIVE_TRADER. All 12 values, including DEPOSITOR, are visible only for a lead owned by this partner tenant. Lifecycle/KYC status, personal data, KYC documents, assigned staff and balances are excluded."
          },
          "response": []
        },
        {
          "name": "List statuses by date",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json", "type": "text" },
              { "key": "X-Request-Id", "value": "postman-status-batch-0001", "type": "text" }
            ],
            "url": {
              "raw": "{{baseUrl}}/lead-statuses?startDate={{startDate}}&endDate={{endDate}}&page=1&limit=500",
              "host": ["{{baseUrl}}"],
              "path": ["lead-statuses"],
              "query": [
                { "key": "startDate", "value": "{{startDate}}" },
                { "key": "endDate", "value": "{{endDate}}" },
                { "key": "page", "value": "1" },
                { "key": "limit", "value": "500" }
              ]
            },
            "description": "Requires lead-statuses:read. Lists partner-owned leads created inside the inclusive UTC startDate/endDate range, newest first. Uses one-based page pagination and supports limit up to 500. The response includes page, limit, total, totalPages, hasNext and hasPrevious."
          },
          "response": []
        }
      ]
    },
    {
      "name": "4 · Shared comments",
      "item": [
        {
          "name": "List shared comments",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json", "type": "text" },
              { "key": "X-Request-Id", "value": "postman-comments-list-0001", "type": "text" }
            ],
            "url": {
              "raw": "{{baseUrl}}/leads/{{externalId}}/comments?limit=50&cursor={{nextCursor}}",
              "host": ["{{baseUrl}}"],
              "path": ["leads", "{{externalId}}", "comments"],
              "query": [
                { "key": "limit", "value": "50" },
                { "key": "cursor", "value": "{{nextCursor}}", "disabled": true }
              ]
            },
            "description": "Requires comments:read. Enable cursor only after copying a non-null nextCursor value into the collection variable. Only SHARED comments are returned."
          },
          "response": []
        },
        {
          "name": "Create shared comment",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Accept", "value": "application/json", "type": "text" },
              { "key": "Content-Type", "value": "application/json", "type": "text" },
              { "key": "Idempotency-Key", "value": "{{commentIdempotencyKey}}", "type": "text" },
              { "key": "X-Request-Id", "value": "postman-comment-create-0001", "type": "text" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"body\": \"Musteri yeni gorusme saati paylasti.\"\n}",
              "options": { "raw": { "language": "json" } }
            },
            "url": {
              "raw": "{{baseUrl}}/leads/{{externalId}}/comments",
              "host": ["{{baseUrl}}"],
              "path": ["leads", "{{externalId}}", "comments"]
            },
            "description": "Requires comments:write. Creates an append-only SHARED comment. Change commentIdempotencyKey for each new comment; keep it unchanged only when retrying the same body."
          },
          "response": []
        }
      ]
    }
  ]
}
