{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"API Basics","description":"Sprinklr offers robust, convenient, and simple RESTful Web service APIs to integrate data from Sprinklr to any external system.","keywords":["Sprinklr API","Sprinklr Developer Portal","OAuth 2.0","RESTful API","Social Media API","Customer Experience API","Unified-CXM","Social Listening API"]},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"api-basics","__idx":0},"children":["API Basics"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This guide covers the core patterns and techniques you'll use when working with the Sprinklr API. Once you understand these fundamentals, you'll be able to build robust integrations that handle real-world scenarios effectively."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"how-requests-and-responses-work","__idx":1},"children":["How requests and responses work"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Every interaction with the Sprinklr API follows the same basic pattern: you send a request, and you get back a response. Let's break down what that looks like."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"anatomy-of-a-request","__idx":2},"children":["Anatomy of a request"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Here's a typical API request:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"GET /api/v3/account?accountId=600057112 HTTP/1.1\nHost: api-v3.sprinklr.com\nAuthorization: Bearer SPRD_tjACKHVlwb3D7Xd2...\nKey: ebgw8cwygvgc7vptgxty2ekq\nContent-Type: application/json\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Let's examine each part:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["1. HTTP method (GET)"]}," ","This tells the API what kind of operation you want to perform. GET retrieves data, POST creates new data, PUT/PATCH updates existing data, and DELETE removes data."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["2. Endpoint path (/api/v3/account)"]}," ","This identifies which resource you're working with. The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/api/v3/"]}," prefix is on all endpoints, then comes the resource name."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["3. Query parameters (?accountId=600057112)"]}," ","These filter or modify the request. Different endpoints support different parameters."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["4. Headers"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Authorization"]},": Your access token for authentication"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Key"]},": Your API key for identification"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Content-Type"]},": Tells the API you're sending JSON (for POST/PUT/PATCH)"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["5. Request body"]}," (not shown in this GET request)"," ","For POST, PUT, and PATCH requests, you'll send data in JSON format in the request body."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"understanding-responses","__idx":3},"children":["Understanding responses"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Every Sprinklr API response uses a consistent structure. This makes it easy to handle responses in your code:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Success response:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"success\": true,\n  \"data\": {\n    \"id\": \"600057112\",\n    \"accountType\": \"TWITTER\",\n    \"accountDisplayName\": \"@YourBrand\",\n    \"followerCount\": 15420,\n    \"status\": \"ACTIVE\"\n  }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Error response:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"success\": false,\n  \"errors\": [\n    {\n      \"code\": \"NOT_FOUND\",\n      \"message\": \"Account with ID 600057112 not found\",\n      \"field\": \"accountId\"\n    }\n  ]\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Notice the key differences:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["success"]}," is always present and tells you if the request worked"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Successful responses have a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]}," field with your results"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Failed responses have an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errors"]}," array explaining what went wrong"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Error objects include a machine-readable ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["code"]},", human-readable ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["message"]},", and sometimes a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["field"]}," indicating which parameter caused the problem"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This consistent structure means you can write generic error handling code that works across all endpoints."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"http-methods-what-each-one-does","__idx":4},"children":["HTTP methods: What each one does"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Sprinklr API uses standard REST conventions for HTTP methods. Here's when to use each one:"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"get---retrieving-data","__idx":5},"children":["GET - Retrieving data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use GET when you want to read data without making any changes:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Get account information\nGET /api/v3/account?accountId=600057112\n\n# Search for messages\nGET /api/v3/message?messageId=MSG_12345\n\n# Get multiple profiles\nGET /api/v3/profile?profileId=PROF_1,PROF_2,PROF_3\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["GET requests:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Don't have a request body"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Pass all parameters in the URL"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Are safe to retry - they won't change anything"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Can be cached by browsers and proxies"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"post---creating-or-searching","__idx":6},"children":["POST - Creating or searching"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["POST has two main uses in the Sprinklr API:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["1. Creating new resources:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"POST /api/v3/case\nContent-Type: application/json\n\n{\n  \"subject\": \"Customer inquiry about pricing\",\n  \"priority\": \"MEDIUM\",\n  \"source\": \"TWITTER\",\n  \"customerId\": \"CUST_789\"\n}\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["2. Complex searches:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"POST /api/v3/message/search\nContent-Type: application/json\n\n{\n  \"startTime\": \"2026-02-01T00:00:00Z\",\n  \"endTime\": \"2026-02-11T23:59:59Z\",\n  \"accountIds\": [\"600057112\"],\n  \"sentiment\": [\"POSITIVE\", \"NEUTRAL\"],\n  \"page\": 0,\n  \"size\": 50\n}\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Why use POST for searches? When you need to send complex filter criteria (like arrays, date ranges, or nested conditions), the data doesn't fit well in a URL. POST lets you send structured JSON that's easier to work with."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"put---full-update","__idx":7},"children":["PUT - Full update"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["PUT replaces an entire resource with new data:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"PUT /api/v3/case/CASE_789\nContent-Type: application/json\n\n{\n  \"subject\": \"Updated subject\",\n  \"priority\": \"HIGH\",\n  \"status\": \"IN_PROGRESS\",\n  \"assignedTo\": \"agent@yourbrand.com\",\n  \"notes\": \"Updated by API\"\n}\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["With PUT, you typically need to send all fields, not just the ones you're changing. If you omit a field, it might be set to null or left unchanged (depending on the endpoint)."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"patch---partial-update","__idx":8},"children":["PATCH - Partial update"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["PATCH lets you update just specific fields:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"PATCH /api/v3/case/CASE_789\nContent-Type: application/json\n\n{\n  \"priority\": \"URGENT\",\n  \"assignedTo\": \"senior-agent@yourbrand.com\"\n}\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This is more convenient than PUT because you only send what you want to change. Other fields remain untouched."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"delete---removing-data","__idx":9},"children":["DELETE - Removing data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["DELETE removes a resource:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"DELETE /api/v3/case/CASE_789\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Be careful with DELETE operations - they're usually permanent. Some resources might support soft deletes (marking as inactive) instead of hard deletes (permanent removal)."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"working-with-single-resources","__idx":10},"children":["Working with single resources"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The simplest pattern is fetching a single resource by its ID:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl \"https://api-v3.sprinklr.com/api/v3/account?accountId=600057112\" \\\n  -H \"Authorization: Bearer YOUR_ACCESS_TOKEN\" \\\n  -H \"Key: YOUR_API_KEY\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Response:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"success\": true,\n  \"data\": {\n    \"id\": \"600057112\",\n    \"accountType\": \"TWITTER\",\n    \"accountDisplayName\": \"@YourBrand\",\n    \"accountScreenName\": \"YourBrand\",\n    \"verified\": true,\n    \"followerCount\": 15420,\n    \"status\": \"ACTIVE\",\n    \"createdTime\": \"2024-03-15T10:30:00Z\"\n  }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Even though you requested one account, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]}," is still an array (in some endpoints) or a single object (in others). Check the API reference for each endpoint to see which structure it uses."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"batch-operations-your-new-best-friend","__idx":11},"children":["Batch operations: Your new best friend"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["One of the most powerful features of the Sprinklr API is ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["batch operations"]},". Instead of making multiple individual requests, you can fetch up to 50 resources at once."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"why-batching-matters","__idx":12},"children":["Why batching matters"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Without batching:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"// 10 separate API calls\n// Takes ~3-5 seconds\n// Uses 10 of your rate limit quota\nconst accounts = [];\nfor (const id of accountIds) {\n  const account = await fetchAccount(id);\n  accounts.push(account);\n}\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["With batching:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"// 1 API call\n// Takes ~300ms\n// Uses 1 of your rate limit quota\nconst accounts = await fetchAccounts(accountIds);\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The difference becomes huge when you're dealing with hundreds or thousands of resources."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"how-to-use-batch-requests","__idx":13},"children":["How to use batch requests"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Just provide comma-separated IDs in your request:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl \"https://api-v3.sprinklr.com/api/v3/account?accountId=600057112,600057113,600057114\" \\\n  -H \"Authorization: Bearer YOUR_ACCESS_TOKEN\" \\\n  -H \"Key: YOUR_API_KEY\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Response:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"success\": true,\n  \"data\": [\n    {\n      \"id\": \"600057112\",\n      \"accountType\": \"TWITTER\",\n      \"accountDisplayName\": \"@YourBrand\",\n      \"followerCount\": 15420\n    },\n    {\n      \"id\": \"600057113\",\n      \"accountType\": \"FACEBOOK\",\n      \"accountDisplayName\": \"Your Brand\",\n      \"followerCount\": 28500\n    },\n    {\n      \"id\": \"600057114\",\n      \"accountType\": \"INSTAGRAM\",\n      \"accountDisplayName\": \"@yourbrand\",\n      \"followerCount\": 42300\n    }\n  ]\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"handling-partial-failures","__idx":14},"children":["Handling partial failures"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["What happens if some IDs exist but others don't? The API returns what it can and tells you about the failures:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Request:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"GET /api/v3/account?accountId=600057112,999999999,600057114\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Response:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"success\": false,\n  \"data\": [\n    {\n      \"id\": \"600057112\",\n      \"accountDisplayName\": \"@YourBrand\"\n    },\n    {\n      \"id\": \"600057114\",\n      \"accountDisplayName\": \"@yourbrand\"\n    }\n  ],\n  \"errors\": [\n    {\n      \"code\": \"NOT_FOUND\",\n      \"message\": \"Account with ID 999999999 not found\",\n      \"field\": \"accountId\"\n    }\n  ]\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Notice:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["success"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}," because the request partially failed"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]}," contains the accounts that were found"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errors"]}," lists what went wrong"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Here's how to handle this in code:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"async function getAccountsWithErrorHandling(accountIds) {\n  const response = await fetchAccounts(accountIds);\n\n  // Track which ones succeeded\n  const foundAccounts = response.data || [];\n  console.log(`Found ${foundAccounts.length} accounts`);\n\n  // Track which ones failed\n  if (response.errors && response.errors.length > 0) {\n    console.log(`${response.errors.length} accounts not found:`);\n    response.errors.forEach(error => {\n      console.log(`  - ${error.message}`);\n    });\n  }\n\n  return foundAccounts;\n}\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"batch-size-limits","__idx":15},"children":["Batch size limits"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can request up to ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["50 resources"]}," in a single batch:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# ✅ Valid - 50 IDs\nGET /api/v3/account?accountId=1,2,3,...,50\n\n# ❌ Invalid - 51 IDs (will return an error)\nGET /api/v3/account?accountId=1,2,3,...,51\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you need more than 50, break your request into multiple batches:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"function chunkArray(array, size) {\n  const chunks = [];\n  for (let i = 0; i < array.length; i += size) {\n    chunks.push(array.slice(i, i + size));\n  }\n  return chunks;\n}\n\nasync function getAllAccounts(accountIds) {\n  const chunks = chunkArray(accountIds, 50);\n  const results = [];\n\n  for (const chunk of chunks) {\n    const response = await fetchAccounts(chunk);\n    if (response.data) {\n      results.push(...response.data);\n    }\n  }\n\n  return results;\n}\n\n// Fetch 237 accounts in 5 batches (50+50+50+50+37)\nconst accounts = await getAllAccounts(array237Ids);\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"searching-and-filtering","__idx":16},"children":["Searching and filtering"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For more complex queries, you'll use search endpoints that accept POST requests with JSON filter criteria."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"simple-filters","__idx":17},"children":["Simple filters"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Let's find all open customer service cases with high priority:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X POST \"https://api-v3.sprinklr.com/api/v3/case/search\" \\\n  -H \"Authorization: Bearer YOUR_ACCESS_TOKEN\" \\\n  -H \"Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"status\": [\"OPEN\"],\n    \"priority\": [\"HIGH\"],\n    \"page\": 0,\n    \"size\": 20,\n    \"sort\": \"createdTime,desc\"\n  }'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This returns the 20 most recent high-priority open cases."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"date-range-filters","__idx":18},"children":["Date range filters"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Many searches support date ranges:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X POST \"https://api-v3.sprinklr.com/api/v3/message/search\" \\\n  -H \"Authorization: Bearer YOUR_ACCESS_TOKEN\" \\\n  -H \"Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"startTime\": \"2026-02-01T00:00:00Z\",\n    \"endTime\": \"2026-02-11T23:59:59Z\",\n    \"accountIds\": [\"600057112\"],\n    \"messageTypes\": [\"TWITTER_POST\", \"TWITTER_REPLY\"]\n  }'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Important"]},": Dates must be in ISO 8601 format with UTC timezone:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["✅ ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["2026-02-11T14:30:00Z"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["❌ ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["2026-02-11"]}," (missing time)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["❌ ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["02/11/2026"]}," (wrong format)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["❌ ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["2026-02-11 14:30:00"]}," (missing timezone)"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"combining-multiple-filters","__idx":19},"children":["Combining multiple filters"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can combine filters to narrow your search:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"startTime\": \"2026-02-01T00:00:00Z\",\n  \"endTime\": \"2026-02-11T23:59:59Z\",\n  \"accountIds\": [\"600057112\", \"600057113\"],\n  \"messageTypes\": [\"TWITTER_POST\"],\n  \"sentiment\": [\"NEGATIVE\"],\n  \"hasMedia\": true,\n  \"minEngagement\": 100,\n  \"page\": 0,\n  \"size\": 50,\n  \"sort\": \"engagementScore,desc\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This finds negative sentiment posts with media and at least 100 engagements, sorted by engagement score."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"understanding-and-vs-or-logic","__idx":20},"children":["Understanding AND vs OR logic"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Most filters use ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["AND"]}," logic by default:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"status\": [\"OPEN\"],\n  \"priority\": [\"HIGH\"]\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This means: status = OPEN ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["AND"]}," priority = HIGH"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When you provide multiple values for a single filter, it's usually ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["OR"]}," logic:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"status\": [\"OPEN\", \"PENDING\"]\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This means: status = OPEN ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["OR"]}," status = PENDING"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Check the API reference for each endpoint to understand its specific filter behavior."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"sorting-results","__idx":21},"children":["Sorting results"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Most list and search endpoints support sorting with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sort"]}," parameter:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Sort by creation time, newest first\nsort=createdTime,desc\n\n# Sort by creation time, oldest first\nsort=createdTime,asc\n\n# Sort by name alphabetically\nsort=name,asc\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The format is: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["fieldName,direction"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["asc"]}," = ascending (A→Z, 0→9, oldest→newest)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["desc"]}," = descending (Z→A, 9→0, newest→oldest)"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"multiple-sort-fields","__idx":22},"children":["Multiple sort fields"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Some endpoints support sorting by multiple fields:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Sort by priority first, then by creation time\nsort=priority,desc&sort=createdTime,desc\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This means: sort by priority (urgent first), and within each priority level, sort by creation time (newest first)."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"working-with-timestamps","__idx":23},"children":["Working with timestamps"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Sprinklr API uses ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["ISO 8601 format"]}," with ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["UTC timezone"]}," for all timestamps."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"reading-timestamps","__idx":24},"children":["Reading timestamps"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Timestamps in responses look like this:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"createdTime\": \"2026-02-11T14:30:00Z\",\n  \"modifiedTime\": \"2026-02-11T15:45:00Z\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Z"]}," at the end means UTC (Coordinated Universal Time). All times from the API are in UTC, regardless of your local timezone."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"sending-timestamps","__idx":25},"children":["Sending timestamps"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When you send timestamps in requests, use the same format:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"// ✅ Correct\n{\n  \"startTime\": \"2026-02-01T00:00:00Z\",\n  \"endTime\": \"2026-02-11T23:59:59Z\"\n}\n\n// ❌ Wrong - missing time\n{\n  \"startTime\": \"2026-02-01\"\n}\n\n// ❌ Wrong - missing timezone\n{\n  \"startTime\": \"2026-02-01T00:00:00\"\n}\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"converting-from-your-local-timezone","__idx":26},"children":["Converting from your local timezone"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Always convert your local times to UTC before sending them to the API:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"// JavaScript example\nconst localDate = new Date('2026-02-11 14:30:00'); // Your local time\nconst utcString = localDate.toISOString(); // \"2026-02-11T14:30:00.000Z\"\n\n// Python example\nfrom datetime import datetime, timezone\n\nlocal_time = datetime(2026, 2, 11, 14, 30, 0)\nutc_time = local_time.astimezone(timezone.utc)\nutc_string = utc_time.isoformat().replace('+00:00', 'Z')\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"converting-to-your-local-timezone","__idx":27},"children":["Converting to your local timezone"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When displaying times to users, convert from UTC to their local timezone:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"// JavaScript example\nconst utcString = \"2026-02-11T14:30:00Z\";\nconst localDate = new Date(utcString);\nconst localString = localDate.toLocaleString(); // Displays in user's timezone\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"pagination-handling-large-datasets","__idx":28},"children":["Pagination: Handling large datasets"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When you're working with endpoints that return lots of results (like searching messages or cases), the API breaks the results into pages."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"how-pagination-works","__idx":29},"children":["How pagination works"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X POST \"https://api-v3.sprinklr.com/api/v3/case/search\" \\\n  -H \"Authorization: Bearer YOUR_ACCESS_TOKEN\" \\\n  -H \"Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"status\": [\"OPEN\"],\n    \"page\": 0,\n    \"size\": 20,\n    \"sort\": \"createdTime,desc\"\n  }'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Response:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"success\": true,\n  \"data\": [\n    {...}, {...}, ... // 20 cases\n  ],\n  \"pagination\": {\n    \"page\": 0,\n    \"size\": 20,\n    \"totalElements\": 847,\n    \"totalPages\": 43,\n    \"hasNext\": true,\n    \"hasPrevious\": false,\n    \"first\": true,\n    \"last\": false\n  }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pagination"]}," object tells you:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page"]},": Which page you're on (0-indexed, so 0 is the first page)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["size"]},": How many items per page"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["totalElements"]},": Total number of matching items across all pages"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["totalPages"]},": Total number of pages"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["hasNext"]},": Whether there are more pages after this one"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["hasPrevious"]},": Whether there are pages before this one"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["first"]},": Whether this is the first page"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["last"]},": Whether this is the last page"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"fetching-the-next-page","__idx":30},"children":["Fetching the next page"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To get the next page, just increment the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page"]}," parameter:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"status\": [\"OPEN\"],\n  \"page\": 1,    // ← Changed from 0 to 1\n  \"size\": 20,\n  \"sort\": \"createdTime,desc\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"iterating-through-all-pages","__idx":31},"children":["Iterating through all pages"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Here's how to fetch all results across multiple pages:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"async function getAllCases(filters) {\n  const allCases = [];\n  let page = 0;\n  let hasMore = true;\n\n  while (hasMore) {\n    const response = await searchCases({\n      ...filters,\n      page,\n      size: 50\n    });\n\n    if (response.success && response.data) {\n      allCases.push(...response.data);\n    }\n\n    hasMore = response.pagination?.hasNext || false;\n    page++;\n\n    // Optional: Add a small delay to avoid rate limits\n    if (hasMore) {\n      await new Promise(resolve => setTimeout(resolve, 100));\n    }\n  }\n\n  return allCases;\n}\n\n// Usage\nconst cases = await getAllCases({ status: [\"OPEN\", \"PENDING\"] });\nconsole.log(`Found ${cases.length} total cases`);\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"choosing-page-sizes","__idx":32},"children":["Choosing page sizes"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The API supports page sizes from 1 to 100. Here's how to choose:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Page size"},"children":["Page size"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Best for"},"children":["Best for"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Pros"},"children":["Pros"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Cons"},"children":["Cons"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["20-30"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Real-time UI"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Fast responses, responsive"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["More API calls needed"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["50-75"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Background processing"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Balanced"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Middle ground"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["100"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Bulk exports"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Fewest API calls"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Slower responses, more memory"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["General guideline"]},": Start with 50 items per page and adjust based on your needs."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"common-parameters","__idx":33},"children":["Common parameters"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Most endpoints support these standard parameters:"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"page","__idx":34},"children":["page"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Type"]},": Integer"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Default"]},": 0"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Range"]},": 0 to totalPages-1"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Description"]},": Which page of results to return (0-indexed)"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"page=0  # First page\npage=1  # Second page\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"size","__idx":35},"children":["size"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Type"]},": Integer"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Default"]},": 20"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Range"]},": 1 to 100"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Description"]},": How many items per page"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"size=20   # 20 items per page\nsize=50   # 50 items per page\nsize=100  # Maximum allowed\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"sort","__idx":36},"children":["sort"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Type"]},": String"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Format"]},": ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["fieldName,direction"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Description"]},": How to sort results"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"sort=createdTime,desc     # Newest first\nsort=name,asc             # Alphabetically\nsort=priority,desc        # Highest priority first\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"data-types-and-formats","__idx":37},"children":["Data types and formats"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Understanding the data types used in the API helps you construct valid requests and interpret responses correctly."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"string","__idx":38},"children":["String"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Plain text values:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"accountDisplayName\": \"@YourBrand\",\n  \"subject\": \"Customer inquiry\",\n  \"notes\": \"This is a text field\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"integer","__idx":39},"children":["Integer"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Whole numbers (no decimals):"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"followerCount\": 15420,\n  \"priority\": 3,\n  \"retweetCount\": 234\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"boolean","__idx":40},"children":["Boolean"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["True or false values:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"verified\": true,\n  \"hasMedia\": false,\n  \"isPublic\": true\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"array","__idx":41},"children":["Array"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Lists of values:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"accountIds\": [\"600057112\", \"600057113\"],\n  \"tags\": [\"urgent\", \"vip\", \"escalated\"],\n  \"messageTypes\": [\"TWITTER_POST\", \"TWITTER_REPLY\"]\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"object","__idx":42},"children":["Object"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Nested structures:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"customerProfile\": {\n    \"name\": \"John Customer\",\n    \"email\": \"john@example.com\",\n    \"vipStatus\": true\n  },\n  \"engagementMetrics\": {\n    \"likes\": 234,\n    \"shares\": 45,\n    \"comments\": 12\n  }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"null","__idx":43},"children":["Null"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Explicitly absent values:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"assignedTo\": null,\n  \"resolvedTime\": null,\n  \"parentCaseId\": null\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"limits-and-constraints","__idx":44},"children":["Limits and constraints"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The API has several limits to ensure reliability and fair usage:"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"batch-size-limit-50-resources","__idx":45},"children":["Batch size limit: 50 resources"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can request up to 50 resources at once in batch operations:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# ✅ Valid\nGET /api/v3/account?accountId=1,2,3,...,50\n\n# ❌ Invalid - will return error\nGET /api/v3/account?accountId=1,2,3,...,51\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"page-size-limit-100-items","__idx":46},"children":["Page size limit: 100 items"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Paginated endpoints return at most 100 items per page:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"page\": 0,\n  \"size\": 100  // Maximum\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you specify ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["size: 150"]},", the API will either return an error or silently cap it at 100 (check the specific endpoint documentation)."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"request-timeout-30-seconds","__idx":47},"children":["Request timeout: 30 seconds"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["API requests that take longer than 30 seconds will timeout. If you're hitting timeouts:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Add more specific filters to your search"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Reduce your page size"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Break large batch requests into smaller ones"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"rate-limits","__idx":48},"children":["Rate limits"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["API calls are rate-limited based on your Sprinklr plan. See the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/rate-limiting"},"children":["Rate Limiting guide"]}," for details."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"best-practices-for-production","__idx":49},"children":["Best practices for production"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"1-always-handle-errors","__idx":50},"children":["1. Always handle errors"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Don't assume requests will succeed. Always check the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["success"]}," field and handle errors:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"async function getAccountSafely(accountId) {\n  try {\n    const response = await fetchAccount(accountId);\n\n    if (response.success) {\n      return response.data;\n    } else {\n      // Handle API-level errors\n      console.error('API Error:', response.errors);\n      throw new Error(response.errors[0]?.message || 'Unknown error');\n    }\n  } catch (error) {\n    // Handle network errors, timeouts, etc.\n    console.error('Request failed:', error);\n    throw error;\n  }\n}\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"2-use-batch-operations-aggressively","__idx":51},"children":["2. Use batch operations aggressively"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Whenever you need multiple resources, batch them:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"// ❌ Bad - 10 API calls\nconst accounts = [];\nfor (const id of accountIds) {\n  accounts.push(await getAccount(id));\n}\n\n// ✅ Good - 1 API call\nconst accounts = await getAccounts(accountIds);\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"3-implement-exponential-backoff","__idx":52},"children":["3. Implement exponential backoff"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When requests fail (especially rate limits), don't immediately retry. Use exponential backoff:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"async function fetchWithRetry(fetchFunction, maxRetries = 3) {\n  for (let i = 0; i < maxRetries; i++) {\n    try {\n      return await fetchFunction();\n    } catch (error) {\n      if (i === maxRetries - 1) throw error;\n\n      // Wait 2^i seconds before retrying (1s, 2s, 4s, 8s...)\n      const waitTime = Math.pow(2, i) * 1000;\n      console.log(`Retry ${i + 1}/${maxRetries} after ${waitTime}ms`);\n      await new Promise(resolve => setTimeout(resolve, waitTime));\n    }\n  }\n}\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"4-cache-rarely-changing-data","__idx":53},"children":["4. Cache rarely-changing data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Some data doesn't change often. Cache it to reduce API calls:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"class AccountCache {\n  constructor() {\n    this.cache = new Map();\n    this.ttl = 60 * 60 * 1000; // 1 hour\n  }\n\n  async getAccount(accountId) {\n    const cached = this.cache.get(accountId);\n\n    if (cached && Date.now() - cached.timestamp < this.ttl) {\n      return cached.data;\n    }\n\n    const account = await fetchAccount(accountId);\n    this.cache.set(accountId, {\n      data: account,\n      timestamp: Date.now()\n    });\n\n    return account;\n  }\n}\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"5-log-for-debugging","__idx":54},"children":["5. Log for debugging"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Log your API calls to help with debugging:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"async function fetchWithLogging(url, options) {\n  const startTime = Date.now();\n\n  console.log(`→ ${options.method || 'GET'} ${url}`);\n\n  try {\n    const response = await fetch(url, options);\n    const duration = Date.now() - startTime;\n    const data = await response.json();\n\n    console.log(`← ${response.status} in ${duration}ms`);\n\n    return data;\n  } catch (error) {\n    const duration = Date.now() - startTime;\n    console.error(`✗ Failed after ${duration}ms:`, error.message);\n    throw error;\n  }\n}\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"6-validate-input-before-sending","__idx":55},"children":["6. Validate input before sending"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Check your data before making API calls:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"function validateCaseSearch(filters) {\n  // Check date range\n  if (filters.startTime && filters.endTime) {\n    const start = new Date(filters.startTime);\n    const end = new Date(filters.endTime);\n\n    if (start > end) {\n      throw new Error('startTime must be before endTime');\n    }\n\n    // Warn if range is very large\n    const daysDiff = (end - start) / (1000 * 60 * 60 * 24);\n    if (daysDiff > 90) {\n      console.warn('Date range spans more than 90 days - this might be slow');\n    }\n  }\n\n  // Check page size\n  if (filters.size && (filters.size < 1 || filters.size > 100)) {\n    throw new Error('Page size must be between 1 and 100');\n  }\n\n  return true;\n}\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"next-steps","__idx":56},"children":["Next steps"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Now that you understand API basics, you're ready to:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/error-handling"},"children":["Handle errors properly"]}]}," - Learn about all error codes and how to fix them"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/rate-limiting"},"children":["Understand rate limiting"]}]}," - Optimize your API usage"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/pagination"},"children":["Master pagination"]}]}," - Handle large datasets efficiently"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/accounts"},"children":["Explore specific APIs"]}]}," - Dive into accounts, messages, cases, and more"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The patterns in this guide apply to all Sprinklr API endpoints. Once you master these basics, working with any endpoint becomes straightforward."]}]},"headings":[{"value":"API Basics","id":"api-basics","depth":1},{"value":"How requests and responses work","id":"how-requests-and-responses-work","depth":2},{"value":"Anatomy of a request","id":"anatomy-of-a-request","depth":3},{"value":"Understanding responses","id":"understanding-responses","depth":3},{"value":"HTTP methods: What each one does","id":"http-methods-what-each-one-does","depth":2},{"value":"GET - Retrieving data","id":"get---retrieving-data","depth":3},{"value":"POST - Creating or searching","id":"post---creating-or-searching","depth":3},{"value":"PUT - Full update","id":"put---full-update","depth":3},{"value":"PATCH - Partial update","id":"patch---partial-update","depth":3},{"value":"DELETE - Removing data","id":"delete---removing-data","depth":3},{"value":"Working with single resources","id":"working-with-single-resources","depth":2},{"value":"Batch operations: Your new best friend","id":"batch-operations-your-new-best-friend","depth":2},{"value":"Why batching matters","id":"why-batching-matters","depth":3},{"value":"How to use batch requests","id":"how-to-use-batch-requests","depth":3},{"value":"Handling partial failures","id":"handling-partial-failures","depth":3},{"value":"Batch size limits","id":"batch-size-limits","depth":3},{"value":"Searching and filtering","id":"searching-and-filtering","depth":2},{"value":"Simple filters","id":"simple-filters","depth":3},{"value":"Date range filters","id":"date-range-filters","depth":3},{"value":"Combining multiple filters","id":"combining-multiple-filters","depth":3},{"value":"Understanding AND vs OR logic","id":"understanding-and-vs-or-logic","depth":3},{"value":"Sorting results","id":"sorting-results","depth":2},{"value":"Multiple sort fields","id":"multiple-sort-fields","depth":3},{"value":"Working with timestamps","id":"working-with-timestamps","depth":2},{"value":"Reading timestamps","id":"reading-timestamps","depth":3},{"value":"Sending timestamps","id":"sending-timestamps","depth":3},{"value":"Converting from your local timezone","id":"converting-from-your-local-timezone","depth":3},{"value":"Converting to your local timezone","id":"converting-to-your-local-timezone","depth":3},{"value":"Pagination: Handling large datasets","id":"pagination-handling-large-datasets","depth":2},{"value":"How pagination works","id":"how-pagination-works","depth":3},{"value":"Fetching the next page","id":"fetching-the-next-page","depth":3},{"value":"Iterating through all pages","id":"iterating-through-all-pages","depth":3},{"value":"Choosing page sizes","id":"choosing-page-sizes","depth":3},{"value":"Common parameters","id":"common-parameters","depth":2},{"value":"page","id":"page","depth":3},{"value":"size","id":"size","depth":3},{"value":"sort","id":"sort","depth":3},{"value":"Data types and formats","id":"data-types-and-formats","depth":2},{"value":"String","id":"string","depth":3},{"value":"Integer","id":"integer","depth":3},{"value":"Boolean","id":"boolean","depth":3},{"value":"Array","id":"array","depth":3},{"value":"Object","id":"object","depth":3},{"value":"Null","id":"null","depth":3},{"value":"Limits and constraints","id":"limits-and-constraints","depth":2},{"value":"Batch size limit: 50 resources","id":"batch-size-limit-50-resources","depth":3},{"value":"Page size limit: 100 items","id":"page-size-limit-100-items","depth":3},{"value":"Request timeout: 30 seconds","id":"request-timeout-30-seconds","depth":3},{"value":"Rate limits","id":"rate-limits","depth":3},{"value":"Best practices for production","id":"best-practices-for-production","depth":2},{"value":"1. Always handle errors","id":"1-always-handle-errors","depth":3},{"value":"2. Use batch operations aggressively","id":"2-use-batch-operations-aggressively","depth":3},{"value":"3. Implement exponential backoff","id":"3-implement-exponential-backoff","depth":3},{"value":"4. Cache rarely-changing data","id":"4-cache-rarely-changing-data","depth":3},{"value":"5. Log for debugging","id":"5-log-for-debugging","depth":3},{"value":"6. Validate input before sending","id":"6-validate-input-before-sending","depth":3},{"value":"Next steps","id":"next-steps","depth":2}],"frontmatter":{"seo":{"title":"API Basics"}},"lastModified":"2026-10-27T09:16:56.926Z","pagePropGetterError":{"message":"","name":""}},"slug":"/guides/api-basics","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}