{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"6085cdfb-dc70-4f19-8358-b182a6eb32fe","name":"SwiftMart Documentation","description":"# Overview\n\nSwiftMart is an eCommerce platform that provides a seamless shopping experience for users. The API allows developers to integrate with SwiftMart's functionalities, including managing user accounts, browsing and managing products, creating and updating orders, and accessing user profiles.\n\n## Base URL\n\n```\nhttps://api.swiftmart.com/v1\n\n ```\n\nTo effectively utilize SwiftMart's APIs, all users must have the following -\n\n- A valid API Key to send requests to the API endpoints. You can get your API key from SwiftMart's [integrations dashboard](https://go.swiftmart.co/settings/me/api-keys).\n    \n- An API with [rate and usage limits](https://learning.postman.com/docs/developer/postman-api/postman-api-rate-limits/).\n    \n- An API that only responds to HTTPS-secured communications. Any requests sent via HTTP return an HTTP 301 redirect to the corresponding HTTPS resources.\n    \n- An API that returns request responses in JSON format. When an API request returns an error, it is sent in the JSON response as an error key.\n    \n\n## Authentication\n\nThe SwiftMart API uses the API key for authentication. You can generate a SwiftMart API key in the [API keys](https://postman.postman.co/settings/me/api-keys) section of your Postman account settings. You must include an API key in each request to the SwiftMart API with the X-Api-Key request header.\n\n### Authentication error response\n\nIf an API key is missing, malformed, or invalid, you will receive an HTTP 401 Unauthorized response code.\n\n## Rate and usage limits\n\nTo ensure optimal performance and fair usage, the SwiftMart API enforces rate limits on API requests. These limits help maintain the stability and reliability of the service for all users.\n\n### Rate limit\n\n1. **Standard users:** Requests per minute (60), Requests per hour (1000)\n    \n2. **Premium users:** Requests per minute (120), Requests per hour (2000)\n    \n3. **Admin users:** Requests per minute (200), Requests per hour (5000)\n    \n\nIf you exceed these limits, you will receive a `429 Too Many Requests` response. It is important to implement proper error handling and retry logic in your application to manage rate limits effectively.\n\nEach API response returns the following set of headers to help you identify your use status:\n\n| Header | Description |\n| --- | --- |\n| `X-RateLimit-Limit` | The maximum number of requests that the consumer is permitted to make per minute. |\n| `X-RateLimit-Remaining` | The number of requests remaining in the current rate limit window. |\n| `X-RateLimit-Reset` | The time at which the current rate limit window resets in UTC epoch seconds. |\n\n## Error Handling\n\nEffective error handling is crucial for developing robust applications that interact with the SwiftMart API. This section outlines the error codes, their meanings, and how to handle them properly. Understanding these responses helps in diagnosing issues and ensuring a smooth user experience.\n\n### Error Codes\n\nThe SwiftMart API uses standard HTTP status codes to indicate the success or failure of an API request. Here is a list of common error codes and their meanings:\n\n- **400 Bad Request**: The request could not be understood or was missing required parameters.\n    \n- **401 Unauthorized**: Authentication failed or user does not have permissions for the requested operation.\n    \n- **403 Forbidden**: Authentication succeeded, but the authenticated user does not have access to the requested resource.\n    \n- **404 Not Found**: The requested resource could not be found.\n    \n- **405 Method Not Allowed**: The HTTP method is not supported for the requested resource.\n    \n- **409 Conflict**: The request could not be completed due to a conflict with the current state of the resource.\n    \n- **429 Too Many Requests**: The user has sent too many requests in a given amount of time (\"rate limiting\").\n    \n- **500 Internal Server Error**: An error occurred on the server.\n    \n- **503 Service Unavailable**: The service is temporarily unavailable.\n    \n\n### Error Response Format\n\nThe SwiftMart API returns error responses in a consistent JSON format. Below is an example of an error response:\n\n``` json\n{\n  \"error\": {\n    \"code\": 400,\n    \"message\": \"Invalid request parameters\",\n    \"details\": [\n      {\n        \"field\": \"email\",\n        \"issue\": \"Email format is invalid\"\n      }\n    ]\n  }\n}\n\n ```\n\n- **error.code**: The HTTP status code.\n    \n- **error.message**: A brief description of the error.\n    \n- **error.details**: Additional information about specific fields that caused the error, if applicable.\n    \n\n#### Handling Errors\n\nWhen integrating with the SwiftMart API, ensure your application can gracefully handle errors. Here are some best practices:\n\n1. **Check Status Codes**: Always check the HTTP status code of the response to determine if the request was successful.\n    \n2. **Log Errors**: Log error responses for debugging and monitoring purposes.\n    \n3. **User-Friendly Messages**: Display user-friendly error messages based on the error code and message provided.\n    \n4. **Retry Logic**: Implement retry logic for transient errors, such as 500 Internal Server Error or 503 Service Unavailable.\n    \n5. **Rate Limiting**: Handle 429 Too Many Requests errors by implementing exponential backoff or other retry strategies.\n    \n\n#### Example Error Handling\n\nHere’s an example of handling an error response in JavaScript using Fetch:\n\n``` javascript\nfetch('https://api.swiftmart.com/v1/resource', {\n  method: 'GET',\n  headers: {\n    &#x27;Authorization&#x27;: &#x27;ApiKey <api-key-string>&#x27;,\n    'Content-Type': 'application/json'\n  }\n})\n  .then(response => {\n    if (!response.ok) {\n      return response.json().then(error => {\n        throw new Error(`Error ${error.code}: ${error.message}`);\n      });\n    }\n    return response.json();\n  })\n  .then(data => {\n    console.log('Success:', data);\n  })\n  .catch(error => {\n    console.error('API Error:', error);\n    alert(`There was an error: ${error.message}`);\n  });\n\n ```\n\nThese guidelines help ensure that your application handles errors efficiently and provides a smooth user experience.\n\n### Usage Example\n\nThe Usage Examples section provides practical guides and code snippets to help you integrate the SwiftMart API into your applications quickly and efficiently. These examples cover common use cases and demonstrate how to make API requests and handle responses using different programming languages and tools.\n\n#### Common Use Cases\n\n- **User Authentication**: How to log in and obtain an API key.\n    \n- **Fetching Products**: Retrieve a list of products with filtering and pagination.\n    \n- **Managing Cart**: Add, update, and remove items in a user's shopping cart.\n    \n- **Placing Orders**: Create a new order and process payment.\n    \n- **User Profile Management**: Update user profile details and view profile information.\n    \n\n#### Code Samples\n\n- **cURL**: Making a simple GET request.\n    \n- **JavaScript (Fetch API)**: Handling API requests and responses.\n    \n- **Python (Requests library)**: Integrating API calls into a Python application.\n    \n- **Postman**: Configuring and testing API requests in Postman.\n    \n\nThese examples will help you understand how to use the SwiftMart API effectively, enabling you to build powerful and efficient applications.\n\n## Support\n\nThe Support section provides information on how to get help with the SwiftMart API. Whether you encounter issues, have questions, or need additional resources, the support options below are available to assist you.\n\n#### Contact Information\n\n- **Email Support**: Reach out to our support team via email at [support@swiftmart.com](https://null) for any API-related queries or issues.\n    \n- **Phone Support**: Call us at 1-800-SWIFTMART (1-800-794-3867) for urgent support during business hours (Mon-Fri, 9 AM to 6 PM EST).\n    \n\n#### Documentation\n\n- **API Documentation**: Comprehensive documentation is available at [docs.swiftmart.com](https://null) for detailed information on API endpoints, parameters, and responses.\n    \n\n#### Community Support\n\n- **Forum**: Join our community forum at [community.swiftmart.com](https://null) to ask questions, share knowledge, and connect with other developers.\n    \n- **Stack Overflow**: Tag your questions with `swiftmart-api` on Stack Overflow to get help from the developer community.\n    \n\n#### Additional Resources\n\n- **SDKs and Libraries**: Access SDKs and libraries for various programming languages at [developer.swiftmart.com](https://null).\n    \n- **Changelog**: Stay updated with the latest changes and updates to the API at [changelog.swiftmart.com](https://null).\n    \n\nBy leveraging these support resources, you can efficiently resolve any issues and enhance your experience with the SwiftMart API.","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":false,"owner":"24833108","team":4514891,"collectionId":"6085cdfb-dc70-4f19-8358-b182a6eb32fe","publishedId":"2sA3XY5xU8","public":true,"publicUrl":"https://documenter-api.postman.tech/view/24833108/2sA3XY5xU8","privateUrl":"https://go.postman.co/documentation/24833108-6085cdfb-dc70-4f19-8358-b182a6eb32fe","customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"},"documentationLayout":"classic-double-column","customisation":{"metaTags":[{"name":"description","value":"This is SwiftMart API documentation. Integrate seamlessly with our eCommerce platform using our detailed guides on authentication, product management, and cart operations. Get started quickly with clear examples and robust support."},{"name":"title","value":"SwiftMart API documentation "}],"appearance":{"default":"light","themes":[{"name":"dark","logo":null,"colors":{"top-bar":"212121","right-sidebar":"303030","highlight":"FF6C37"}},{"name":"light","logo":null,"colors":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"}}]}},"version":"8.11.6","publishDate":"2024-06-24T12:13:47.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{"title":"SwiftMart API documentation ","description":"This is SwiftMart API documentation. Integrate seamlessly with our eCommerce platform using our detailed guides on authentication, product management, and cart operations. Get started quickly with clear examples and robust support."},"logos":{"logoLight":null,"logoDark":null}},"statusCode":200},"environments":[],"user":{"authenticated":false,"permissions":{"publish":false}},"run":{"button":{"js":"https://run.pstmn.io/button.js","css":"https://run.pstmn.io/button.css"}},"web":"https://www.getpostman.com/","team":{"logo":"https://res.cloudinary.com/postman/image/upload/t_team_logo_pubdoc/v1/team/d485d9b23616728bd122664a0b9be5aefaddc3a6d14c68ddcf9eea1b710d9839","favicon":""},"isEnvFetchError":false,"languages":"[{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"HttpClient\"},{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"RestSharp\"},{\"key\":\"curl\",\"label\":\"cURL\",\"variant\":\"cURL\"},{\"key\":\"dart\",\"label\":\"Dart\",\"variant\":\"http\"},{\"key\":\"go\",\"label\":\"Go\",\"variant\":\"Native\"},{\"key\":\"http\",\"label\":\"HTTP\",\"variant\":\"HTTP\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"OkHttp\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"Unirest\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"Fetch\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"jQuery\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"XHR\"},{\"key\":\"c\",\"label\":\"C\",\"variant\":\"libcurl\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Axios\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Native\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Request\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Unirest\"},{\"key\":\"objective-c\",\"label\":\"Objective-C\",\"variant\":\"NSURLSession\"},{\"key\":\"ocaml\",\"label\":\"OCaml\",\"variant\":\"Cohttp\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"cURL\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"Guzzle\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"HTTP_Request2\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"pecl_http\"},{\"key\":\"powershell\",\"label\":\"PowerShell\",\"variant\":\"RestMethod\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"http.client\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"Requests\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"httr\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"RCurl\"},{\"key\":\"ruby\",\"label\":\"Ruby\",\"variant\":\"Net::HTTP\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"Httpie\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"wget\"},{\"key\":\"swift\",\"label\":\"Swift\",\"variant\":\"URLSession\"}]","languageSettings":[{"key":"csharp","label":"C#","variant":"HttpClient"},{"key":"csharp","label":"C#","variant":"RestSharp"},{"key":"curl","label":"cURL","variant":"cURL"},{"key":"dart","label":"Dart","variant":"http"},{"key":"go","label":"Go","variant":"Native"},{"key":"http","label":"HTTP","variant":"HTTP"},{"key":"java","label":"Java","variant":"OkHttp"},{"key":"java","label":"Java","variant":"Unirest"},{"key":"javascript","label":"JavaScript","variant":"Fetch"},{"key":"javascript","label":"JavaScript","variant":"jQuery"},{"key":"javascript","label":"JavaScript","variant":"XHR"},{"key":"c","label":"C","variant":"libcurl"},{"key":"nodejs","label":"NodeJs","variant":"Axios"},{"key":"nodejs","label":"NodeJs","variant":"Native"},{"key":"nodejs","label":"NodeJs","variant":"Request"},{"key":"nodejs","label":"NodeJs","variant":"Unirest"},{"key":"objective-c","label":"Objective-C","variant":"NSURLSession"},{"key":"ocaml","label":"OCaml","variant":"Cohttp"},{"key":"php","label":"PHP","variant":"cURL"},{"key":"php","label":"PHP","variant":"Guzzle"},{"key":"php","label":"PHP","variant":"HTTP_Request2"},{"key":"php","label":"PHP","variant":"pecl_http"},{"key":"powershell","label":"PowerShell","variant":"RestMethod"},{"key":"python","label":"Python","variant":"http.client"},{"key":"python","label":"Python","variant":"Requests"},{"key":"r","label":"R","variant":"httr"},{"key":"r","label":"R","variant":"RCurl"},{"key":"ruby","label":"Ruby","variant":"Net::HTTP"},{"key":"shell","label":"Shell","variant":"Httpie"},{"key":"shell","label":"Shell","variant":"wget"},{"key":"swift","label":"Swift","variant":"URLSession"}],"languageOptions":[{"label":"C# - HttpClient","value":"csharp - HttpClient - C#"},{"label":"C# - RestSharp","value":"csharp - RestSharp - C#"},{"label":"cURL - cURL","value":"curl - cURL - cURL"},{"label":"Dart - http","value":"dart - http - Dart"},{"label":"Go - Native","value":"go - Native - Go"},{"label":"HTTP - HTTP","value":"http - HTTP - HTTP"},{"label":"Java - OkHttp","value":"java - OkHttp - Java"},{"label":"Java - Unirest","value":"java - Unirest - Java"},{"label":"JavaScript - Fetch","value":"javascript - Fetch - JavaScript"},{"label":"JavaScript - jQuery","value":"javascript - jQuery - JavaScript"},{"label":"JavaScript - XHR","value":"javascript - XHR - JavaScript"},{"label":"C - libcurl","value":"c - libcurl - C"},{"label":"NodeJs - Axios","value":"nodejs - Axios - NodeJs"},{"label":"NodeJs - Native","value":"nodejs - Native - NodeJs"},{"label":"NodeJs - Request","value":"nodejs - Request - NodeJs"},{"label":"NodeJs - Unirest","value":"nodejs - Unirest - NodeJs"},{"label":"Objective-C - NSURLSession","value":"objective-c - NSURLSession - Objective-C"},{"label":"OCaml - Cohttp","value":"ocaml - Cohttp - OCaml"},{"label":"PHP - cURL","value":"php - cURL - PHP"},{"label":"PHP - Guzzle","value":"php - Guzzle - PHP"},{"label":"PHP - HTTP_Request2","value":"php - HTTP_Request2 - PHP"},{"label":"PHP - pecl_http","value":"php - pecl_http - PHP"},{"label":"PowerShell - RestMethod","value":"powershell - RestMethod - PowerShell"},{"label":"Python - http.client","value":"python - http.client - Python"},{"label":"Python - Requests","value":"python - Requests - Python"},{"label":"R - httr","value":"r - httr - R"},{"label":"R - RCurl","value":"r - RCurl - R"},{"label":"Ruby - Net::HTTP","value":"ruby - Net::HTTP - Ruby"},{"label":"Shell - Httpie","value":"shell - Httpie - Shell"},{"label":"Shell - wget","value":"shell - wget - Shell"},{"label":"Swift - URLSession","value":"swift - URLSession - Swift"}],"layoutOptions":[{"value":"classic-single-column","label":"Single Column"},{"value":"classic-double-column","label":"Double Column"}],"versionOptions":[],"environmentOptions":[{"value":"0","label":"No Environment"}],"canonicalUrl":"https://documenter.gw.postman.com/view/metadata/2sA3XY5xU8"}