{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"2ac7795f-aaf0-4dda-84c3-c1b5e41ef1cb","name":"Styldod Order API - 2.0","description":"The Styldod Order APIs are designed to provide seamless integration and functionality for developers. Our APIs follow a RESTful architecture, offering predictable and resource-oriented URLs for easy navigation and interaction. Request bodies are encoded using the standard form-encoded format, and responses are returned in JSON, making data manipulation and interpretation straightforward. This API also allows you to place orders programmatically, and these orders will be visible on the Styldod user dashboard as well.\n\nAuthentication and security are paramount, and our API employs standard HTTP response codes, authentication mechanisms, and HTTP verbs to ensure secure and reliable communication. We currently support an API key-based authentication method for API requests.\n\nFor any help regarding the API, please contact us at [help@styldod.com](https://mailto:help@styldod.com).\n\n# Service endpoint\n\n---\n\nThe service endpoint for all Styldod Order APIs and all URLs mentioned in this document are relative to these service endpoint:\n\n**Production URL**:\n\n> `BASE_URL: https://orderapi.styldod.com` \n  \n\nFor testing purpose, please use the UAT (User Acceptance Testing) URL\n\n> `BASE_URL: https://uat-orderapi.styldod.com` \n  \n\n# Authentication\n\n---\n\nThe Styldod Order APIs utilize API keys for authentication purposes. These API keys act as a secure means of verifying and authorizing requests made to the API.\n\nIt is very important to handle your API keys with care and keep them secure at all times.\n\nAPI keys grant access to API calls that may retrieve or change your data and/or may lead to incurring significant charges. It is therefore important that these keys keep them secured at all times to prevent them from being used by unauthorized users. Avoid sharing your Styldod Order API keys in publicly accessible areas such as version control repositories like GitHub or client-side code that can be accessed by others.\n\nTo authenticate your API requests, include the API key in the header as follows:\n\n`api-key : {{API-KEY}}`\n\n# Rate Limit\n\n---\n\nAll Styldod Order APIs have a rate limit of 20 requests per second. Exceeding this rate limit will result in 429 (Too Many Requests) HTTP errors.\n\n# Status Codes and Errors\n\n---\n\nStyldod Order APIs uses common HTTP response status codes to indicate the success or failure of these API requests.\n\nFollowing is the list of HTTP status codes:\n\n### Table\n\n| Status Code | Summary | Meaning |\n| --- | --- | --- |\n| 200 | Success | Your request was successful. |\n| 400 | Bad request | Your request was not successful due to missing or invalid parameters. |\n| 401 | Invalid Authentication Token | Your API Key is invalid, expired, or not provided. |\n| 403 | Forbidden | Your request parameters were valid, but your account does not have adequate permission for the requests. |\n| 404 | Not Found | The requested resource does not exist. |\n| 405 | Method Not Allowed | The requested HTTP is not allowed for the given resource. |\n| 422 | Unprocessable Entity | Your request could not be processed properly due to invalid data. Some of the required parameters might be missing. |\n| 429 | Too Many Requests | Too many requests within a given amount of time, exceeding the allowed Rate Limit. Refer to the **Rate Limit** section of this document to know about the limits. |\n| 500 | Internal Server Error | The request was not successful due to server errors. |\n| 504 | Gateway Timeout | The gateway or server did not get a response in time from the underlying resources needed to complete the request. |\n\n# Uploading Images with pre-signed URLs\n\n---\n\nIf you don't have your own storage you can upload binary image files to our S3 bucket on AWS. Before placing an order, you must upload the images you want to edit. This is done using the **Get Upload URLs API**:\n\n1. **Get Pre-Signed URLs:**\n    \n    - Start by calling the **Get Upload URLs API** to obtain pre-signed URLs for your images.\n        \n    - The API will return a set of secure, time-limited pre-signed URLs, which are valid for 4 hours.\n        \n2. **Upload Images:**\n    \n    - Use these pre-signed URLs to upload your images directly to the storage. Each URL corresponds to a specific image.\n        \n    - Ensure all images are successfully uploaded before proceeding to create the order.\n        \n3. **Use the Uploaded Image URLs:**\n    \n    - In the Create Order API request, use the URLs provided after the image upload in the `image_urls` field under `image_list`.\n        \n\n# Webhook\n\n---\n\nDuring the order placement process or while creating an API key in the global configuration, you can specify a webhook URL, where you want to receive updates once your order is processed.\n\n#### How It Works\n\nAfter processing your order, our system will send a POST request to the webhook URL you provided. This request will contain the order details, including order status, output image URLs, event, orderID and any relevant metadata.\n\n#### Webhook Events\n\nBelow are webhook events for orders\n\n`order.completed`  \n`order.pre_processing`  \n`order.post_processing`  \n`order.expert_assigned`  \n`order.error`\n\n#### Webhook Requirements\n\n- **URL**: The webhook URL must be provided during order placement.\n    \n- **HTTP Method**: POST\n    \n- **Response**: The webhook must return a success response with an HTTP status code of 200 upon receiving the request. This confirms that the webhook has successfully processed the order details.\n    \n\n#### Example Webhook Payload\n\n``` json\n{\n  \"event\": \"order.completed\",\n  \"orderID\":\"1675563636373\",\n  \"data\": {\n    \"image_list\": [\n      {\n        \"client_image_id\": \"IMG#111\",\n        \"image_status\": \"completed\",\n        \"output_url\": \"https://www.example.com/image1.jpg\",\n        \"sequence\": 1\n      },\n      {\n        \"client_image_id\": \"IMG#222\",\n        \"image_status\": \"completed\",\n        \"output_url\": \"https://www.example.com/image2.jpg\",\n        \"sequence\": 2\n      },\n      {\n        \"client_image_id\": \"IMG#333\",\n        \"image_status\": \"error\"\n      },\n      {\n        \"client_image_id\": \"IMG#444\",\n        \"image_status\": \"completed\",\n        \"output_url\": \"https://www.example.com/image3.jpg\",\n        \"sequence\": 3\n      }\n    ],\n    \"order_status\": \"completed\",\n    \"createdAt\": \"2024-08-21T09:13:48.156Z\",\n    \"updatedAt\": \"2024-08-21T09:17:50.248Z\"\n  }\n}\n\n ```\n\n#### Retry Logic\n\nIf the webhook fails to return a 200 status code, our system will retry the request up to 3 times at increasing intervals. If the webhook still does not respond successfully after these attempts, the order update may be considered failed.\n\nEnsure that your webhook endpoint is correctly configured to handle the incoming POST request and respond with a 200 status code to avoid failed notifications.\n\n# Global Configuration and Options Precedence\n\n---\n\nGlobal config defines default settings for orders placed using the API. These settings are configured at the time of creating the API key and serve as the baseline configuration for all orders. The settings in this object are applied with the lowest precedence, meaning they can be overridden by settings specified at the order or individual image level.\n\nThese settings include default image properties, webhook configurations, and contact information.\n\nUsers can specify various options to orders at multiple levels, which are applied with different precedence. The options can be set in the following ways:\n\n1. **Global Configuration:** These are default settings configured when creating the API key. If a options are set at this level, it will automatically apply to all requests unless overridden by the user.\n    \n2. **Apply to All (Order Level):** Users can specify options that should apply to all images within a specific order with `apply_to_all` option. This is a convenient way to set common options for multiple images. However, these settings can be overridden at the image level.\n    \n3. **Image Level:** Options can be specified individually for each image within the `image_list`. This level has the highest precedence. If a option is set here, it will override both the global configuration and the `apply_to_all` settings.\n    \n\n### Precedence Order:\n\n1. **Image Level:** The highest priority. If a option is specified at this level, it takes precedence over any other settings.\n    \n2. **Apply to All:** The second level of precedence. Options set here apply to all images unless overridden at the image level.\n    \n3. **Global Configuration:** The default settings that apply if no overrides are provided at the `apply_to_all` or image levels.\n    \n\n### Example:\n\nConsider the following scenario:\n\n- The `basic_editing` option is set to `true` in the global configuration (API key level).\n    \n- In the `apply_to_all` section of the request body, `basic_editing` is set to `false`.\n    \n- For a specific image in the `image_list`, `basic_editing` is set to `true`.\n    \n\nIn this case:\n\n- For the specific image, `basic_editing` will be `true` (image level takes precedence).\n    \n- For any other image where `basic_editing` is not explicitly set, it will be `false` (from `apply_to_all`).\n    \n- If neither image level nor `apply_to_all` specifies `basic_editing`, it would default to `true` as per the global configuration.","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":false,"owner":"26391041","collectionId":"2ac7795f-aaf0-4dda-84c3-c1b5e41ef1cb","publishedId":"2sA3s7jpG5","public":true,"publicUrl":"https://docs.styldod.com","privateUrl":"https://go.postman.co/documentation/26391041-2ac7795f-aaf0-4dda-84c3-c1b5e41ef1cb","customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"67a110"},"documentationLayout":"classic-double-column","customisation":{"metaTags":[{"name":"description","value":""},{"name":"title","value":""}],"appearance":{"default":"light","themes":[{"name":"dark","logo":"https://content.pstmn.io/5e90c89e-df33-46fe-8b34-083599cf5c59/U2NyZWVuc2hvdCAyMDI0LTA4LTI4IGF0IDAwLjExLjE4LnBuZw==","colors":{"top-bar":"212121","right-sidebar":"303030","highlight":"67a110"}},{"name":"light","logo":"https://content.pstmn.io/02060181-514b-4c7f-b8eb-189af1c1edae/U2NyZWVuc2hvdCAyMDI0LTA4LTI4IGF0IDAwLjA2LjI2LnBuZw==","colors":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"67a110"}}]}},"version":"8.10.1","publishDate":"2024-09-11T12:13:29.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{"title":"","description":""},"logos":{"logoLight":"https://content.pstmn.io/02060181-514b-4c7f-b8eb-189af1c1edae/U2NyZWVuc2hvdCAyMDI0LTA4LTI4IGF0IDAwLjA2LjI2LnBuZw==","logoDark":"https://content.pstmn.io/5e90c89e-df33-46fe-8b34-083599cf5c59/U2NyZWVuc2hvdCAyMDI0LTA4LTI4IGF0IDAwLjExLjE4LnBuZw=="}},"statusCode":200},"environments":[{"name":"Styldod Order API - 2.0-Prod","id":"e9fd1075-e17d-429b-a798-a427b2018494","owner":"26391041","values":[{"key":"BASE_URL","value":"https://orderapi.styldod.com","enabled":true,"type":"default"},{"key":"API_KEY","value":"{{API_KEY}}","enabled":true,"type":"default"}],"published":true}],"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/768118b36f06c94b0306958b980558e6915839447e859fe16906e29d683976f0","favicon":"https://styldod.com/favicon.ico"},"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"},{"label":"Styldod Order API - 2.0-Prod","value":"26391041-e9fd1075-e17d-429b-a798-a427b2018494"}],"canonicalUrl":"https://docs.styldod.com/view/metadata/2sA3s7jpG5"}