{"swagger":"2.0","info":{"title":"Wassenger API","version":"1.0.0","description":"**API documentation for WAPlatform**\n\n\n\n> 🔥 🆕 [**Introducing Flows**: No-Code Automation Solution to create AI agents and automate anything on WhatsApp! Learn more](/flows)\n\n\n\n## Introduction\n\n\n\nThis API documentation provides detailed information about the API endpoints and request/response API contracts.\n\n\n\nYou can easily browse all the API resources, request/response the with code examples in 15+ programming languages, including JavaScript/Node.js, Python, PHP, Ruby, Java, C#, Go, Swift, Kotlin, ObjectiveC, C/C++, cURL, Powershell and more.\n\n\n\nThis is a web based API, therefore is only required to send HTTPS requests in order to communicate with the API, making it very easy to use and integrate with any third-party software, programming language, CMS, CRM or CLI tools.\n\n\n\nThe API does not require any SDK and has no strict software dependencies, it can be easily used with no friction by simply sending HTTPS requests to the desired API endpoint.\n\n\n\n_chatgpt-assistant-banner_\n\n\n\n## Security\n\n\n\nThis API is intended for use exclusively in server-side applications.\n\nAttempting to use them in a client-side application will result in Cross-Origin Resource Sharing (CORS) errors. This restriction is intentional and ensures the security and integrity of the service.\n\n\n\n_$tutorials_\n\n_$chatbots_\n\n_$mcp_\n\n_$integrations_\n\n_$apiexamples_\n\n\n\nFind below each relevant API endpoint documentation with more ready-to-use code examples.\n\n\n\n## How to use the API\n\n\n\nSearch or browse the API endpoint by name or action to perform in the left bar.\n\n\n\nThen click on the API endpoint and browse the details of the request/response, including query or body required/optional parameters and possible valid responses.\n\n\n\nIn the right bar you will find the response body schema information, if appliable, and ready-to-use copy examples in multiple programming languages, pick the one that suits you best.\n\n\n\n## Helpful resources\n\n\n\nIn case you are looking for help, tutorials or common troubleshooting using the platform or the API, check out these resources:\n\n\n\n- [Help Center](/help)\n\n- [Tutorials](/help/category/tutorials)\n\n- [API live tester with 100+ examples](/help/api-tester)\n\n- [FAQs](/help/category/faq)\n\n- [Troubleshooting](/help/category/troubleshooting)","x-traitTag":true,"x-logo":{"url":"https://api.wassenger.com/v1/static/accounts/waplatform/fenix/logo.png","backgroundColor":"#FFFFFF","altText":"Wassenger"}},"externalDocs":{"description":"Website","url":"https://website.domain.com"},"basePath":"/v1","consumes":["application/json"],"produces":["application/json"],"host":"api.wassenger.com","definitions":{"error":{"type":"object","properties":{"status":{"type":"number","default":400,"description":"HTTP status code of the error. Same as HTTP protocol response status","enum":[400,401,402,403,404,405,409,410,413,415,429,451,500,501,502,503,504,505]},"message":{"type":"string","description":"Error message"},"errorCode":{"type":"string","enum":["error:generic","error:*"],"description":"Application specific error code. Not always present."},"errors":{"type":"array","description":"Additional data validation errors, if present","items":{"type":"object","properties":{"code":{"type":"string","description":"Optional error code identifier"},"reason":{"type":"string","description":"Reason of the validation error"},"message":{"type":"string","description":"Error detailed description"}}}},"meta":{"type":"object","description":"Optional error metadata key-value pairs."}}},"file":{"title":"File","type":"object","properties":{"id":{"type":"string","description":"File resource ID"},"user":{"type":"object","description":"User owner ID of the file"},"permission":{"type":"number","enum":["public","readonly","private"],"default":"public","description":"Optional file access permission. Defaults to `public`: all team members can access, download and send the file. If set to `private` only the file owner can access, download and send the file."},"status":{"type":"number","enum":["invalid","banned","removed","disabled","expired","active","protected"],"default":"active","description":"File status"},"origin":{"type":"string","enum":["remote","upload","catalog"],"default":"upload","description":"File origin type"},"format":{"type":"string","enum":["gif","ptt","native"],"default":"native","description":"Media native presentation format allowed by WhatsApp. Defaults to native media format (audio, video or document). If you want to send videos as gifs, use format = \"gif\".  If you want to send audio messages like they were sent as voice records as PTT or Push To Talk, then use format = \"ptt\"."},"url":{"type":"string","description":"File origin remote URL, if provided"},"contact":{"type":"string","description":"Optional contact WhatsApp WID to which the file is linked to"},"deletedAt":{"type":"string","format":"date-time","description":"File delettion date"},"expiresAt":{"type":"string","format":"date-time","description":"File expiration date. The file will be no longer available once expired. You can also define a longer expiration date or re-upload the file."},"lastAccessAt":{"type":"string","format":"date-time","description":"File last download access date"},"lastDeliveryAt":{"type":"string","format":"date-time","description":"File last delivery date"},"sha2":{"type":"string","description":"File SHA256 hash value"},"reference":{"type":"string","description":"User defined file reference value for custom traceability"},"filename":{"type":"string","description":"File name defined by the user or inferred"},"size":{"type":"number","description":"File size in bytes"},"mime":{"type":"string","description":"File MIME type inferred at upload time"},"kind":{"type":"string","enum":["image","video","audio","document","file"],"description":"File kind"},"message":{"type":"string","description":"File optional message to be used as message caption when delivery"},"ext":{"type":"string","description":"File extension"},"meta":{"title":"meta","type":"object","properties":{"width":{"type":"number","description":"Media width size, when available in images and video files"},"height":{"type":"number","description":"Media height size, when available in images and video files"},"duration":{"type":"number","description":"Media duration in seconds, when available in video and audio files"},"codec":{"type":"string","description":"Media format codec name, when available in video and audio files"}}},"preview":{"title":"preview","type":"object","properties":{"width":{"type":"number","description":"Media width size, when available in images and video files"},"height":{"type":"number","description":"Media height size, when available in images and video files"},"mime":{"type":"string","default":"image/jpeg","description":"Media preview image MIME type"},"size":{"type":"number","description":"Media preview image file size in bytes"},"image":{"type":"string","description":"Media preview image content in Base64 encoding, when available in images and video files"}}},"stats":{"title":"stats","type":"object","properties":{"downloads":{"type":"number","description":"Total number of file downloads via message delivery or API download requests"},"deliveries":{"type":"number","description":"Total number of file delivery attempts by sending it as attached media"}}}},"required":["ext","mime","sha2","account","user"]},"user":{"title":"User","type":"object","properties":{"id":{"type":"string","description":"User resource ID"},"lastLoginAt":{"type":"string","format":"date-time"},"settings":{"title":"settings","type":"object","properties":{"language":{"type":"string"},"timezone":{"type":"string"},"color":{"type":"string","default":"blue"},"retentionPolicy":{"type":"string","enum":["plan_defaults","never","5m","15m","30m","1h","12h","24h","2d","3d","4d","5d","6d","7d","10d"],"default":"plan_defaults"},"billingEmail":{"type":"string"},"notifications":{"title":"notifications","type":"object","properties":{"timeline":{"title":"timeline","type":"object","properties":{"mentions":{"type":"boolean","default":true},"chats":{"type":"boolean","default":true},"numbers":{"type":"boolean"}}},"digest":{"title":"digest","type":"object","properties":{"enabled":{"type":"boolean"},"maxPerDay":{"type":"number","default":6}}},"funnelTasks":{"title":"funnelTasks","type":"object","properties":{"enabled":{"type":"boolean"},"maxPerDay":{"type":"number","default":1}}},"dnd":{"type":"boolean"}}},"ai":{"title":"ai","type":"object","properties":{"identity":{"type":"string"},"prompt":{"type":"string"},"length":{"type":"number"},"clarify":{"type":"number"},"tone":{"type":"number"},"adaptability":{"type":"number"}}}}},"availability":{"title":"availability","type":"object","properties":{"mode":{"type":"string","default":"auto","description":"Chat availability mode"},"message":{"type":"string","description":"Optional availability status message"},"updatedAt":{"type":"string","format":"date-time","description":"Last availability update"},"shift":{"title":"shift","type":"object","properties":{"active":{"type":"boolean","description":"Enable or disable custom working hours per weekday"},"monday":{"title":"monday","type":"object","properties":{"mode":{"type":"string","enum":["hours","24h","off"]}}},"tuesday":{"title":"tuesday","type":"object","properties":{"mode":{"type":"string","enum":["hours","24h","off"]}}},"wednesday":{"title":"wednesday","type":"object","properties":{"mode":{"type":"string","enum":["hours","24h","off"]}}},"thursday":{"title":"thursday","type":"object","properties":{"mode":{"type":"string","enum":["hours","24h","off"]}}},"friday":{"title":"friday","type":"object","properties":{"mode":{"type":"string","enum":["hours","24h","off"]}}},"saturday":{"title":"saturday","type":"object","properties":{"mode":{"type":"string","enum":["hours","24h","off"]}}},"sunday":{"title":"sunday","type":"object","properties":{"mode":{"type":"string","enum":["hours","24h","off"]}}}}}}},"security":{"title":"security","type":"object","properties":{"mfa":{"title":"mfa","type":"object","properties":{"enabled":{"type":"boolean"},"method":{"type":"string","enum":["totp","email"]},"enrolledAt":{"type":"string","format":"date-time"},"reenrollRequired":{"type":"boolean"}}},"pin":{"title":"pin","type":"object","properties":{"enabled":{"type":"boolean"},"length":{"type":"number","default":6},"idleMs":{"type":"number"},"updatedAt":{"type":"string","format":"date-time"}}},"sessionPolicy":{"title":"sessionPolicy","type":"object","properties":{"absoluteTtlDays":{"type":"number","default":60},"idleTimeout":{"type":"number"}}},"teamPolicy":{"title":"teamPolicy","type":"object","properties":{"requireMfa":{"type":"boolean"},"allowTrustedDevices":{"type":"boolean","default":true}}}}}},"required":["account","email"]},"device":{"title":"Device","type":"object","properties":{"id":{"type":"string","description":"Device resource ID"},"phone":{"type":"string"},"wid":{"type":"string"},"alias":{"type":"string"},"description":{"type":"string"},"connector":{"type":"string","enum":["web","cloud"],"default":"web"},"version":{"type":"number","default":2},"user":{"type":"object"},"agents":{"type":"array","items":[{"title":"Device","type":"object","properties":{"user":{"type":"object","description":"Agent user"},"createdAt":{"type":"string","format":"date-time","default":1793958160286,"description":"Agent addition date to the device"}}}]},"waba":{"title":"waba","type":"object","properties":{"id":{"type":"string"},"displayPhoneNumber":{"type":"string"},"qualityRating":{"type":"string"},"messagingLimit":{"type":"string"},"callingStatus":{"type":"string"}}},"status":{"type":"number","enum":["invalid","banned","removed","disabled","unpaid","preload","pending","authorized","verified","operative"],"default":50},"cancelAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time"},"disabledAt":{"type":"string","format":"date-time"},"quickReplies":{"type":"object","properties":{"entries":{"type":"array","items":[{"title":"Device","type":"object","properties":{"scope":{"type":"string","enum":["chat","wa"],"default":"wa"},"active":{"type":"boolean","default":true},"message":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"shortcut":{"type":"string"}}}]}}},"labels":{"type":"object","properties":{"entries":{"type":"array","items":[{"title":"Device","type":"object","properties":{"active":{"type":"boolean","default":true},"scope":{"type":"string","enum":["chat","wa"],"default":"wa"},"name":{"type":"string"},"color":{"type":"string"},"description":{"type":"string"},"listType":{"type":"number"},"isBuiltIn":{"type":"boolean"},"colorIndex":{"type":"number"},"orderIndex":{"type":"number"}}}]}}},"groupChats":{"title":"groupChats","type":"object","properties":{"lastSyncAt":{"type":"string","format":"date-time","description":"Last group chats synchronization date."},"count":{"type":"number"}}},"settings":{"title":"settings","type":"object","properties":{"retentionPolicy":{"type":"string","default":"plan_defaults","description":"Data retention policy applied to device's storage in the system, including inbound/outbound messages and chats. A custom data retention policy can be used to automatically delete messages once they are processed or after a specific amount ot time (e.g: 1 hour or 1 day). Once the maximum retention is exceeded, message data will not be accessible from the Web Console or API anymore. If you take want to keep track of data, we recommend you to query the messages via API and store them in your own system."},"rebootPolicy":{"type":"string","enum":["disabled","10m","15m","20m","25m","30m","45m","1h","2h","3h","4h","5h","6h","8h","10h","12h","18h"],"default":"disabled","description":"Optionally enable automatic session reboot policy for the current device in a specific interval. This might help you to avoid performance or memory issues in long running sessions, which is especially helpful in Platform devices where the session is tipically running for long hours or days. The system will automatically reboot your device session without having to re-authorize it every time or requiring any manual intervention. Reboot will cause up to 2 minutes downtime and message processing delay, but no messages will be lost during the process."},"assignChatOnReply":{"type":"boolean","default":true,"description":"Assign a chat to the agent who replies to it, when the chat has no assignee yet. This is separate from the automatic assignment policy: it needs no configuration, applies to every chat an agent answers from the Web Console, and is enabled by default. Disable it to leave chat ownership entirely under manual or automatic assignment control."},"deliverySpeed":{"type":"number","description":"Maximum messages delivery speed per minute for the current device. Maximum plan delivery speed limit applies here. Use \"0\" for default plan delivery speed or define a custom allowed value for custom delivery speed control."},"autoRemove":{"title":"autoRemove","type":"object","properties":{"enabled":{"type":"boolean"},"max":{"type":"number","default":600}}},"operativeHours":{"title":"operativeHours","type":"object","properties":{"enable":{"type":"boolean"},"timezone":{"type":"string"},"exceptUntil":{"type":"string","format":"date-time","description":"Operating hours exception date"},"exceptActiveAt":{"type":"string","format":"date-time","description":"Last operating hours exception date"},"exceptUser":{"type":"object","description":"Last user that set the operating hours exception"}}},"calling":{"title":"calling","type":"object","properties":{"status":{"type":"string","enum":["ENABLED","DISABLED","NOT_SET"]},"callIconVisibility":{"type":"string","enum":["DEFAULT","DISABLE_ALL","NOT_SET"]},"callbackPermissionStatus":{"type":"string"},"callHours":{"title":"callHours","type":"object","properties":{"status":{"type":"string"},"timezoneId":{"type":"string"},"weeklyOperatingHours":{"type":"array","default":[]},"holidaySchedule":{"type":"array","default":[]}}},"sip":{"title":"sip","type":"object","properties":{"status":{"type":"string"},"servers":{"type":"array","default":[]},"srtpKeyExchangeProtocol":{"type":"string"}}},"incomingPaused":{"type":"boolean"},"silentSounds":{"type":"boolean"},"ringMode":{"type":"string","enum":["agent","team"],"default":"agent"},"pendingPropagation":{"type":"boolean"},"lastSyncedAt":{"type":"string","format":"date-time"}}}}},"calling":{"title":"calling","type":"object","properties":{"status":{"type":"string","enum":["ENABLED","DISABLED"]},"callIconVisibility":{"type":"string","enum":["DEFAULT","DISABLE_ALL"]},"callbackPermissionStatus":{"type":"string"},"callHours":{"title":"callHours","type":"object","properties":{"status":{"type":"string"},"timezoneId":{"type":"string"},"weeklyOperatingHours":{"type":"array","default":[]},"holidaySchedule":{"type":"array","default":[]}}},"sip":{"title":"sip","type":"object","properties":{"status":{"type":"string"},"servers":{"type":"array","default":[]},"srtpKeyExchangeProtocol":{"type":"string"}}},"incomingPaused":{"type":"boolean"},"silentSounds":{"type":"boolean"},"ringMode":{"type":"string","enum":["agent","team"],"default":"agent"},"pendingPropagation":{"type":"boolean"},"lastSyncedAt":{"type":"string","format":"date-time"}}},"autoAssign":{"title":"autoAssign","type":"object","properties":{"active":{"type":"boolean"},"updatedAt":{"type":"string","format":"date-time"},"updatedBy":{"type":"object"},"online":{"type":"boolean"},"away":{"type":"boolean"},"unavailable":{"type":"boolean"},"offline":{"type":"boolean"},"reassign":{"type":"boolean"},"reassignOptions":{"title":"reassignOptions","type":"object","properties":{"resolved":{"type":"boolean"},"active":{"type":"boolean"},"unassign":{"type":"boolean"}}}}},"autoResolve":{"title":"autoResolve","type":"object","properties":{"active":{"type":"boolean"},"timeframe":{"type":"string","enum":["6h","12h","24h","48h","3d","7d","14d","30d"],"default":"24h"},"includeUnanswered":{"type":"boolean"},"onlyUnassigned":{"type":"boolean"},"unassign":{"type":"boolean"},"note":{"title":"note","type":"object","properties":{"active":{"type":"boolean"},"text":{"type":"string"}}},"activatedAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"updatedBy":{"type":"object"}}},"aiAutomations":{"title":"aiAutomations","type":"object","properties":{"modes":{"type":"object"},"resting":{"type":"object"},"active":{"type":"boolean"},"updatedAt":{"type":"string","format":"date-time"},"updatedBy":{"type":"object"}}},"autoReplies":{"title":"autoReplies","type":"object","properties":{"welcome":{"title":"welcome","type":"object","properties":{"active":{"type":"boolean"},"message":{"type":"string"},"file":{"type":"object"},"target":{"type":"string","enum":["all","new_contacts"],"default":"all"},"timeframe":{"type":"string","default":"14d"},"skipResolved":{"type":"boolean"},"skipAssigned":{"type":"boolean"},"form":{"title":"form","type":"object","properties":{"flowId":{"type":"string"},"cta":{"type":"string"},"screen":{"type":"string"}}}}},"away":{"title":"away","type":"object","properties":{"active":{"type":"boolean"},"message":{"type":"string"},"file":{"type":"object"},"target":{"type":"string","enum":["all","new_contacts"],"default":"all"},"skipResolved":{"type":"boolean"},"skipAssigned":{"type":"boolean"},"skipPending":{"type":"boolean"},"timezone":{"type":"string"},"useBusinessProfile":{"type":"boolean"},"businessHours":{"title":"businessHours","type":"object","properties":{"monday":{"title":"monday","type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"]}}},"tuesday":{"title":"tuesday","type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"]}}},"wednesday":{"title":"wednesday","type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"]}}},"thursday":{"title":"thursday","type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"]}}},"friday":{"title":"friday","type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"]}}},"saturday":{"title":"saturday","type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"]}}},"sunday":{"title":"sunday","type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"]}}}}},"form":{"title":"form","type":"object","properties":{"flowId":{"type":"string"},"cta":{"type":"string"},"screen":{"type":"string"}}}}},"busy":{"title":"busy","type":"object","properties":{"active":{"type":"boolean"},"message":{"type":"string"},"file":{"type":"object"},"target":{"type":"string","enum":["all","new_contacts"],"default":"all"},"timeframe":{"type":"string","default":"5m"},"skipPending":{"type":"boolean"},"skipResolved":{"type":"boolean"},"skipAssigned":{"type":"boolean"},"form":{"title":"form","type":"object","properties":{"flowId":{"type":"string"},"cta":{"type":"string"},"screen":{"type":"string"}}}}},"call":{"title":"call","type":"object","properties":{"active":{"type":"boolean"},"message":{"type":"string"},"file":{"type":"object"},"reject":{"type":"boolean"}}}}},"billing":{"type":"object","properties":{"subscription":{"type":"object","properties":{"plan":{"type":"string","enum":["free","chat-agent","basic","business","enterprise","professional","gateway-basic","gateway-business","gateway-enterprise","gateway-professional","io-basic","io-professional","io-business","io-enterprise"]},"planCode":{"type":"string","enum":["free","chat-agent","basic","business","enterprise","professional","gateway-basic","gateway-business","gateway-enterprise","gateway-professional","io-basic","io-professional","io-business","io-enterprise"],"default":"free"},"product":{"type":"string","enum":["io","agent","gateway","support"],"default":"gateway"},"previousPlan":{"type":"string"},"interval":{"type":"string","enum":["month","year"],"default":"month"},"status":{"type":"string","enum":["active","disabled","canceled","cancelled","unpaid","past_due","paid","trialing"],"default":"active"},"createdAt":{"type":"string","format":"date-time"},"isTrial":{"type":"boolean"},"trialEndsAt":{"type":"string","format":"date-time"},"convertedAt":{"type":"string","format":"date-time"},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"},"renewsAt":{"type":"string","format":"date-time"},"startedAt":{"type":"string","format":"date-time"},"cancelledAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"changedAt":{"type":"string","format":"date-time"},"usage":{"type":"object","properties":{"textMessages":{"type":"number"},"mediaMessages":{"type":"number"},"failedMessages":{"type":"number"},"filesSize":{"type":"number"},"numberChecks":{"type":"number"},"catalogQueries":{"type":"number"},"campaigns":{"type":"number"}}}}}}},"queue":{"title":"queue","type":"object","properties":{"status":{"type":"string","default":"active","description":"Messages queue processing status"},"statusUpdatedAt":{"type":"string","format":"date-time","description":"Queue status last change"},"messages":{"type":"number"},"scheduled":{"type":"number"}}},"profile":{"title":"profile","type":"object","properties":{"name":{"type":"string"},"image":{"type":"object"},"info":{"type":"string"},"status":{"type":"string"},"lastSyncAt":{"type":"string","format":"date-time"}}},"session":{"title":"session","type":"object","properties":{"uptime":{"type":"number"},"uptimeOnline":{"type":"number"},"appVersion":{"type":"string"},"status":{"type":"string","enum":["online","offline","timeout","timeout_sync","conflict","blocked","error","authorize","authorizing","new","loading","offline:panel","offline:modal"],"default":"new"},"newNumber":{"type":"boolean"},"lastSyncAt":{"type":"string","format":"date-time"},"linkedDevices":{"type":"number"},"screenLock":{"type":"boolean","description":"Whether the device screen lock is enabled or not"},"chatLock":{"type":"boolean","description":"Whether the chats lock protection password is active on this number"},"keypass":{"type":"boolean","description":"Whether this device required a WhatsApp passkey to complete linking"},"restriction":{"title":"restriction","type":"object","properties":{"reason":{"type":"string","description":"WhatsApp send-gate reason currently restricting this number"},"restrictionScope":{"type":"string"},"enforcementType":{"type":"string"},"expiresAt":{"type":"string","format":"date-time"},"detectedAt":{"type":"string","format":"date-time"}}},"notices":{"title":"notices","type":"object","properties":{"metaAiTerms":{"title":"metaAiTerms","type":"object","properties":{"pending":{"type":"boolean","description":"WhatsApp asks this number to accept Meta's AI terms before texting businesses that use AI from Meta"},"pendingSince":{"type":"string","format":"date-time"},"blockedSince":{"type":"string","format":"date-time","description":"First time a text was held because of this notice"},"lastBlockedAt":{"type":"string","format":"date-time"}}}}},"logs":{"type":"array","items":[{"title":"Device","type":"object","properties":{"event":{"type":"string"},"level":{"type":"string","enum":["info","error","alert","warning","debug","notify","internal","standard"],"default":"info"},"message":{"type":"string"},"count":{"type":"number"},"createdAt":{"type":"string","format":"date-time"}}}]}}},"metrics":{"title":"metrics","type":"object","properties":{"openChats":{"type":"number"},"archivedChats":{"type":"number"},"groupChats":{"type":"number"},"groupChatsActive":{"type":"number"},"groupChatsInactive":{"type":"number"},"groupParticipantsTotal":{"type":"number"},"avgParticipantsPerGroup":{"type":"number"},"maxGroupSize":{"type":"number","description":"Participant count of the largest group this number belongs to"},"groupsAggregatedAt":{"type":"string","format":"date-time"},"channels":{"type":"number"},"channelsOwned":{"type":"number"},"channelsFollowing":{"type":"number"},"communityChats":{"type":"number"},"contacts":{"type":"number","description":"Total number of user contacts in the WhatsApp number, whether they are in the mobile agenda or not"},"contactsAgenda":{"type":"number","description":"Total number of user contacts in the mobile agenda"},"unreadChats":{"type":"number"},"unreadGroupChats":{"type":"number"},"unreadChannels":{"type":"number"},"unreadMessages":{"type":"number"},"unreadGroupMessages":{"type":"number"},"unreadChannelMessages":{"type":"number"},"lastChatId":{"type":"string"},"lastChatUnread":{"type":"number"},"lastRepliedChatId":{"type":"string"},"lastMessageType":{"type":"string"},"lastMessageBody":{"type":"string"},"lastRepliedMessageBody":{"type":"string"},"lastRepliedMessageType":{"type":"string"},"lastGroupMessageBody":{"type":"string"},"lastGroupMessageType":{"type":"string"},"lastRepliedGroupMessageBody":{"type":"string"},"lastRepliedGroupMessageType":{"type":"string"},"lastGroupMessageAuthor":{"type":"string"},"lastGroupChatId":{"type":"string"},"lastRepliedGroupChatId":{"type":"string"},"lastMessageId":{"type":"string"},"lastRepliedMessageId":{"type":"string"},"lastGroupMessageId":{"type":"string"},"lastRepliedGroupMessageId":{"type":"string"},"lastMessageAt":{"type":"string","format":"date-time"},"lastRepliedMessageAt":{"type":"string","format":"date-time"},"lastGroupMessageAt":{"type":"string","format":"date-time"},"lastRepliedGroupMessageAt":{"type":"string","format":"date-time"}}},"info":{"title":"info","type":"object","properties":{"updatedAt":{"type":"string","format":"date-time"},"language":{"type":"string"},"deviceless":{"type":"boolean","default":true},"name":{"type":"string"},"protocolVersion":{"type":"string"},"battery":{"type":"number"},"isBusiness":{"type":"boolean"},"canManageLists":{"type":"boolean"},"isBatteryPlugged":{"type":"boolean"},"waVersion":{"type":"string"},"platform":{"title":"platform","type":"object","properties":{"name":{"type":"string"},"version":{"type":"string"},"buildNumber":{"type":"string"},"manufacturer":{"type":"string"},"model":{"type":"string"}}}}},"stats":{"type":"object","properties":{"total":{"type":"object","properties":{"sent":{"type":"number"},"failed":{"type":"number"},"media":{"type":"number"},"totalUpstreamSize":{"type":"number"},"totalDeliveryTime":{"type":"number"},"totalUpstreamSpeed":{"type":"number"}}},"minutes":{"type":"object","properties":{"sent":{"type":"number"},"failed":{"type":"number"},"media":{"type":"number"},"totalUpstreamSize":{"type":"number"},"totalDeliveryTime":{"type":"number"},"totalUpstreamSpeed":{"type":"number"}}},"quarter":{"type":"object","properties":{"sent":{"type":"number"},"failed":{"type":"number"},"media":{"type":"number"},"totalUpstreamSize":{"type":"number"},"totalDeliveryTime":{"type":"number"},"totalUpstreamSpeed":{"type":"number"}}},"hour":{"type":"object","properties":{"sent":{"type":"number"},"failed":{"type":"number"},"media":{"type":"number"},"totalUpstreamSize":{"type":"number"},"totalDeliveryTime":{"type":"number"},"totalUpstreamSpeed":{"type":"number"}}},"day":{"type":"object","properties":{"sent":{"type":"number"},"failed":{"type":"number"},"media":{"type":"number"},"totalUpstreamSize":{"type":"number"},"totalDeliveryTime":{"type":"number"},"totalUpstreamSpeed":{"type":"number"}}},"week":{"type":"object","properties":{"sent":{"type":"number"},"failed":{"type":"number"},"media":{"type":"number"},"totalUpstreamSize":{"type":"number"},"totalDeliveryTime":{"type":"number"},"totalUpstreamSpeed":{"type":"number"}}},"month":{"type":"object","properties":{"sent":{"type":"number"},"failed":{"type":"number"},"media":{"type":"number"},"totalUpstreamSize":{"type":"number"},"totalDeliveryTime":{"type":"number"},"totalUpstreamSpeed":{"type":"number"}}},"year":{"type":"object","properties":{"sent":{"type":"number"},"failed":{"type":"number"},"media":{"type":"number"},"totalUpstreamSize":{"type":"number"},"totalDeliveryTime":{"type":"number"},"totalUpstreamSpeed":{"type":"number"}}}}},"logs":{"type":"array","items":[{"title":"Device","type":"object","properties":{"event":{"type":"string"},"level":{"type":"string","enum":["info","error","alert","warning","debug","notify","internal","standard"],"default":"info"},"message":{"type":"string"},"count":{"type":"number"},"createdAt":{"type":"string","format":"date-time"}}}]}},"required":["account","user","alias"]},"message":{"title":"Message","type":"object","properties":{"id":{"type":"string","description":"Message resource ID"},"user":{"type":"object","description":"Message user owner"},"device":{"type":"object","description":"Device to which the current message is associated with"},"entity":{"type":"string","enum":["status","message"],"description":"Message entity type. Default is `message`"},"contact":{"type":"object"},"reference":{"type":"string","description":"User defined message reference text-free value"},"phone":{"type":"string","description":"Target message mobile phone number in international format (E164). Example: `+1234567890`"},"group":{"type":"string","description":"Target group chat WhatsApp ID to send message to. Examples: `123456789000000000` or `123456789000000000@g.us`"},"channel":{"type":"string","description":"Target channel chat WhatsApp ID to send message to. Examples: `123000098765421000` or `123000098765421000@newsletter`"},"chat":{"type":"string","description":"Target chat WhatsApp ID the message is delivered to. Examples: `1234567890@c.us` for user chats, `123456789000000000@g.us` for group chats and `9582938293912@lid` for private chats"},"wid":{"type":"string","description":"Target chat WhatsApp ID value"},"source":{"type":"string","enum":["chat","api"],"description":"Message source: `chat`, `api`"},"quote":{"type":"string","description":"Message ID to be quoted within the same chat, if available"},"forward":{"type":"string","description":"WhatsApp Message ID to forward"},"typing":{"type":"number","description":"Optional. Simulate typing / recording status on the target chat in seconds"},"selectId":{"type":"string","description":"Reply to buttons or list messages by selecting one of the available elements by its unique ID. \n**Important**: requires the `quote` field to be present referring to the original buttons or list message ID to be replied to."},"deliveryOptions":{"title":"deliveryOptions","type":"object","properties":{"previewUrl":{"type":"boolean","default":true}}},"waType":{"type":"string","default":"chat"},"flow":{"type":"string","default":"out"},"waId":{"type":"string"},"wabaId":{"type":"string"},"wabaWid":{"type":"string"},"message":{"type":"string"},"header":{"type":"string","description":"Optional message header text"},"headerType":{"type":"string","description":"Optional message header type"},"headerFile":{"type":"object","description":"Optional message header media"},"headerUrl":{"type":"string","description":"Optional message header media file"},"footer":{"type":"string","description":"Optional message footer text"},"event":{"title":"event","type":"object","properties":{"name":{"type":"string","description":"Event name"},"description":{"type":"string","description":"Optional event description"},"location":{"type":"string","description":"Optional event location description"},"latitude":{"type":"number","description":"Event location latitude"},"longitude":{"type":"number","description":"Event location longitude"},"call":{"type":"string","description":"Event call type: `voice` or `video`, `null` for no call"},"date":{"type":"string","format":"date-time","description":"Event start date and time, from now up to 1 year"},"link":{"type":"string","description":"Event meeting link. Empty by default, randomly generated at message delivery time"}}},"attend":{"title":"attend","type":"object","properties":{"event":{"type":"string","description":"Event message ID to attend to (18, 20, 22, 24 or 32 hexademical characters length)"},"confirm":{"type":"boolean","description":"Confirm attendance to event (true) or reject it (false)"}}},"poll":{"title":"poll","type":"object","properties":{"name":{"type":"string","description":"Poll name"},"multiple":{"type":"boolean","description":"Poll allows multiple options to be selected"}}},"vote":{"title":"vote","type":"object","properties":{"poll":{"type":"string","description":"Poll message ID to vote for"}}},"list":{"title":"list","type":"object","properties":{"description":{"type":"string"},"title":{"type":"string"},"footer":{"type":"string"},"button":{"type":"string"}}},"flowMessage":{"title":"flowMessage","type":"object","properties":{"flowId":{"type":"string"},"flowCta":{"type":"string"},"flowToken":{"type":"string"},"screen":{"type":"string"},"action":{"type":"string"},"data":{"type":"object"},"mode":{"type":"string"}}},"product":{"type":"string"},"reaction":{"type":"string"},"reactionMessage":{"type":"string"},"template":{"type":"object","properties":{"name":{"type":"string"},"language":{"type":"string"},"flow":{"type":"object","properties":{"flowId":{"type":"string"},"token":{"type":"string"},"data":{"type":"object"}}}}},"location":{"type":"object","properties":{"request":{"type":"boolean","description":"Send a location request interactive message to obtain the user location"},"address":{"type":"string","description":"Location full address compatible with Google Maps"},"name":{"type":"string","description":"Location user-defined or georeversed optional name rendered as location message type"}}},"media":{"title":"media","type":"object","properties":{"file":{"type":"object","description":"File media object. Seexx Files entity API endpoints for more information about files."},"filename":{"type":"string","description":"Optional media file name, if available."},"kind":{"type":"string","enum":["image","video","audio","document"],"description":"Media file type: image, video, audio or document"},"format":{"type":"string","enum":["gif","ptt","native"],"default":"native","description":"Media native presentation format allowed by WhatsApp. Defaults to native media format (audio, video or document). If you want to send videos as gifs, use format = \"gif\" (only compatible with \"video/mp4\" file type).  If you want to send audio messages like they were sent as voice records as PTT or Push To Talk, then use format = \"ptt\" (only compatible with \"audio/ogg\" file type)."},"viewOnce":{"type":"boolean","description":"Optional, only applicable to images and videos. If `viewMode` is `true`, the media content will disappear on WhatsApp after the recipient has opened it and exited the media viewer."}}},"status":{"type":"string","enum":["invalid","removed","expired","failed","queued","processing","processed"],"default":50},"deliveryStatus":{"type":"string","enum":["sent","failed","queued","read","played","revoked","delivered","cancelled","processing","readed"],"default":"queued"},"sendReadAck":{"type":"boolean","description":"Send messages read acknowledgement right after the message gets delivered, simulating user native behavior after opening a chat with pending unread messages.\n\nUse \"true\" in order to report to the target user/group members that received messages were readed by you with blue double-check.\n\nNote: in case you have disabled read confirmation in WhatsApp Settings > Account > Privacy, this configuration will have no effect."},"failureReason":{"type":"string"},"priority":{"type":"number","enum":["low","normal","high","urgent"],"default":20},"sentAt":{"type":"string","format":"date-time"},"processedAt":{"type":"string","format":"date-time"},"deliverAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time"},"expiredAt":{"type":"string","format":"date-time"},"failedAt":{"type":"string","format":"date-time"},"retentionPolicy":{"type":"string","default":"plan_defaults"},"retry":{"title":"retry","type":"object","properties":{"max":{"type":"number"},"delay":{"type":"number"},"count":{"type":"number"},"lastRetryAt":{"type":"string","format":"date-time"},"error":{"title":"error","type":"object","properties":{"code":{"type":"string"},"reason":{"type":"string"},"restrictionScope":{"type":"string"},"message":{"type":"string"},"retriable":{"type":"boolean"},"retryAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}}},"webhookStatus":{"type":"string","enum":["invalid","removed","failed","cancelled","expired","pending","ignored","notified"],"default":50}},"required":["device","account","user"]},"webhook":{"title":"Webhook","type":"object","properties":{"id":{"type":"string","description":"Webhook resource ID"},"url":{"type":"string","description":"Webhook endpoint URL"},"name":{"type":"string","description":"Webhook user defined name"},"status":{"type":"number","enum":["removed","error","pending","failed","active"],"default":100,"description":"Webhook current operational status"},"retries":{"type":"number","description":"Failure count: it goes up by one at most once every 2 minutes while deliveries fail, and back to 0 after a successful delivery or when the webhook is enabled. The webhook is disabled when it reaches 60"},"lastRetryAt":{"type":"string","format":"date-time","description":"Last retry attempt date, if available"},"lastRunAt":{"type":"string","format":"date-time","description":"Last notification attempt date"},"lastFailureAt":{"type":"string","format":"date-time","description":"Webhook last failure date"},"device":{"type":"object","description":"If present, webhook events are restricted to the specific device. Optional"},"user":{"type":"object","description":"Webhook current operational status"}},"required":["user","url"]},"webhookLog":{"title":"WebhookLog","type":"object","properties":{"id":{"type":"string","description":"WebhookLog resource ID"},"webhook":{"type":"object","description":"Webhook current operational status"},"createdAt":{"type":"string","format":"date-time","description":"Log entry creation date"},"event":{"type":"string","enum":["error","delivery"],"default":"delivery","description":"Log event name"},"code":{"type":"string","description":"Error code, if available"},"objectId":{"type":"string","description":"Notification event object ID, if available. This ID is used as the unique idempotency key."},"deviceId":{"type":"string","description":"Notification event device ID, if available."},"objectType":{"type":"string","enum":["device","message"],"description":"Notification event object type, if available."},"objectEvent":{"type":"string","enum":["message:in:new","message:out:new","message:out:sent","message:out:ack","message:out:retry","message:out:failed","message:out:removed","message:out:expired","device:status:update"],"description":"Notification event code name used for the notification. This determines the type of webhook notification, such as: message:in:new."},"message":{"type":"string","description":"Message data or error message, if available"},"body":{"type":"string","description":"HTTP request body. Only available in certain events"},"responseTime":{"type":"number","description":"Response time in milliseconds"},"responseStatus":{"type":"number","default":200,"description":"HTTP response status"},"responseType":{"type":"string","description":"HTTP response MIME type (Content-Type header)"},"responseBody":{"type":"string","description":"HTTP response body (limited to 3000 characters maximum)"}},"required":["user","webhook"]},"catalog":{"title":"Catalog","type":"object","properties":{"id":{"type":"string","description":"Catalog resource ID"},"device":{"type":"object"},"user":{"type":"object"},"wid":{"type":"string"},"scope":{"type":"string","enum":["wa","chat"],"default":"wa"},"status":{"type":"number","enum":["active","removed"],"default":50},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"syncedAt":{"type":"string","format":"date-time"},"permission":{"type":"number","enum":["public","readonly","private"],"default":50}},"required":["wid","account","user","device"]},"campaign":{"title":"Campaign","type":"object","properties":{"id":{"type":"string","description":"Campaign resource ID"},"user":{"type":"object"},"owner":{"type":"object"},"name":{"type":"string"},"device":{"type":"object"},"clone":{"type":"object","description":"If the campaign was cloned, this field will contain the source campaign ID"},"mode":{"type":"string","enum":["single","multiple"],"description":"Campaign message delivery mode. `single` for the same message to many contacts or `multiple` for many messages to each contact"},"source":{"type":"string","enum":["import","contacts"],"default":"import","description":"Campaign recipients source. `import` for the file imported recipients  via Excel/CSV/Google Sheets, or `contacts` for CRM loaded contacts source."},"startedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time"},"stoppedAt":{"type":"string","format":"date-time"},"canceledAt":{"type":"string","format":"date-time"},"removedAt":{"type":"string","format":"date-time"},"message":{"type":"string"},"template":{"type":"string","description":"WABA template name identifier"},"templateLanguage":{"type":"string","description":"WABA template language"},"file":{"type":"object","description":"Optional image or video media file to send"},"failureReason":{"type":"string"},"failureMessage":{"type":"string"},"unsubscribe":{"title":"unsubscribe","type":"object","properties":{"active":{"type":"boolean"},"word":{"type":"string"},"message":{"type":"string"}}},"stats":{"title":"stats","type":"object","properties":{"total":{"type":"number"},"processed":{"type":"number"},"delivered":{"type":"number"},"read":{"type":"number"},"failed":{"type":"number"},"excluded":{"type":"number"},"invalid":{"type":"number"},"deferred":{"type":"number"},"deferredByReason":{"title":"deferredByReason","type":"object","properties":{"meta_ai_terms_required":{"type":"number"}}}}},"settings":{"title":"settings","type":"object","properties":{"speed":{"type":"number","default":1},"date":{"type":"string","format":"date-time"},"expiration":{"type":"string","format":"date-time"},"timezone":{"type":"string"},"hours":{"title":"hours","type":"object","properties":{"start":{"type":"number"},"end":{"type":"number"}}}}}},"required":["device","name","status","owner","user"]},"meetingLink":{"title":"MeetingLink","type":"object","properties":{"id":{"type":"string","description":"MeetingLink resource ID"},"user":{"type":"object"},"device":{"type":"object"},"expiresAt":{"type":"string","format":"date-time"},"kind":{"type":"string","enum":["voice","video"],"default":"voice"},"token":{"type":"string"},"message":{"type":"string"}},"required":["token","expiresAt","device","user"]},"department":{"title":"Department","type":"object","properties":{"id":{"type":"string","description":"Department resource ID"},"user":{"type":"object"},"owner":{"type":"object"},"device":{"type":"object"},"name":{"type":"string"},"icon":{"type":"string","default":"briefcase"},"color":{"type":"string"},"description":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["device","account","owner","user"]},"template":{"title":"Template","type":"object","properties":{"id":{"type":"string","description":"Template resource ID"},"permission":{"type":"number","enum":["all","readonly","private"],"default":100},"waba":{"type":"string"},"templateId":{"type":"string"},"name":{"type":"string"},"language":{"type":"string"},"parameterFormat":{"type":"string","enum":["NAMED","POSITIONAL"],"default":"POSITIONAL"},"status":{"type":"string"},"category":{"type":"string","enum":["MARKETING","UTILITY","SERVICE","AUTHENTICATION","AUTHENTICATION_INTERNATIONAL"]},"subCategory":{"type":"string"},"rejectedReason":{"type":"string"},"codeExpirationMinutes":{"type":"number"},"addSecurityRecommendation":{"type":"boolean"},"previousCategory":{"type":"string","enum":["MARKETING","UTILITY","SERVICE","AUTHENTICATION","AUTHENTICATION_INTERNATIONAL"]},"messageTemplateNamespace":{"type":"string"},"messageSendTtlSeconds":{"type":"number"},"allowCategoryChange":{"type":"boolean"},"lastSyncedAt":{"type":"string","format":"date-time"}},"required":["category","status","language","name","waba","connection","account","user"]},"ioChat":{"type":"object","properties":{"wid":{"type":"string","description":"WhatsApp chat ID. This ID is taken from WhatsApp and represents the unique ID of the chat within the WhatsApp number."},"lid":{"type":"string","description":"WhatsApp private chat ID: optional hidden number ID protected by WhatsApp due to enhanced privacy"},"userId":{"type":"string","description":"Business-scoped user ID (BSUID) of the chat peer, when the number is a WhatsApp Business API number"},"status":{"type":"number","enum":["removed","banned","archived","muted","pending","active","resolved"],"default":60,"description":"Platform internal chat status. This status is different from the WhatsApp-specific app status (active, archived, removed)."},"waStatus":{"type":"string","enum":["invalid","removed","banned","archived","active"],"description":"WhatsApp chat app internal status. This value may be different from the `status` field that represents the platform-level status of the chat (resolved, pending, active, removed...)."},"statusUpdatedAt":{"type":"string","format":"date-time","description":"Last date-time the chat status was changed. E.g: (pending to resolved, resolved to pending, pending to removed...)"},"statusUpdatedBy":{"type":"object","description":"Last user agent ID who changed the chat status"},"prevStatusUpdatedAt":{"type":"string","format":"date-time"},"kind":{"type":"string","default":"chat"},"name":{"type":"string"},"owner":{"title":"owner","type":"object","properties":{"agent":{"type":"object","description":"User that is currently assigned to the chat"},"assigner":{"type":"object","description":"User who manually assigned the chat to another user"},"assignedAt":{"type":"string","format":"date-time","description":"Last date on which the chat was manually assigned to a user"},"unassignedAt":{"type":"string","format":"date-time","description":"If the chat was unassigned, the date on which the chat was manually unassigned"},"previousAgent":{"type":"object","description":"When the chat was unassigned or re-assigned to another user, this field stores the previous user ID who was assigned to this chat"},"autoAssignAgent":{"type":"object","description":"When applicable, user to which the chat was auto-assigned to"},"autoAssignedAt":{"type":"string","format":"date-time","description":"When applicable, last date on which the chat was auto-assigned to a user"},"autoUnassignedAt":{"type":"string","format":"date-time","description":"When applicable, last date on which the chat was automatically unassigned from a user based on the configured policy"},"department":{"type":"object","description":"Department ID assigned to this chat"},"previousDepartment":{"type":"object","description":"Previously assigned department ID"},"departmentUpdatedAt":{"type":"string","format":"date-time","description":"Last date-time the chat department was updated"},"departmentAssigner":{"type":"object","description":"User ID who last assigned the chat to a department"},"autoAssignDepartment":{"type":"object","description":"When applicable, department to which the chat was auto-assigned to"},"autoAssignDepartmentAt":{"type":"string","format":"date-time","description":"When applicable, date when the department was auto-assigned by the system"}}},"expiresAt":{"type":"string","format":"date-time","description":"Free messaging open chat window expiration date-time. Only applicable to WABA numbers."},"firstMessageAt":{"type":"string","format":"date-time","description":"First message date on this chat"},"lastMessageAt":{"type":"string","format":"date-time","description":"Latest message date on this chat"},"lastMessage":{"type":"object"},"lastReactionAt":{"type":"string","format":"date-time"},"lastReactionEmoji":{"type":"string"},"lastReactionAuthor":{"type":"string"},"lastNote":{"type":"object"},"lastAutoReplyAt":{"type":"string","format":"date-time"},"lastAutoReplyMessage":{"type":"object"},"contact":{"type":"object"},"stats":{"title":"stats","type":"object","properties":{"notes":{"type":"number"},"localMessages":{"type":"number"},"inboundMessages":{"type":"number"},"outboundMessages":{"type":"number"}}},"meta":{"title":"meta","type":"object","properties":{"unreadCount":{"type":"number"},"unreadCountAt":{"type":"string","format":"date-time"},"callPermission":{"title":"callPermission","type":"object","properties":{"status":{"type":"string","enum":["temporary","permanent","rejected","none"]},"isPermanent":{"type":"boolean"},"expiresAt":{"type":"string","format":"date-time"},"source":{"type":"string"},"updatedAt":{"type":"string","format":"date-time"}}},"lastCall":{"title":"lastCall","type":"object","properties":{"callId":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound"]},"status":{"type":"string","enum":["ringing","missed","completed"]},"at":{"type":"string","format":"date-time"},"endedAt":{"type":"string","format":"date-time"},"duration":{"type":"number"}}},"isUnread":{"type":"boolean"},"unreadAt":{"type":"string","format":"date-time"},"isUserInitiated":{"type":"boolean"},"canSend":{"type":"boolean","default":true},"isFavorite":{"type":"boolean"},"isPinned":{"type":"boolean"},"isChatPinned":{"type":"boolean"},"isReadOnly":{"type":"boolean"},"isArchived":{"type":"boolean"},"isLocked":{"type":"boolean","description":"Whether this chat is password locked on the WhatsApp app"},"isPasswordProtected":{"type":"boolean","description":"Whether this chat is password protected on the platform. The same chat may or may not be protected at WhatsApp app level"},"muteExpiration":{"type":"number"},"isChatMuted":{"type":"boolean"},"isSpam":{"type":"boolean"},"modifyTag":{"type":"number"},"ephemeral":{"type":"number"},"hasOlderMessages":{"type":"boolean"},"isPhoneHidden":{"type":"boolean"},"referral":{"title":"referral","type":"object","properties":{"sourceUrl":{"type":"string","description":"Original referral source URL (e.g. ad link)"},"sourceType":{"type":"string","description":"Referral source type (e.g. ad, catalog)"},"sourceId":{"type":"string","description":"Referral source id (provider specific)"},"headline":{"type":"string","description":"Referral headline (ad headline)"},"body":{"type":"string","description":"Referral body (ad body / CTA)"},"mediaType":{"type":"string","description":"Referral media type (image, video, etc.)"},"imageUrl":{"type":"string","description":"Referral image URL"},"videoUrl":{"type":"string","description":"Referral video URL"},"thumbnailUrl":{"type":"string","description":"Referral thumbnail URL"},"welcomeMessage":{"type":"string","description":"Referral welcome message"},"ctwaClid":{"type":"string","description":"Referral CTWA CLID"}}}}},"channel":{"title":"channel","type":"object","properties":{"privacy":{"type":"string"},"reactionCodes":{"type":"number"},"description":{"type":"string"},"owner":{"type":"boolean"},"membership":{"type":"string"},"inviteCode":{"type":"string"},"suspended":{"type":"boolean"},"verified":{"type":"boolean"},"geosuspended":{"type":"boolean"},"followers":{"type":"number"},"website":{"type":"string"},"nameUpdatedAt":{"type":"string","format":"date-time"},"descriptionUpdatedAt":{"type":"string","format":"date-time"},"image":{"title":"image","type":"object","properties":{"syncedAt":{"type":"string"},"url":{"type":"string"},"file":{"type":"object"}}}}},"group":{"title":"group","type":"object","properties":{"syncedAt":{"type":"string","format":"date-time"},"owner":{"type":"string"},"description":{"type":"string"},"community":{"type":"string"},"isCommunityAnnounce":{"type":"boolean"},"image":{"title":"image","type":"object","properties":{"url":{"type":"string"}}},"totalParticipants":{"type":"number"},"membershipApproval":{"type":"boolean"},"membershipInvite":{"type":"boolean","default":true},"membershipHistory":{"type":"boolean"},"membershipLink":{"type":"boolean"},"membershipSubgroups":{"type":"boolean"},"limitSharing":{"type":"boolean"},"announce":{"type":"boolean"},"restrict":{"type":"boolean"},"subjectUpdatedAt":{"type":"string","format":"date-time"},"descriptionOwner":{"type":"string"},"descriptionUpdatedAt":{"type":"string","format":"date-time"}}},"permissions":{"title":"permissions","type":"object","properties":{"active":{"type":"boolean"},"mode":{"type":"string","enum":["password"]},"updatedBy":{"type":"object"},"updatedAt":{"type":"string","format":"date-time"}}}},"required":["wid","device"]},"ioFile":{"type":"object","properties":{"message":{"type":"string"},"chat":{"type":"string"},"status":{"type":"number","enum":["invalid","banned","removed","failed","expired","unavailable","fetching","new","unsupported","available"],"default":70},"caption":{"type":"string"},"error":{"type":"string"},"errorCode":{"type":"string"},"kind":{"type":"string"},"size":{"type":"number"},"mime":{"type":"string"},"extension":{"type":"string"},"format":{"type":"string"},"filename":{"type":"string"},"sha2":{"type":"string"},"mediaKey":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"uploadedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time"},"meta":{"title":"meta","type":"object","properties":{"hasPreview":{"type":"boolean"},"width":{"type":"number"},"height":{"type":"number"},"duration":{"type":"number"},"aspectRatio":{"type":"number"},"pageCount":{"type":"number"}}},"preview":{"title":"preview","type":"object","properties":{"image":{"type":"object"},"mime":{"type":"string"},"width":{"type":"number"},"height":{"type":"number"}}}},"required":["status","device"]},"ioMessage":{"type":"object","properties":{"device":{"type":"object"},"mtype":{"type":"string","enum":["note","event","status","message"],"default":"m"},"agent":{"type":"object","description":"Agent message owner ID, if available"},"chatWid":{"type":"string"},"chat":{"type":"object"},"wid":{"type":"string"},"reference":{"type":"string","description":"Optional message reference user-defined value token or identifier"},"widFull":{"type":"string"},"eventCode":{"type":"string"},"params":{"type":"object"},"trigger":{"type":"string"},"flow":{"type":"string","enum":["in","out"],"default":"out"},"from":{"type":"string"},"userId":{"type":"string"},"toUserId":{"type":"string"},"fromContact":{"type":"object"},"to":{"type":"string"},"toContact":{"type":"object"},"author":{"type":"object","description":"Optional group message author, if message chat is a group or broadcast type chat"},"ack":{"type":"string","enum":["failed","sent","read","played","error","pending","delivered"],"default":"pending"},"kind":{"type":"string","default":"text"},"subtype":{"type":"string","default":"text"},"unsupportedType":{"type":"string"},"date":{"type":"string","format":"date-time"},"editedAt":{"type":"string","format":"date-time","description":"Date of message edit, if applicable"},"originalWid":{"type":"string","description":"Original message ID before edit, if applicable"},"originalWabaId":{"type":"string","description":"Original message WABA ID before edit, if applicable"},"stats":{"title":"stats","type":"object","properties":{"localMessages":{"type":"number"}}},"campaign":{"type":"object"},"campaignMessage":{"type":"object"},"body":{"type":"string"},"location":{"title":"location","type":"object","properties":{"address":{"type":"string"},"name":{"type":"string"},"lat":{"type":"number"},"lon":{"type":"number"},"degrees":{"type":"number"}}},"media":{"title":"media","type":"object","properties":{"id":{"type":"object","description":"Media file ID"},"expiresAt":{"type":"string","format":"date-time"},"status":{"type":"string","enum":["invalid","banned","removed","failed","expired","unavailable","new","unsupported","available"],"default":70},"mime":{"type":"string"},"encoding":{"type":"string"},"size":{"type":"number"},"format":{"type":"string"},"caption":{"type":"string"},"filename":{"type":"string"},"filehash":{"type":"string"},"meta":{"title":"meta","type":"object","properties":{"hasPreview":{"type":"boolean"},"width":{"type":"number"},"height":{"type":"number"},"duration":{"type":"number"},"aspectRatio":{"type":"number"},"pageCount":{"type":"number"}}},"preview":{"title":"preview","type":"object","properties":{"image":{},"mime":{"type":"string"},"width":{"type":"number"},"height":{"type":"number"}}}}},"webhookStatus":{"type":"number","default":50},"webhookSyncedAt":{"type":"string","format":"date-time"},"events":{"type":"object","properties":{"inbound":{"type":"object","properties":{"reportedAt":{"type":"string","format":"date-time"}}},"outbound":{"type":"object","properties":{"reportedAt":{"type":"string","format":"date-time"}}},"error":{"type":"object","properties":{"reportedAt":{"type":"string","format":"date-time"}}},"failed":{"type":"object","properties":{"reportedAt":{"type":"string","format":"date-time"}}},"sent":{"type":"object","properties":{"reportedAt":{"type":"string","format":"date-time"}}},"readed":{"type":"object","properties":{"reportedAt":{"type":"string","format":"date-time"}}},"played":{"type":"object","properties":{"reportedAt":{"type":"string","format":"date-time"}}},"delivered":{"type":"object","properties":{"reportedAt":{"type":"string","format":"date-time"}}},"update":{"type":"object","properties":{"reportedAt":{"type":"string","format":"date-time"}}},"status":{"type":"object","properties":{"reportedAt":{"type":"string","format":"date-time"}}},"reaction":{"type":"object","properties":{"reportedAt":{"type":"string","format":"date-time"}}},"flow":{"type":"object","properties":{"reportedAt":{"type":"string","format":"date-time"}}}}},"linkPreview":{"title":"linkPreview","type":"object","properties":{"thumbnail":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"canonicalUrl":{"type":"string"},"matchedUrl":{"type":"string"}}},"referral":{"title":"referral","type":"object","properties":{"sourceUrl":{"type":"string","description":"Original referral source URL (e.g. ad link)"},"sourceType":{"type":"string","description":"Referral source type (e.g. ad, catalog)"},"sourceId":{"type":"string","description":"Referral source id (provider specific)"},"headline":{"type":"string","description":"Referral headline (ad headline)"},"body":{"type":"string","description":"Referral body (ad body / CTA)"},"mediaType":{"type":"string","description":"Referral media type (image, video, etc.)"},"imageUrl":{"type":"string","description":"Referral image URL"},"videoUrl":{"type":"string","description":"Referral video URL"},"thumbnailUrl":{"type":"string","description":"Referral thumbnail URL"},"welcomeMessage":{"type":"string","description":"Referral welcome message"},"ctwaClid":{"type":"string","description":"Referral CTWA CLID"}}},"vcards":{"type":"array","items":[{"type":"object","properties":{"contact":{"type":"object"},"vcard":{"type":"string"},"version":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"formattedName":{"type":"string"},"title":{"type":"string"},"org":{"title":"org","type":"object","properties":{"company":{"type":"string"}}}}}]},"quoted":{"title":"quoted","type":"object","properties":{"kind":{"type":"string"},"wid":{"type":"string"},"wabaId":{"type":"string"},"from":{"type":"string"},"fromName":{"type":"string"},"fromContact":{"type":"object"},"title":{"type":"string"},"footer":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"selectedId":{"type":"string"},"message":{"type":"object"},"body":{"type":"string"},"reference":{"type":"string"},"preview":{"type":"string"},"previewMime":{"type":"string"},"previewAspectRatio":{"type":"number"}}},"title":{"type":"string"},"header":{"type":"string","description":"Optional message header text"},"headerType":{"type":"string","description":"Optional message header type"},"headerFile":{"type":"string","description":"Optional message header WABA file ID"},"headerFilename":{"type":"string","description":"Optional message header file name"},"headerUrl":{"type":"string","description":"Optional message header multimedia URL"},"headerLocation":{"title":"headerLocation","type":"object","properties":{"latitude":{"type":"number"},"longitude":{"type":"number"},"name":{"type":"string"},"address":{"type":"string"}}},"footer":{"type":"string"},"list":{"title":"list","type":"object","properties":{"kind":{"type":"string"},"description":{"type":"string"},"title":{"type":"string"},"footer":{"type":"string"},"button":{"type":"string"}}},"product":{"title":"product","type":"object","properties":{"id":{"type":"string"},"seller":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"price":{"type":"number"},"url":{"type":"string"},"retailerId":{"type":"string"},"currency":{"type":"string"},"availability":{"type":"string"},"maxAvailable":{"type":"number"},"thumbnail":{"type":"string"}}},"order":{"title":"order","type":"object","properties":{"id":{"type":"string"},"catalogId":{"type":"string"},"text":{"type":"string"},"date":{"type":"string","format":"date-time"},"price":{"type":"number"},"currency":{"type":"string"},"items":{"type":"number"},"seller":{"type":"string"},"subtotal":{"type":"number"},"total":{"type":"number"},"tax":{"type":"number"},"thumbnail":{"type":"string"},"products":{"type":"array","items":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"retailerId":{"type":"string"},"quantity":{"type":"number"},"price":{"type":"number"},"currency":{"type":"string"},"imageUrl":{"type":"string"}}}]}}},"interactive":{"type":"object"},"flowMessage":{"title":"flowMessage","type":"object","properties":{"flowId":{"type":"string"},"flowCta":{"type":"string"},"flowToken":{"type":"string"},"screen":{"type":"string"},"action":{"type":"string"},"data":{"type":"object"},"mode":{"type":"string"}}},"referredProduct":{"type":"object"},"poll":{"title":"poll","type":"object","properties":{"name":{"type":"string"},"lastVoteAt":{"type":"string","format":"date-time"},"lastVoter":{"type":"string"},"count":{"type":"number"},"participants":{"type":"number"},"invalidated":{"type":"boolean"},"expired":{"type":"boolean"},"max":{"type":"number"}}},"event":{"title":"event","type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"location":{"type":"string"},"date":{"type":"string","format":"date-time"},"latitude":{"type":"number"},"longitude":{"type":"number"},"call":{"type":"string"},"code":{"type":"string"},"link":{"type":"string"},"invalidated":{"type":"boolean"},"attending":{"type":"boolean"},"updatedAt":{"type":"string","format":"date-time"},"totalParticipants":{"type":"number"}}},"payment":{"title":"payment","type":"object","properties":{"url":{"type":"string"},"urlText":{"type":"string"},"amount":{"type":"string"},"currency":{"type":"string"},"expiryTimestamp":{"type":"string"},"messageReceiverJid":{"type":"string"},"note":{"type":"string"},"requestMessageKey":{"type":"string"},"status":{"type":"string"},"transactionTimestamp":{"type":"string"}}},"template":{"title":"template","type":"object","properties":{"name":{"type":"string"},"language":{"type":"string"},"components":{"type":"array"}}},"meta":{"title":"meta","type":"object","properties":{"rtl":{"type":"boolean"},"containsEmoji":{"type":"boolean"},"isGif":{"type":"boolean"},"isFailed":{"type":"boolean"},"isStar":{"type":"boolean"},"isEdited":{"type":"boolean"},"isGroup":{"type":"boolean"},"isForwarded":{"type":"boolean"},"isEphemeral":{"type":"boolean"},"ephemeralDuration":{"type":"number"},"isNotification":{"type":"boolean"},"notifyName":{"type":"string"},"isLive":{"type":"boolean"},"isBroadcast":{"type":"boolean"},"isChannel":{"type":"boolean"},"isBizNotification":{"type":"boolean"},"isDoc":{"type":"boolean"},"isLinkPreview":{"type":"boolean"},"isPSA":{"type":"boolean"},"isRevoked":{"type":"boolean"},"isUnreadType":{"type":"boolean"},"selectedButtonId":{"type":"string"},"selectedListId":{"type":"string"},"flowResponse":{"type":"object"},"flowName":{"type":"string"},"source":{"type":"string","enum":["android","ios","web","desktop","api","chat","autoreply"],"description":"Defines the message source sent from different WhatsApp client origins."},"via":{"type":"string","enum":["app","platform","remote"],"description":"Only available for `outbound` messages. Defines the sender origin for the current message: `app` for messages sent from the mobile app, `platform` for messages sent from the platform-linked session, and `remote` for messages sent from other linked devices."},"autoReply":{"type":"string"},"isFirstMessage":{"type":"boolean","description":"**Field only available in webhook event payloads**. Defines if the current message was the first message sent for outbound messages or received for inbound messages in the specific chat context."},"color":{"type":"string","description":"Color used in the user status message. Only applicable to user status updates, not to chat messages"},"font":{"type":"string","description":"Font style used in the user status message. Only applicable to user status updates, not to chat messages"}}},"pricing":{"title":"pricing","type":"object","properties":{"billable":{"type":"boolean"},"model":{"type":"string"},"kind":{"type":"string"},"category":{"type":"string"}}},"error":{"title":"error","type":"object","properties":{"date":{"type":"string","format":"date-time"},"code":{"type":"number"},"title":{"type":"string"},"message":{"type":"string"},"data":{"type":"object"},"href":{"type":"string"}}}},"required":["wid","chatWid","device"]},"ioContact":{"type":"object","properties":{"wid":{"type":"string","description":"Contact WhatsApp ID"},"chat":{"type":"object","description":"Reference to the private chat for the contact, if already created"},"userId":{"type":"string","description":"Business-scoped user ID (BSUID) assigned by Meta. Present for WhatsApp Business API contacts. Stable per business portfolio, and the only identifier available when the user has hidden their phone number."},"username":{"type":"string","description":"WhatsApp username chosen by the user, when they have adopted the usernames feature. Available even when the phone number is withheld."},"groupId":{"type":"string","description":"Group WhatsApp ID without suffix, if contact type is a group"},"channelId":{"type":"string","description":"Channel WhatsApp ID without suffix, if contact type is a channel"},"broadcastId":{"type":"string","description":"Broadcast list WhatsApp ID without suffix, if contact type is broadcast"},"phone":{"type":"string","description":"International phone number, if contact type is user"},"countryCode":{"type":"number","description":"Country code prefix of the phone number, if contact type is user and it has a phone number"},"name":{"type":"string","description":"Contact name provided by WhatsApp"},"shortName":{"type":"string","description":"Contact short name provided by WhatsApp"},"displayName":{"type":"string","description":"Contact display name in WhatsApp profile (read-only)"},"formattedName":{"type":"string","description":"Contact formatted full name provided by WhatsApp"},"formattedShortName":{"type":"string","description":"Contact formatted short name provided by WhatsApp"},"createdAt":{"type":"string","format":"date-time","description":"Contact creation date in ISO 8601 format"},"syncedAt":{"type":"string","format":"date-time","description":"Contact last syncronization date in ISO 8601 format"},"createdBy":{"type":"object","description":"User/agent ID who originally created the contact manually. Only applicable to contacts created from the platform. Contacts synced from the WhatsApp mobile agenda are ignored."},"stats":{"title":"stats","type":"object","properties":{"messages":{"type":"number","description":"Total processed messages by the contact. Stats might not be accurate or up to date."}}},"image":{"title":"image","type":"object","properties":{"url":{"type":"string","description":"Contact profile image URL provided by WhatsApp."}}},"info":{"title":"info","type":"object","properties":{"updatedAt":{"type":"string","format":"date-time"},"updatedBy":{"type":"object"},"name":{"type":"string"},"surname":{"type":"string"},"kind":{"type":"string","enum":["personal","business"],"default":"personal"},"description":{"type":"string"},"altPhone":{"type":"string"},"birthday":{"type":"string","format":"date-time"},"title":{"type":"string"},"gender":{"type":"string"},"email":{"type":"string"},"companyName":{"type":"string"},"companyCode":{"type":"string"},"companyTaxId":{"type":"string"},"companyRole":{"type":"string"},"companyPhone":{"type":"string"},"companyWebsite":{"type":"string"},"companyCountry":{"type":"string"},"currency":{"type":"string"},"timezone":{"type":"string"},"address":{"type":"string"},"postalCode":{"type":"string"},"city":{"type":"string"},"country":{"type":"string"},"notes":{"type":"string"},"notesUpdatedAt":{"type":"string","format":"date-time","description":"Last notes text change date"},"notesUpdatedBy":{"type":"object","description":"Last user ID who updated the notes text for this contact"},"crm":{"type":"string"},"crmRef":{"type":"string"}}},"subscription":{"title":"subscription","type":"object","properties":{"status":{"type":"number","enum":["subscribed","active","exclude","unsubscribed"],"default":"active","description":"Campaign subscription status"},"updatedAt":{"type":"string","format":"date-time","description":"Campaign subscription status last change date"},"updatedBy":{"type":"object","description":"User ID who last updated the subscription status for this contact"},"subscribedAt":{"type":"string","format":"date-time","description":"Campaign subscription date"},"unsubscribedCampaign":{"type":"object","description":"If applicable, last campaign ID from which the contact unsubscribed from"},"unsubscribedAt":{"type":"string","format":"date-time","description":"If applicable, date on which the contact unsubscribed from the last campaign"},"unsubscribeMessage":{"type":"object","description":"If applicable, message ID from which the contact unsubscribed from the last campaign"},"unsubscribeMessageWid":{"type":"string","description":"If applicable, message WhatsApp ID from which the contact unsubscribed from the last campaign"}}},"businessInfo":{"title":"businessInfo","type":"object","properties":{"address":{"type":"string"},"description":{"type":"string"},"email":{"type":"string"},"latitude":{"type":"number"},"longitude":{"type":"number"},"profilePath":{"type":"string"},"businessHours":{"title":"businessHours","type":"object","properties":{"timezone":{"type":"string"}}},"options":{"type":"object"},"automatedType":{"type":"string","description":"How the business uses AI from Meta. '1p_partial' is a business that uses AI from Meta: WhatsApp asks the number to accept Meta's AI terms once before texting it."}}},"meta":{"title":"meta","type":"object","properties":{"isPSA":{"type":"boolean"},"isDetachedContact":{"type":"boolean","description":"Whether if the contact is detached or not from the WhatsApp synced mobile device agenda. Detached contacts are only stored within the chat platform and not synced with WhatsApp app or with the mobile contacts agenda."},"isContact":{"type":"boolean"},"isWAContact":{"type":"boolean"},"plaintextDisabled":{"type":"boolean"},"isBusiness":{"type":"boolean"},"isEnterprise":{"type":"boolean"},"isContactBlocked":{"type":"boolean"},"showBusinessCheckmark":{"type":"boolean"},"statusMute":{"type":"boolean"},"callsMuted":{"type":"boolean","description":"Inbound calls from this contact are silenced: logged in call history, never ring"},"isVerified":{"type":"boolean","description":"If the contact is a Business account, reports whether if the WhatsApp profile is verified or not"},"verifiedName":{"type":"string","description":"Business verified name"},"isPhoneHidden":{"type":"boolean","description":"Defines if the contact phone number is private on WhatsApp"},"source":{"type":"string","description":"Contact creation source: crm, whatsapp, hubspot, zoho, salesforce, dynamics..."},"isImport":{"type":"boolean","description":"Whether this contact was imported or not"},"restriction":{"title":"restriction","type":"object","properties":{"reason":{"type":"string","description":"WhatsApp send-gate reason currently restricting sends to this contact"},"restrictionScope":{"type":"string"},"enforcementType":{"type":"string"},"expiresAt":{"type":"string","format":"date-time"},"detectedAt":{"type":"string","format":"date-time"}}}}},"metadata":{"type":"array","items":[{"type":"object","properties":{"key":{"type":"string"},"value":{"type":"string"}}}]}},"required":["wid","device"]},"groupParticipant":{"type":"object","properties":{"chatWid":{"type":"string","description":"Chat WhatsApp ID the participant belongs to"},"syncedAt":{"type":"string","format":"date-time","description":"Participant last sync date"},"wid":{"type":"string","description":"Participant WhatsApp ID"},"lid":{"type":"string","description":"Participant WhatsApp private ID (used internally by WhatsApp to identify users without exposing their phone number)"},"name":{"type":"string","description":"Participant contact name or public WhatsApp profile name, if available"},"isAdmin":{"type":"boolean","description":"Participant is a group admin"},"isSuperAdmin":{"type":"boolean","description":"Participant is the group owner"},"isContact":{"type":"boolean","description":"Participant is an existing contact in the agenda"},"isChatActive":{"type":"boolean"},"leaveReason":{"type":"string"},"leaveDate":{"type":"string","format":"date-time"}},"required":["wid","chat","chatWid","device"]},"chatGroup":{"title":"Device","type":"object","properties":{"wid":{"type":"string","description":"WhatsApp ID of the group chat"},"kind":{"type":"string","enum":["group","channel","contact","broadcast","community"],"default":"group","description":"Group kind: group, channel or community"},"name":{"type":"string"},"description":{"type":"string"},"imageUrl":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"lastMessageAt":{"type":"string","format":"date-time"},"lastSyncAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"unreadCount":{"type":"number"},"isArchive":{"type":"boolean"},"isReadOnly":{"type":"boolean"},"isPinned":{"type":"boolean"},"isCommunityAnnounce":{"type":"boolean"},"communityParentGroup":{"type":"string"},"isVerified":{"type":"boolean"},"inviteCode":{"type":"string","description":"Invite code of the group or channel, if available"},"inviteLink":{"type":"string","description":"Invite link to join the group or channel"},"website":{"type":"string"},"totalParticipants":{"type":"number"},"announce":{"type":"boolean","description":"When true, only admins can send messages to the group"},"restrict":{"type":"boolean","description":"When true, only admins can edit the group settings"},"membershipApproval":{"type":"boolean","description":"When true, new participants require admin approval to join"},"membershipInvite":{"type":"boolean","description":"When true, all members can add new participants"},"membershipHistory":{"type":"boolean","description":"When true, all members can send previous messages to newly added members"},"membershipLink":{"type":"boolean","description":"When true, all members can share the group invite link"},"membershipSubgroups":{"type":"boolean","description":"When true, non-admin members can create sub-groups in the community"},"limitSharing":{"type":"boolean","description":"When true, forwarding and sharing messages from this group is limited"}},"required":["wid","user","device"]},"quickReply":{"title":"Device","type":"object","properties":{"scope":{"type":"string","enum":["chat","wa"],"default":"wa"},"active":{"type":"boolean","default":true},"message":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"shortcut":{"type":"string"}}},"wabaPrice":{"title":"WabaPrice","type":"object","properties":{"id":{"type":"string","description":"WabaPrice resource ID"},"country":{"type":"string"},"marketName":{"type":"string"},"isRegional":{"type":"boolean"},"currencies":{"default":{}}},"required":["marketName","country"]},"label":{"title":"Device","type":"object","properties":{"active":{"type":"boolean","default":true},"scope":{"type":"string","enum":["chat","wa"],"default":"wa"},"name":{"type":"string"},"color":{"type":"string"},"description":{"type":"string"},"listType":{"type":"number"},"isBuiltIn":{"type":"boolean"},"colorIndex":{"type":"number"},"orderIndex":{"type":"number"}}},"campaignContact":{"title":"CampaignMessage","type":"object","properties":{"id":{"type":"string","description":"CampaignMessage resource ID"},"campaign":{"type":"object"},"wid":{"type":"string","description":"Message WhatsApp unique ID"},"wabaId":{"type":"string","description":"Message WABA unique ID"},"wabaWid":{"type":"string","description":"Message WABA WhatsApp ID"},"status":{"type":"string","enum":["invalid","excluded","removed","failed","pending","processing","delivered"],"default":50},"kind":{"type":"string","enum":["user","group","channel"],"default":"user"},"phone":{"type":"string"},"group":{"type":"string"},"ack":{"type":"string","enum":["pending","sent","delivered","read"]},"name":{"type":"string"},"date":{"type":"string","format":"date-time"},"reference":{"type":"string","description":"Optional message reference identifier"},"deliveredAt":{"type":"string","format":"date-time"},"readAt":{"type":"string","format":"date-time"},"failedAt":{"type":"string","format":"date-time"},"retryAt":{"type":"string","format":"date-time","description":"When a deferred (restriction-held) message is next eligible to retry"},"retries":{"type":"number"},"message":{"type":"string"},"url":{"type":"string","description":"Optional file URL header to be sent for this specific contact"},"error":{"type":"string","enum":["error","max_retries","contact:blocked","number:notfound","contact:excluded","message:forbidden","message:forbidden_first_message","media:invalid_file","media:deleted_file","media:expired_file","file:not_found","chat:cannot_send","channel:forbidden","channel:notfound","template_variables_missing","template_invalid","template_not_found","waba:template_not_approved","waba:template_validation_error","waba:error"]},"restriction":{"title":"restriction","type":"object","properties":{"reason":{"type":"string","description":"Send-gate reason string (e.g. reachout_timelocked, new_chat_capped)"},"restrictionScope":{"type":"string","description":"Scope of the restriction: account, chat or contact"},"deferred":{"type":"boolean","description":"True while the message is held by a retriable restriction"},"retryAt":{"type":"string","format":"date-time","description":"When the restriction is expected to lift and the message retries"},"expiresAt":{"type":"string","format":"date-time","description":"When WhatsApp reports the restriction itself expires, if known"}}}},"required":["target","kind","status","wid","campaign"]},"pipeline":{"title":"Pipeline","type":"object","properties":{"id":{"type":"string","description":"Pipeline resource ID"},"user":{"type":"object"},"owner":{"type":"object"},"archivedAt":{"type":"string","format":"date-time"},"name":{"type":"string"},"description":{"type":"string"},"color":{"type":"string"},"icon":{"type":"string","default":"funnel-dollar"},"position":{"type":"number"},"currency":{"type":"string"},"entry":{"title":"entry","type":"object","properties":{"mode":{"type":"string","enum":["manual","filter","all"],"default":"manual"}}},"stages":{"type":"array","items":[{"title":"Pipeline","type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"color":{"type":"string"},"position":{"type":"number"},"kind":{"type":"string","enum":["open","won","lost"],"default":"open"},"slaDays":{"type":"number"},"labelMap":{"type":"string"},"actions":{"type":"object","properties":{"assignAgent":{"type":"object"},"assignDepartment":{"type":"object"}}}}}]},"settings":{"title":"settings","type":"object","properties":{"closeChatOnWon":{"type":"boolean"},"closeChatOnLost":{"type":"boolean"},"ai":{"title":"ai","type":"object","properties":{"enabled":{"type":"boolean","default":true},"coolOffMinutes":{"type":"number","default":30}}}}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["account","owner","user"]},"deal":{"title":"Deal","type":"object","properties":{"id":{"type":"string","description":"Deal resource ID"},"owner":{"type":"object"},"device":{"type":"object"},"pipeline":{"type":"object"},"stage":{"type":"string"},"prevStage":{"type":"string"},"stageEnteredAt":{"type":"string","format":"date-time"},"stageUpdatedAt":{"type":"string","format":"date-time"},"stageUpdatedBy":{"type":"object"},"closedAt":{"type":"string","format":"date-time"},"closedBy":{"type":"object"},"lostReason":{"type":"string"},"chatWid":{"type":"string"},"contactWid":{"type":"string"},"title":{"type":"string"},"amount":{"type":"number"},"currency":{"type":"string"},"agent":{"type":"object"},"department":{"type":"object"},"card":{"type":"object","properties":{"name":{"type":"string"},"phone":{"type":"string"},"avatarUrl":{"type":"string"},"lastMessageAt":{"type":"string","format":"date-time"},"lastInboundAt":{"type":"string","format":"date-time"},"lastOutboundAt":{"type":"string","format":"date-time"},"unread":{"type":"boolean"},"chatStatus":{"type":"string"},"orphanedAt":{"type":"string","format":"date-time"}}}},"required":["stage","pipeline","device","account","user"]},"dealNote":{"title":"DealNote","type":"object","properties":{"id":{"type":"string","description":"DealNote resource ID"},"deal":{"type":"object"},"device":{"type":"object"},"author":{"type":"object"},"text":{"type":"string"},"dueAt":{"type":"string","format":"date-time"},"doneAt":{"type":"string","format":"date-time"},"doneBy":{"type":"object"},"event":{"type":"string"}},"required":["text","deal","user"]}},"securityDefinitions":{"apiKey":{"type":"apiKey","name":"Token","in":"header","description":"User API key token needs to be used on every API request that requires authentication.\n\n\n\nYou can define it via \"token\" URL query param or via \"Token\" HTTP request header.\n\n\n\nGet or create your API key from the [Web Console](https://console.wassenger.com/apikeys).\n\n\n\n**Note**: chat agents and supervisors have no access to the API.\n\n\n\n#### Example as request header:\n\n```\n\nGET /v1/messages HTTP/1.1\n\nHost: api.wassenger.com:443\n\nToken: 5f2296349b12abf18c3e4a072cfceb47f51bde312477d048a0baf7cccf4af17861e28f80739d3a3f\n\n```\n\n#### Example as URL query param:\n\n```\n\nGET /v1/messages?token=5f2296349b12abf18c3e4a072cfceb47f51bde312477d048a0baf7cccf4af17861e28f80739d3a3f HTTP/1.1\n\nHost: api.wassenger.com:443\n\n```"},"keypassToken":{"type":"apiKey","name":"Authorization","in":"header","description":"Account-wide keypass token in the Authorization header (issued via the extension download)."}},"tags":[{"name":"Analytics"},{"name":"Automatic Assignment"},{"name":"Automatic Replies"},{"name":"Automatic Resolution"},{"name":"Billing"},{"description":"Retrieve your own and query WhatsApp Business catalog from other businesses","name":"Business catalog"},{"description":"Manage, create and update message campaigns","name":"Campaigns"},{"description":"Manage channels per WhatsApp number","name":"Channels"},{"description":"Browse and manage WhatsApp number specific contacts. These API endpoints are only available in Platform subscription plans.","name":"Chat Contacts"},{"description":"Manage and download WhatsApp number specific received (inbound) media messages files. These API endpoints are only available in Platform subscription plans.","name":"Chat Files"},{"description":"Browse and manage WhatsApp number specific messages. These API endpoints are only available in Platform subscription plans.","name":"Chat Messages"},{"description":"Multi-agent chat-based API endpoints to browse and manage chats/contacts/messages/files for both inbound/outbound data entities. These API endpoints are only available in Platform subscription plans.","name":"Chats"},{"description":"Manage user contacts per WhatsApp number.","name":"Contacts"},{"description":"Create and manage deals per funnel pipeline across WhatsApp numbers","name":"Deals"},{"name":"Departments"},{"description":"Create and manage WhatsApp numbers linked to your account.","name":"Devices"},{"description":"Upload, search, edit and delete files uploaded to the platform.\n\nUploaded files are account-wide and not WhatsApp number specific. \nThe uploaded files by team members (agents, supervisors and administrators) are all accessible via API, although specific files may have limited permissions that will be only visible to administrators in the chat.","name":"Files"},{"description":"Manage and send WhatsApp Flows (interactive multi-screen in-chat experiences).","name":"Flows"},{"name":"Funnel"},{"description":"Manage group chats per WhatsApp number","name":"Groups"},{"name":"Integrations"},{"name":"Keypass"},{"name":"Labels"},{"name":"Meeting Links"},{"description":"Send, browse and manage outbound messages sent through one or multiple WhatsApp number connected in your account.","name":"Messages"},{"name":"Numbers"},{"description":"Create and manage sales funnel pipelines across WhatsApp numbers","name":"Pipeline"},{"name":"Profile"},{"name":"Queue"},{"name":"Quick Replies"},{"name":"Session"},{"description":"Manage team users that can shared access to the multi-user chat to one or multiple WhatsApp number.","name":"Team Members"},{"description":"Manage and create WhatsApp Business API messaging pre-approved templates. Limited to WhatsApp Business API enabled numbers","name":"Templates"},{"name":"Templates Pricing"},{"description":"Search, update and remove user status (stories). These API endpoints are only available in Platform subscription plans.","name":"User Status"},{"description":"Verify whether a phone number or username exists in WhatsApp, and validate their format","name":"Verify"},{"description":"Create, manage and inspect webhooks in the account.","name":"Webhooks"}],"x-tagGroups":[{"name":"Messages (outbound)","tags":["Messages"]},{"name":"Numbers Management","tags":["Devices","Session","Groups","Channels","Queue","Settings","Profile","Contacts","Team Members","Departments","Labels","Automatic Replies","Automatic Assignment","Automatic Resolution","Quick Replies","Meeting Links","Business catalog","Billing"]},{"name":"Chat","tags":["Chats","Chat Messages","Chat Contacts","Chat Files","User Status","Analytics"]},{"name":"Sales Funnel","tags":["Pipeline","Deals"]},{"name":"Campaigns","tags":["Campaigns"]},{"name":"WhatsApp Business API","tags":["Templates","Templates Pricing","Catalog","Flows"]},{"name":"Files Storage","tags":["Files"]},{"name":"Notifications","tags":["Webhooks"]},{"name":"Utilities","tags":["Verify"]}],"x-mcp":{"protocolVersion":"2025-11-25","capabilities":{"tools":{},"prompts":{},"logging":{},"completions":{}},"servers":[{"url":"https://api.domain.com/mcp","description":"MCP server (beta). Authenticate with an Authorization Bearer header holding your API key. Setup guide: /help/mcp"}]},"paths":{"/webhooks":{"parameters":[],"get":{"summary":"Get webhooks","description":"Get active webhooks, optionally filtered by search params.\n\n\n\nFor more information about Webhooks use cases and integration examples, [read the Webhook Tutorial here](/help/webhooks).\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fwebhooks)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getWebhooks","security":[{"apiKey":[]}],"tags":["Webhooks"],"consumes":["application/json"],"parameters":[{"name":"devices","in":"query","type":"array","collectionFormat":"csv","description":"Filter webhooks by device IDs","items":{"type":"string","maxLength":24,"minLength":24,"pattern":"^[0-9A-Fa-f]{24}$"}},{"name":"status","in":"query","type":"array","collectionFormat":"csv","description":"Filter webhooks status","items":{"type":"string","enum":["removed","error","pending","failed","active"]}},{"in":"query","name":"search","type":"string","maxLength":200,"minLength":2,"description":"Search webhooks by text"},{"in":"query","name":"page","description":"Results page number (starting from 0)","type":"number","format":"integer","default":0,"minimum":0,"maximum":50},{"in":"query","name":"size","description":"Results page size","type":"number","format":"integer","default":20,"minimum":1,"maximum":200}],"responses":{"200":{"description":"List of user webhooks","schema":{"type":"array","items":{"$ref":"#/definitions/webhook"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// List all account webhooks\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/webhooks \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// List all account webhooks\nhttp GET https://api.wassenger.com/v1/webhooks \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// List all account webhooks\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/webhooks';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// List all account webhooks\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/webhooks',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// List all account webhooks\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/webhooks');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// List all account webhooks\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/webhooks', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// List all account webhooks\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/webhooks');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// List all account webhooks\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/webhooks\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# List all account webhooks\nimport requests\n\nurl = \"https://api.wassenger.com/v1/webhooks\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// List all account webhooks\nconst url = 'https://api.wassenger.com/v1/webhooks';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// List all account webhooks\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/webhooks',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# List all account webhooks\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/webhooks\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// List all account webhooks\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/webhooks\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// List all account webhooks\nvar client = new RestClient(\"https://api.wassenger.com/v1/webhooks\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// List all account webhooks\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/webhooks\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// List all account webhooks\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/webhooks\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// List all account webhooks\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/webhooks\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// List all account webhooks\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/webhooks\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# List all account webhooks\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/webhooks' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// List all account webhooks\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/webhooks\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// List all account webhooks\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/webhooks\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"post":{"summary":"Register webhook","description":"Register new webhook endpoint URL for callback notifications.\n\n**For more information about Webhooks use cases and integration examples, [read the Webhook Tutorial here](/help/webhooks)**.\n\nIf you do not know what webhooks are, [read this article](https://codeburst.io/what-are-webhooks-b04ec2bf9ca2).\n\n**Note**: webhook endpoint URL must be reachable at public Internet level\nand use a valid domain with proper DNS resolution. E.g: https://mycompany.com/webhook\n\nOur system will make an [HTTP request](https://www.tutorialspoint.com/http/http_requests.htm)\nto the remote endpoint URL you provide every time a new message/device event happens.\n\nInformation will be encoded in [JSON](https://www.json.org/) format as part of the HTTP body data.\n\nYour server must accept read the body in the HTTP POST request and process it accodingly.\n\nYou server should reply with a 200-209 HTTP status code. Otherwise, it will be considered as a\nfailed notification and it will be retried.\n\n### Questions\n\nRead the common questions and answers in [this Help Center article](/help/webhooks#questions).\n\n### Security advice\n\nWe strongly recommend to use HTTPS instead of HTTP since communication would be end-to-end encrypted.\n\n### Webhook events\n\nSupported webhook events are:\n\n- **deal:stage:changed**: When a sales funnel deal is moved to another stage (available in the Platform Professional plan and above)\n- **deal:won**: When a sales funnel deal is closed as won (available in the Platform Professional plan and above)\n- **deal:lost**: When a sales funnel deal is closed as lost (available in the Platform Professional plan and above)\n- **deal:assigned**: When a sales funnel deal is assigned to an agent, or unassigned (available in the Platform Professional plan and above)\n- **deal:updated**: When the title or the amount of a sales funnel deal changes (available in the Platform Professional plan and above)\n- **deal:archived**: When a sales funnel deal is archived (available in the Platform Professional plan and above)\n- **deal:reopened**: When a closed or archived sales funnel deal is reopened (available in the Platform Professional plan and above)\n- **message:in:new**: On every new incoming message sent by users or groups to your device (restricted to Platform plans)\n- **message:out:new**: On every outbound message delivered from the connected WhatsApp number to other users (restricted to Platform plans)\n- **message:out:sent**: On every successfully delivered message (restricted to Gateway plans)\n- **message:out:ack**: On every outbound message status update: received or read by the user (restricted to Platform Business and Enterprise plans)\n- **message:update**: Notify when an existing message content is updated: on new poll votes, on event attendance confirmation or cancelation, on message edit\n- **message:reaction**: Notify when a message reaction is added or removed. Only supported in the Business and Enterprise plans\n- **message:flow:response**: Notify when a customer completes a WhatsApp Form (Meta WhatsApp Flow), with the cleaned answers, the form and what sent it. Only for WhatsApp Business API numbers\n- **status:update**: On every new user status story publication made by any your saved contacts\n- **channel:in**: On every newly received message on any channel you are following\n- **message:out:failed**: On every failed message delivery (max retries exceeded, invalid media or phone number not found)\n- **number:session**: Notified when the number WhatsApp session goes online, offline or disconnects\n- **group:update**: On every group update: new group, name change, subject change, participant added or removed, participant promoted or demoted, group settings change\n- **chat:update**: On every chat update: chat status changes, chat is assigned or unassigned, chat is resolved or unresolved, chat is archived, chat is removed\n- **contact:update**: On every contact update: information or metadata is updated\n\nFind below more details and JSON examples for the different webhook events.\n\n### Webhook examples\n\nExplore dozens of webhook events JSON payload examples and real use cases in [the Help Center article](/help/webhooks#examples).\n\n#### New inbound message event\n\n**Event**: `message:in:new`\n\nNote: this event type is only available in Platform plans. Find below for Gateway plans specific webhook events.\n\n**Example of new inbound text message webhook event (JSON payload)**\n\n<details>\n  <summary>Click to show the JSON payload example</summary>\n\n```json\n{\n  \"id\": \"3EB03EBAF8863B70BA00AF\",\n  \"object\": \"message\",\n  \"event\": \"message:in:new\",\n  \"created\": 1671225190,\n  \"device\": {\n      \"id\": \"61b37a069cba0c15d6c89757\",\n      \"phone\": \"+4412345678\",\n      \"alias\": \"Demo\",\n      \"plan\": \"io-enterprise\",\n      \"version\": 1\n  },\n  \"data\": {\n      \"id\": \"3EB03EBAF8863B70BA00AF\",\n      \"type\": \"text\",\n      \"flow\": \"inbound\",\n      \"status\": \"active\",\n      \"ack\": \"delivered\",\n      \"from\": \"+4412345678@c.us\",\n      \"fromNumber\": \"+4412345678\",\n      \"to\": \"1234567890@c.us\",\n      \"toNumber\": \"+1234567890\",\n      \"date\": \"2022-12-15T20:00:00.000Z\",\n      \"timestamp\": 1671225190,\n      \"body\": \"This is a sample inbound text message webhook event\",\n      \"chat\": {\n          \"id\": \"1234567890@c.us\",\n          \"name\": \"John Wick\",\n          \"date\": \"2022-12-15T20:00:00.000Z\",\n          \"type\": \"chat\",\n          \"status\": \"active\",\n          \"waStatus\": \"active\",\n          \"statusUpdatedAt\": \"2022-08-23T08:40:45.722Z\",\n          \"deletedAt\": \"2022-08-24T13:28:25.033Z\",\n          \"firstMessageAt\": \"2022-08-19T10:59:08.000Z\",\n          \"lastMessageAt\": \"2022-12-15T20:00:00.000Z\",\n          \"lastOutboundMessageAt\": \"2022-12-15T20:00:00.000Z\",\n          \"lastInboundMessageAt\": \"2022-12-15T22:00:00.000Z\",\n          \"lastReactionAt\": \"2022-12-15T03:00:13.662Z\",\n          \"lastReactionEmoji\": \"👍\",\n          \"stats\": {\n              \"notes\": 0,\n              \"localMessages\": 53,\n              \"inboundMessages\": 0,\n              \"outboundMessages\": 0\n          },\n          \"labels\": [\n              \"sales\",\n              \"new-customer\"\n          ],\n          \"owner\": {\n              \"agent\": \"5f71e36254800f533ab79148\",\n              \"assigner\": \"5f71e36254800f533ab79148\",\n              \"assignedAt\": \"2022-11-15T23:53:00.439Z\"\n          },\n          \"contact\": {\n              \"wid\": \"1234567890@c.us\",\n              \"name\": \"John\",\n              \"shortName\": \"Wick\",\n              \"displayName\": \"John Wick\",\n              \"formattedName\": \"John Wick\",\n              \"formattedShortName\": \"John Wick\",\n              \"syncedAt\": \"2022-12-16T21:47:03.206Z\",\n              \"phone\": \"+1234567890\",\n              \"image\": {\n                  \"url\": \"https://pps.whatsapp.net/v/t61.1111-1/1234567_1234567_1234567_n.jpg?oe=1234567&oh=123456712345671234567\"\n              }\n          }\n      },\n      \"events\": {\n          \"sent\": {\n              \"date\": \"2022-12-15T20:00:00.000Z\"\n          }\n      },\n      \"meta\": {\n          \"rtl\": false,\n          \"containsEmoji\": false,\n          \"isGif\": false,\n          \"isStar\": false,\n          \"isGroup\": false,\n          \"isForwarded\": false,\n          \"isEphemeral\": false,\n          \"isNotification\": false,\n          \"isLive\": false,\n          \"isBroadcast\": false,\n          \"isBizNotification\": false,\n          \"isDoc\": false,\n          \"isLinkPreview\": false,\n          \"isPSA\": false,\n          \"isRevoked\": false,\n          \"isUnreadType\": false,\n          \"isFailed\": false,\n          \"notifyName\": \"Support Team\",\n          \"source\": \"android\"\n      }\n  }\n}\n```\n\n</details>\n\n**Example of new inbound media message webhook event (JSON payload)**\n\n<details>\n  <summary>Click to show the JSON payload example</summary>\n\n```json\n{\n  \"id\": \"3EB03EBAF8863B70BA001A\",\n  \"object\": \"message\",\n  \"event\": \"message:out:new\",\n  \"created\": 1671225190,\n  \"device\": {\n      \"id\": \"61b37a069cba0c15d6c89757\",\n      \"phone\": \"+4412345678\",\n      \"alias\": \"Demo\",\n      \"plan\": \"io-enterprise\",\n      \"version\": 1\n  },\n  \"data\": {\n      \"id\": \"3EB03EBAF8863B70BA001A\",\n      \"type\": \"image\",\n      \"flow\": \"outbound\",\n      \"status\": \"active\",\n      \"ack\": \"delivered\",\n      \"from\": \"+4412345678@c.us\",\n      \"fromNumber\": \"+4412345678\",\n      \"to\": \"1234567890@c.us\",\n      \"toNumber\": \"+1234567890\",\n      \"date\": \"2022-12-15T20:00:00.000Z\",\n      \"timestamp\": 1671225190,\n      \"body\": \"This is a sample inbound image message webhook event\",\n      \"chat\": {\n          \"id\": \"1234567890@c.us\",\n          \"name\": \"Mike\",\n          \"date\": \"2022-12-15T20:00:00.000Z\",\n          \"type\": \"chat\",\n          \"status\": \"active\",\n          \"waStatus\": \"active\",\n          \"statusUpdatedAt\": \"2022-08-23T08:40:45.722Z\",\n          \"deletedAt\": \"2022-08-24T13:28:25.033Z\",\n          \"firstMessageAt\": \"2022-08-19T10:59:08.000Z\",\n          \"lastMessageAt\": \"2022-12-15T20:00:00.000Z\",\n          \"lastOutboundMessageAt\": \"2022-12-15T20:00:00.000Z\",\n          \"lastInboundMessageAt\": \"2022-12-15T22:00:00.000Z\",\n          \"lastReactionAt\": \"2022-12-15T03:00:13.662Z\",\n          \"lastReactionEmoji\": \"👍\",\n          \"stats\": {\n              \"notes\": 0,\n              \"localMessages\": 53,\n              \"inboundMessages\": 0,\n              \"outboundMessages\": 0\n          },\n          \"labels\": [\n              \"sales\",\n              \"new-customer\"\n          ],\n          \"owner\": {\n              \"agent\": \"5f71e36254800f533ab79148\",\n              \"assigner\": \"5f71e36254800f533ab79148\",\n              \"assignedAt\": \"2022-11-15T23:53:00.439Z\"\n          },\n          \"contact\": {\n              \"wid\": \"1234567890@c.us\",\n              \"name\": \"Mike\",\n              \"shortName\": \"Mike\",\n              \"displayName\": \"Mike\",\n              \"formattedName\": \"Mike\",\n              \"formattedShortName\": \"Mike\",\n              \"syncedAt\": \"2022-12-16T21:47:03.206Z\",\n              \"phone\": \"+1234567890\",\n              \"image\": {\n                  \"url\": \"https://pps.whatsapp.net/v/t61.1111-1/1234567_1234567_1234567_n.jpg?oe=1234567&oh=123456712345671234567\"\n              }\n          }\n      },\n      \"media\": {\n          \"id\": \"639ce7571e6e11586eb6ccb6\",\n          \"message\": \"3EB03EBAF8863B70BA00\",\n          \"chat\": \"1234567890@c.us\",\n          \"flow\": \"out\",\n          \"status\": \"available\",\n          \"caption\": null,\n          \"type\": \"image\",\n          \"size\": 196851,\n          \"mime\": \"image/jpeg\",\n          \"extension\": \"jpeg\",\n          \"filename\": \"image_out_4412345678@c.us_3EB03EBAF8863B70BA00.jpeg\",\n          \"createdAt\": \"2022-12-16T21:47:03.814Z\",\n          \"expiresAt\": \"2022-12-23T21:47:03.809Z\",\n          \"meta\": {\n              \"hasPreview\": true,\n              \"aspectRatio\": 0.75\n          },\n          \"stats\": {\n              \"downloads\": 0\n          },\n          \"preview\": {\n              \"image\": \"iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAApgAAAKYB3X3=\",\n              \"width\": 47,\n              \"height\": 63,\n              \"mime\": \"image/jpeg\"\n          },\n          \"links\": {\n              \"resource\": \"/v1/chat/61b37a069cba0c15d6c89757/files/639ce7571e6e11586eb6ccb6\",\n              \"download\": \"/v1/chat/61b37a069cba0c15d6c89757/files/639ce7571e6e11586eb6ccb6/download\",\n              \"chat\": \"/v1/chat/61b37a069cba0c15d6c89757/chats/1234567890@c.us\",\n              \"contact\": \"/v1/chat/61b37a069cba0c15d6c89757/contacts/1234567890@c.us\",\n              \"message\": \"/v1/chat/61b37a069cba0c15d6c89757/messages/3EB03EBAF8863B70BA00\"\n          }\n      },\n      \"events\": {\n          \"sent\": {\n              \"date\": \"2022-12-15T20:00:00.000Z\"\n          }\n      },\n      \"meta\": {\n          \"rtl\": false,\n          \"containsEmoji\": false,\n          \"isGif\": false,\n          \"isStar\": false,\n          \"isGroup\": false,\n          \"isForwarded\": false,\n          \"isEphemeral\": false,\n          \"isNotification\": false,\n          \"isLive\": false,\n          \"isBroadcast\": false,\n          \"isBizNotification\": false,\n          \"isDoc\": false,\n          \"isLinkPreview\": false,\n          \"isPSA\": false,\n          \"isRevoked\": false,\n          \"isUnreadType\": false,\n          \"isFailed\": false,\n          \"notifyName\": \"Support Team\"\n      }\n  }\n}\n```\n\n</details>\n\n#### New outbound message event\n\nEvent: `message:out:new`\n\nNote: this event type is only available in Platform plans. Find below for Gateway plans specific webhook events.\n\n**Example of new outbound text message webhook event (JSON payload)**\n\n<details>\n  <summary>Click to show the JSON payload example</summary>\n\n```json\n{\n  \"id\": \"3EB004B1D010CA0EF6A201\",\n  \"object\": \"message\",\n  \"event\": \"message:out:new\",\n  \"created\": 1671220018,\n  \"device\": {\n      \"id\": \"61b37a069cba0c15d6c89757\",\n      \"phone\": \"+44123456789\",\n      \"alias\": \"Demo-2\",\n      \"plan\": \"io-enterprise\",\n      \"version\": 1\n  },\n  \"data\": {\n      \"id\": \"3EB004B1D010CA0EF6A201\",\n      \"type\": \"text\",\n      \"flow\": \"outbound\",\n      \"status\": \"active\",\n      \"ack\": \"delivered\",\n      \"agent\": \"5f71e36254800f533ab79148\",\n      \"from\": \"44123456789@c.us\",\n      \"fromNumber\": \"+44123456789\",\n      \"to\": \"1234567890@c.us\",\n      \"toNumber\": \"+1234567890\",\n      \"date\": \"2022-12-15T22:00:00.000Z\",\n      \"timestamp\": 1671220018,\n      \"body\": \"Hello! This is a sample outbound text message webhook event\",\n      \"chat\": {\n          \"id\": \"1234567890@c.us\",\n          \"name\": \"John\",\n          \"date\": \"2022-12-15T22:00:00.000Z\",\n          \"type\": \"chat\",\n          \"status\": \"active\",\n          \"waStatus\": \"active\",\n          \"statusUpdatedAt\": \"2022-08-23T08:40:45.722Z\",\n          \"deletedAt\": \"2022-08-24T13:28:25.033Z\",\n          \"firstMessageAt\": \"2022-08-19T10:59:08.000Z\",\n          \"lastMessageAt\": \"2022-12-15T22:06:32.000Z\",\n          \"lastOutboundMessageAt\": \"2022-12-15T22:06:32.000Z\",\n          \"lastInboundMessageAt\": \"2022-12-15T22:02:58.000Z\",\n          \"lastReactionAt\": \"2022-12-15T03:39:03.000Z\",\n          \"lastReactionEmoji\": \"👍\",\n          \"stats\": {\n              \"notes\": 0,\n              \"localMessages\": 234,\n              \"inboundMessages\": 0,\n              \"outboundMessages\": 0\n          },\n          \"labels\": [\n              \"sales\",\n              \"customer\"\n          ],\n          \"owner\": {\n              \"agent\": \"5f71e36254800f533ab79148\",\n              \"assigner\": \"5f71e36254800f533ab79148\",\n              \"assignedAt\": \"2022-11-15T23:53:00.439Z\"\n          },\n          \"contact\": {\n              \"wid\": \"1234567890@c.us\",\n              \"name\": \"John\",\n              \"shortName\": \"John\",\n              \"displayName\": \"John\",\n              \"formattedName\": \"John\",\n              \"formattedShortName\": \"John\",\n              \"syncedAt\": \"2022-12-15T22:06:32.952Z\",\n              \"phone\": \"+1234567890\",\n              \"image\": {\n                  \"url\": \"https://pps.whatsapp.net/v/t61.123456-24/12345678_00011112222233334444_100135239294920312_n.jpg\"\n              }\n          }\n      },\n      \"events\": {\n          \"sent\": {\n              \"date\": \"2022-12-15T22:06:33.108Z\"\n          }\n      },\n      \"meta\": {\n          \"rtl\": false,\n          \"containsEmoji\": false,\n          \"isGif\": false,\n          \"isStar\": false,\n          \"isGroup\": false,\n          \"isForwarded\": false,\n          \"isEphemeral\": false,\n          \"isNotification\": false,\n          \"isLive\": false,\n          \"isBroadcast\": false,\n          \"isBizNotification\": false,\n          \"isDoc\": false,\n          \"isLinkPreview\": false,\n          \"isPSA\": false,\n          \"isRevoked\": false,\n          \"isUnreadType\": false,\n          \"isFailed\": false,\n          \"notifyName\": \"Support Team\"\n      }\n  }\n}\n```\n\n</details>\n\n#### Message is received and read by the recipient\n\nEvent: `message:out:ack`\n\nNote: this event type is only available in Platform plans. Find below for Gateway plans specific webhook events.\n\n**Example of new outbound text message webhook event (JSON payload)**\n\n<details>\n  <summary>Click to show the JSON payload example</summary>\n\n```json\n{\n  \"id\": \"3EB004B1D010CA0EF6A205\",\n  \"object\": \"message\",\n  \"event\": \"message:out:ack\",\n  \"created\": 1671220018,\n  \"ack\": \"read\",\n  \"device\": {\n      \"id\": \"61b37a069cba0c15d6c89757\",\n      \"phone\": \"+44123456789\",\n      \"alias\": \"Demo\",\n      \"plan\": \"io-enterprise\",\n      \"version\": 1\n  },\n  \"data\": {\n      \"id\": \"3EB004B1D010CA0EF6A205\",\n      \"type\": \"text\",\n      \"flow\": \"outbound\",\n      \"status\": \"active\",\n      \"ack\": \"read\",\n      \"from\": \"44123456789@c.us\",\n      \"fromNumber\": \"+44123456789\",\n      \"to\": \"1234567890@c.us\",\n      \"toNumber\": \"+1234567890\",\n      \"date\": \"2022-12-15T20:00:00.000Z\",\n      \"timestamp\": 1671220018,\n      \"body\": \"This is a sample message read ack webhook event\",\n      \"chat\": {\n          \"id\": \"1234567890@c.us\",\n          \"name\": \"John\",\n          \"date\": \"2022-12-15T21:00:00.000Z\",\n          \"type\": \"chat\",\n          \"status\": \"active\",\n          \"waStatus\": \"active\",\n          \"statusUpdatedAt\": \"2022-08-23T08:40:45.722Z\",\n          \"deletedAt\": \"2022-08-24T13:28:25.033Z\",\n          \"firstMessageAt\": \"2022-08-19T10:59:08.000Z\",\n          \"lastMessageAt\": \"2022-12-16T21:25:38.000Z\",\n          \"lastOutboundMessageAt\": \"2022-12-16T21:25:38.000Z\",\n          \"lastInboundMessageAt\": \"2022-12-15T22:02:58.000Z\",\n          \"lastReactionAt\": \"2022-12-15T03:43:13.662Z\",\n          \"lastReactionEmoji\": \"👍\",\n          \"stats\": {\n              \"notes\": 0,\n              \"localMessages\": 52,\n              \"inboundMessages\": 0,\n              \"outboundMessages\": 0\n          },\n          \"labels\": [\n              \"sales\",\n              \"new-customer\"\n          ],\n          \"owner\": {\n              \"agent\": \"5f71e36254800f533ab79148\",\n              \"assigner\": \"5f71e36254800f533ab79148\",\n              \"assignedAt\": \"2022-11-15T23:53:00.439Z\"\n          },\n          \"contact\": {\n              \"wid\": \"1234567890@c.us\",\n              \"name\": \"John\",\n              \"shortName\": \"John\",\n              \"displayName\": \"John\",\n              \"formattedName\": \"John\",\n              \"formattedShortName\": \"John\",\n              \"syncedAt\": \"2022-12-16T21:26:37.821Z\",\n              \"phone\": \"+1234567890\",\n              \"image\": {\n                  \"url\": \"https://pps.whatsapp.net/v/t61.123456-24/12345678_00011112222233334444_100135239294920312_n.jpg\"\n              }\n          }\n      },\n      \"events\": {\n          \"sent\": {\n              \"date\": \"2022-12-16T21:26:43.215Z\"\n          },\n          \"delivered\": {\n              \"date\": \"2022-12-16T21:26:43.216Z\"\n          }\n      },\n      \"meta\": {\n          \"rtl\": false,\n          \"containsEmoji\": false,\n          \"isGif\": false,\n          \"isStar\": false,\n          \"isGroup\": false,\n          \"isForwarded\": false,\n          \"isEphemeral\": false,\n          \"isNotification\": false,\n          \"isLive\": false,\n          \"isBroadcast\": false,\n          \"isBizNotification\": false,\n          \"isDoc\": false,\n          \"isLinkPreview\": false,\n          \"isPSA\": false,\n          \"isRevoked\": false,\n          \"isUnreadType\": false,\n          \"isFailed\": false,\n          \"notifyName\": \"Support Team\"\n      }\n  }\n}\n```\n\n</details>\n\n#### Message sent event (Gateway plans only)\n\n**Important**: the following webhooks events are only available in Gateway plans and are deprecated in other plans.\n\nIf you are using a different plan, use the following webhook event instead:\n\n- Use `message:out:new` instead of `message:out:sent`\n\nThis event uses a JSON payload data that is structured as an array of objects, thus multiple messages can be notified in the same HTTP POST request, up to 25 items per notification.\n\n**Example JSON payload data structure**\n\n<details>\n  <summary>Click to show the JSON payload example</summary>\n\n```json\n[\n  {\n    \"event\": \"<event type>\",\n    \"date\": \"2022-12-08T15:01:48.518Z\",\n    \"entity\": \"message\",\n    \"entityId\": \"<Message ID>\",\n    \"entityUrl\": \"https://api.domain.com/v1/messages/<Message ID>\",\n    \"user\": \"<User ID>\",\n    \"data\": { ... }\n  },\n  {\n    \"event\": \"<event type>\",\n    \"date\": \"2022-12-08T15:01:48.518Z\",\n    \"entity\": \"message\",\n    \"entityId\": \"<Message ID>\",\n    \"entityUrl\": \"https://api.domain.com/v1/messages/<Message ID>\",\n    \"user\": \"<User ID>\",\n    \"data\": { ... }\n  },\n  ...\n]\n```\n\n</details>\n\n**Example of a JSON POST body for a specific message sent event**\n\n<details>\n  <summary>Click to show the JSON payload example</summary>\n\n```json\n[\n  {\n    \"event\": \"message:out:sent\",\n    \"date\": \"2018-12-08T15:01:48.518Z\",\n    \"entity\": \"message\",\n    \"entityId\": \"5bf612faa893b00016c0f13d\",\n    \"entityUrl\": \"https://api.domain.com/v1/messages/5bf612faa893b00016c0f13d\",\n    \"user\": \"5bd75ab235623e00162a73dc\",\n    \"data\": {\n      \"id\": \"5bf612faa893b00016c0f13d\",\n      \"phone\": \"+1234567890\",\n      \"status\": \"processed\",\n      \"deliveryStatus\": \"delivered\",\n      \"createdAt\": \"2022-11-22T02:22:50.955Z\",\n      \"sentAt\": \"2022-11-22T02:29:29.254Z\",\n      \"failedAt\": null,\n      \"processedAt\": \"2022-11-22T02:28:54.818Z\",\n      \"webhookStatus\": \"pending\",\n      \"message\": \"This is an automated message sent from waplatform API\",\n      \"priority\": \"normal\",\n      \"schedule\": {\n        \"enabled\": false\n      },\n      \"retry\": {\n        \"count\": 1,\n        \"lastRetryAt\": \"2022-11-22T02:25:58.414Z\"\n      },\n      \"device\": {\n        \"id\": \"3bf5d1ff2ff2bd001696ac42\",\n        \"phone\": \"+1234567890\",\n        \"alias\": \"My WA Delivery Device\",\n        \"description\": \"Device 1 for customer support and product notifications\",\n        \"status\": \"verified\",\n        \"session\": {\n          \"status\": \"online\",\n          \"error\": false,\n          \"lastSyncAt\": \"2018-12-02T10:11:16.008Z\"\n        },\n        \"createdAt\": \"2018-11-20T09:21:03.898Z\",\n        \"queue\": {\n          \"total\": 100,\n          \"size\": 0,\n          \"available\": 100\n        },\n        \"profile\": {\n          \"name\": \"+1234567890\",\n          \"info\": null,\n          \"lastSyncAt\": \"2022-11-22T22:14:33.334Z\",\n          \"imagePath\": \"/v1/devices/3bf5d1ff2ff2bd001696ac42/profile/image\"\n        },\n        \"links\": {\n          \"device\": {\n            \"method\": \"GET\",\n            \"url\": \"https://api.domain.com/v1/devices/3bf5d1ff2ff2bd001696ac42\"\n          },\n          \"scan\": {\n            \"method\": \"GET\",\n            \"url\": \"https://api.domain.com/v1/devices/3bf5d1ff2ff2bd001696ac42/scan\"\n          },\n          \"sync\": {\n            \"method\": \"GET\",\n            \"url\": \"https://api.domain.com/v1/devices/3bf5d1ff2ff2bd001696ac42/sync\"\n          },\n          \"health\": {\n            \"method\": \"GET\",\n            \"url\": \"https://api.domain.com/v1/devices/3bf5d1ff2ff2bd001696ac42/health\"\n          },\n          \"profileImage\": {\n            \"method\": \"GET\",\n            \"url\": \"https://api.domain.com/v1/devices/3bf5d1ff2ff2bd001696ac42/profile/image\"\n          },\n          \"messages\": {\n            \"method\": \"GET\",\n            \"url\": \"https://api.domain.com/v1/messages?devices=3bf5d1ff2ff2bd001696ac42\"\n          }\n        },\n        \"stats\": {\n          \"total\": {\n            \"sent\": 565,\n            \"failed\": 103,\n            \"media\": 0,\n            \"totalUpstreamSize\": 0,\n            \"totalDeliveryTime\": 13331,\n            \"totalUpstreamSpeed\": 0\n          },\n          \"minutes\": {\n            \"sent\": 4,\n            \"failed\": 0,\n            \"media\": 0,\n            \"totalUpstreamSize\": 0,\n            \"totalDeliveryTime\": 48,\n            \"totalUpstreamSpeed\": 0\n          },\n          \"quarter\": {\n            \"sent\": 4,\n            \"failed\": 0,\n            \"media\": 0,\n            \"totalUpstreamSize\": 0,\n            \"totalDeliveryTime\": 48,\n            \"totalUpstreamSpeed\": 0\n          },\n          \"hour\": {\n            \"sent\": 10,\n            \"failed\": 1,\n            \"media\": 0,\n            \"totalUpstreamSize\": 0,\n            \"totalDeliveryTime\": 114,\n            \"totalUpstreamSpeed\": 0\n          },\n          \"day\": {\n            \"sent\": 10,\n            \"failed\": 1,\n            \"media\": 0,\n            \"totalUpstreamSize\": 0,\n            \"totalDeliveryTime\": 114,\n            \"totalUpstreamSpeed\": 0\n          },\n          \"week\": {\n            \"sent\": 10,\n            \"failed\": 1,\n            \"media\": 0,\n            \"totalUpstreamSize\": 0,\n            \"totalDeliveryTime\": 114,\n            \"totalUpstreamSpeed\": 0\n          },\n          \"month\": {\n            \"sent\": 565,\n            \"failed\": 103,\n            \"media\": 0,\n            \"totalUpstreamSize\": 0,\n            \"totalDeliveryTime\": 13331,\n            \"totalUpstreamSpeed\": 0\n          },\n          \"year\": {\n            \"sent\": 565,\n            \"failed\": 103,\n            \"media\": 0,\n            \"totalUpstreamSize\": 0,\n            \"totalDeliveryTime\": 13331,\n            \"totalUpstreamSpeed\": 0\n          }\n        }\n      }\n    }\n  }\n]\n```\n\n</details>\n\n#### Message delivery failed event\n\nEvent: `message:out:failed`\n\nThis event uses a JSON payload data that is structured as an array of objects, thus multiple messages can be notified in the same HTTP POST request, up to 25 items per notification.\n\n<details>\n  <summary>Click to show the JSON payload example</summary>\n\n```json\n[\n  {\n    \"event\": \"<event type>\",\n    \"date\": \"2022-12-08T15:01:48.518Z\",\n    \"entity\": \"message\",\n    \"entityId\": \"<Message ID>\",\n    \"entityUrl\": \"https://api.domain.com/v1/messages/<Message ID>\",\n    \"user\": \"<User ID>\",\n    \"data\": { ... }\n  },\n  {\n    \"event\": \"<event type>\",\n    \"date\": \"2022-12-08T15:01:48.518Z\",\n    \"entity\": \"message\",\n    \"entityId\": \"<Message ID>\",\n    \"entityUrl\": \"https://api.domain.com/v1/messages/<Message ID>\",\n    \"user\": \"<User ID>\",\n    \"data\": { ... }\n  },\n  ...\n]\n```\n\n</details>\n\n**Example of a JSON POST body for a message failed webhook event**\n\n<details>\n  <summary>Click to show the JSON payload example</summary>\n\n```json\n[\n  {\n    \"event\": \"message:out:failed\",\n    \"date\": \"2018-12-08T15:01:48.518Z\",\n    \"entity\": \"message\",\n    \"entityId\": \"5bf612faa893b00016c0f13d\",\n    \"entityUrl\": \"https://api.domain.com/v1/messages/5bf612faa893b00016c0f13d\",\n    \"user\": \"5bd75ab235623e00162a73dc\",\n    \"data\": {\n      \"id\": \"5bf612faa893b00016c0f13d\",\n      \"phone\": \"+1234567890\",\n      \"status\": \"failed\",\n      \"deliveryStatus\": \"failed\",\n      \"createdAt\": \"2022-11-22T02:22:50.955Z\",\n      \"sentAt\": \"2022-11-22T02:29:29.254Z\",\n      \"failedAt\": null,\n      \"processedAt\": \"2022-11-22T02:28:54.818Z\",\n      \"webhookStatus\": \"pending\",\n      \"message\": \"This is an automated message sent from the API\",\n      \"priority\": \"normal\",\n      \"schedule\": {\n        \"enabled\": false\n      },\n      \"retry\": {\n        \"count\": 1,\n        \"lastRetryAt\": \"2022-11-22T02:25:58.414Z\"\n      },\n      \"device\": {\n        \"id\": \"3bf5d1ff2ff2bd001696ac42\",\n        \"phone\": \"+1234567890\",\n        \"alias\": \"My WA Delivery Device\",\n        \"description\": \"Device 1 for customer support and product notifications\",\n        \"status\": \"verified\",\n        \"session\": {\n          \"status\": \"online\",\n          \"error\": false,\n          \"lastSyncAt\": \"2022-12-02T10:11:16.008Z\"\n        },\n        \"createdAt\": \"2022-11-20T09:21:03.898Z\",\n        \"queue\": {\n          \"total\": 100,\n          \"size\": 0,\n          \"available\": 100\n        },\n        \"profile\": {\n          \"name\": \"+1234567890\",\n          \"info\": null,\n          \"lastSyncAt\": \"2022-11-22T22:14:33.334Z\",\n          \"imagePath\": \"/v1/devices/3bf5d1ff2ff2bd001696ac42/profile/image\"\n        },\n        \"links\": {\n          \"device\": {\n            \"method\": \"GET\",\n            \"url\": \"https://api.domain.com/v1/devices/3bf5d1ff2ff2bd001696ac42\"\n          },\n          \"scan\": {\n            \"method\": \"GET\",\n            \"url\": \"https://api.domain.com/v1/devices/3bf5d1ff2ff2bd001696ac42/scan\"\n          },\n          \"sync\": {\n            \"method\": \"GET\",\n            \"url\": \"https://api.domain.com/v1/devices/3bf5d1ff2ff2bd001696ac42/sync\"\n          },\n          \"health\": {\n            \"method\": \"GET\",\n            \"url\": \"https://api.domain.com/v1/devices/3bf5d1ff2ff2bd001696ac42/health\"\n          },\n          \"profileImage\": {\n            \"method\": \"GET\",\n            \"url\": \"https://api.domain.com/v1/devices/3bf5d1ff2ff2bd001696ac42/profile/image\"\n          },\n          \"messages\": {\n            \"method\": \"GET\",\n            \"url\": \"https://api.domain.com/v1/messages?devices=3bf5d1ff2ff2bd001696ac42\"\n          }\n        },\n        \"stats\": {\n          \"total\": {\n            \"sent\": 565,\n            \"failed\": 103,\n            \"media\": 0,\n            \"totalUpstreamSize\": 0,\n            \"totalDeliveryTime\": 13331,\n            \"totalUpstreamSpeed\": 0\n          },\n          \"minutes\": {\n            \"sent\": 4,\n            \"failed\": 0,\n            \"media\": 0,\n            \"totalUpstreamSize\": 0,\n            \"totalDeliveryTime\": 48,\n            \"totalUpstreamSpeed\": 0\n          },\n          \"quarter\": {\n            \"sent\": 4,\n            \"failed\": 0,\n            \"media\": 0,\n            \"totalUpstreamSize\": 0,\n            \"totalDeliveryTime\": 48,\n            \"totalUpstreamSpeed\": 0\n          },\n          \"hour\": {\n            \"sent\": 10,\n            \"failed\": 1,\n            \"media\": 0,\n            \"totalUpstreamSize\": 0,\n            \"totalDeliveryTime\": 114,\n            \"totalUpstreamSpeed\": 0\n          },\n          \"day\": {\n            \"sent\": 10,\n            \"failed\": 1,\n            \"media\": 0,\n            \"totalUpstreamSize\": 0,\n            \"totalDeliveryTime\": 114,\n            \"totalUpstreamSpeed\": 0\n          },\n          \"week\": {\n            \"sent\": 10,\n            \"failed\": 1,\n            \"media\": 0,\n            \"totalUpstreamSize\": 0,\n            \"totalDeliveryTime\": 114,\n            \"totalUpstreamSpeed\": 0\n          },\n          \"month\": {\n            \"sent\": 565,\n            \"failed\": 103,\n            \"media\": 0,\n            \"totalUpstreamSize\": 0,\n            \"totalDeliveryTime\": 13331,\n            \"totalUpstreamSpeed\": 0\n          },\n          \"year\": {\n            \"sent\": 565,\n            \"failed\": 103,\n            \"media\": 0,\n            \"totalUpstreamSize\": 0,\n            \"totalDeliveryTime\": 13331,\n            \"totalUpstreamSpeed\": 0\n          }\n        }\n      }\n    }\n  }\n]\n```\n\n</details>\n\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fwebhooks&method=POST&body=%7B%0A%20%20%22name%22%3A%20%22My%20webhook%20server%22%2C%0A%20%20%22url%22%3A%20%22http%3A%2F%2Fwebhooks.company.com%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"createWebhook","security":[{"apiKey":[]}],"tags":["Webhooks"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"webhook","schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":30,"description":"Webhook internal name for your reference"},"device":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Restrict webhook events to specific a device. Pass the device ID here (24 alphanumeric characters)."},"url":{"type":"string","minLength":6,"maxLength":500,"description":"Webhook endpoint URL. Must be a valid URL with http or https scheme that is reachable from the Internet. Local or private networks IPs or domains are not allowed."},"events":{"type":"array","items":{"type":"string","enum":["message:in:new","message:out:new","message:out:sent","message:out:ack","message:out:failed","channel:in","message:update","status:update","message:reaction","message:flow:response","group:update","chat:update","contact:update","number:session","deal:stage:changed","deal:won","deal:lost","deal:assigned","deal:updated","deal:archived","deal:reopened"]},"minItems":1,"maxItems":21,"description":"Event or events to be notified on this webhook endpoint. See the events description above for more information."}},"required":["name","url","events"],"additionalProperties":false}}],"responses":{"201":{"description":"Webhook key created","schema":{"$ref":"#/definitions/webhook"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Create new webhooks endpoint\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/webhooks \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"name\":\"My webhook server\",\"url\":\"http://webhooks.company.com\"}'\n\n\n// Create new webhooks endpoint that accepts only certain events\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/webhooks \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"name\":\"My webhook server\",\"url\":\"http://webhooks.company.com\",\"events\":[\"message:out:sent\",\"message:out:failed\"]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Create new webhooks endpoint\necho '{\"name\":\"My webhook server\",\"url\":\"http://webhooks.company.com\"}' |  \\\n  http POST https://api.wassenger.com/v1/webhooks \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Create new webhooks endpoint that accepts only certain events\necho '{\"name\":\"My webhook server\",\"url\":\"http://webhooks.company.com\",\"events\":[\"message:out:sent\",\"message:out:failed\"]}' |  \\\n  http POST https://api.wassenger.com/v1/webhooks \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Create new webhooks endpoint\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/webhooks';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"My webhook server\",\"url\":\"http://webhooks.company.com\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Create new webhooks endpoint that accepts only certain events\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/webhooks';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"My webhook server\",\"url\":\"http://webhooks.company.com\",\"events\":[\"message:out:sent\",\"message:out:failed\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Create new webhooks endpoint\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/webhooks',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {name: 'My webhook server', url: 'http://webhooks.company.com'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Create new webhooks endpoint that accepts only certain events\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/webhooks',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    name: 'My webhook server',\n    url: 'http://webhooks.company.com',\n    events: ['message:out:sent', 'message:out:failed']\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Create new webhooks endpoint\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/webhooks');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  name: 'My webhook server',\n  url: 'http://webhooks.company.com'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Create new webhooks endpoint that accepts only certain events\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/webhooks');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  name: 'My webhook server',\n  url: 'http://webhooks.company.com',\n  events: [\n    'message:out:sent',\n    'message:out:failed'\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Create new webhooks endpoint\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/webhooks', [\n  'body' => '{\"name\":\"My webhook server\",\"url\":\"http://webhooks.company.com\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Create new webhooks endpoint that accepts only certain events\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/webhooks', [\n  'body' => '{\"name\":\"My webhook server\",\"url\":\"http://webhooks.company.com\",\"events\":[\"message:out:sent\",\"message:out:failed\"]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Create new webhooks endpoint\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'name' => 'My webhook server',\n  'url' => 'http://webhooks.company.com'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/webhooks');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Create new webhooks endpoint that accepts only certain events\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'name' => 'My webhook server',\n  'url' => 'http://webhooks.company.com',\n  'events' => [\n    'message:out:sent',\n    'message:out:failed'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/webhooks');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Create new webhooks endpoint\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/webhooks\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'name' => 'My webhook server',\n    'url' => 'http://webhooks.company.com'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Create new webhooks endpoint that accepts only certain events\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/webhooks\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'name' => 'My webhook server',\n    'url' => 'http://webhooks.company.com',\n    'events' => [\n        'message:out:sent',\n        'message:out:failed'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Create new webhooks endpoint\nimport requests\n\nurl = \"https://api.wassenger.com/v1/webhooks\"\n\npayload = {\n    \"name\": \"My webhook server\",\n    \"url\": \"http://webhooks.company.com\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Create new webhooks endpoint that accepts only certain events\nimport requests\n\nurl = \"https://api.wassenger.com/v1/webhooks\"\n\npayload = {\n    \"name\": \"My webhook server\",\n    \"url\": \"http://webhooks.company.com\",\n    \"events\": [\"message:out:sent\", \"message:out:failed\"]\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create new webhooks endpoint\nconst url = 'https://api.wassenger.com/v1/webhooks';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"My webhook server\",\"url\":\"http://webhooks.company.com\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Create new webhooks endpoint that accepts only certain events\nconst url = 'https://api.wassenger.com/v1/webhooks';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"My webhook server\",\"url\":\"http://webhooks.company.com\",\"events\":[\"message:out:sent\",\"message:out:failed\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create new webhooks endpoint\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/webhooks',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"name\":\"My webhook server\",\"url\":\"http://webhooks.company.com\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Create new webhooks endpoint that accepts only certain events\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/webhooks',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"name\":\"My webhook server\",\"url\":\"http://webhooks.company.com\",\"events\":[\"message:out:sent\",\"message:out:failed\"]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Create new webhooks endpoint\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/webhooks\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"name\\\":\\\"My webhook server\\\",\\\"url\\\":\\\"http://webhooks.company.com\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Create new webhooks endpoint that accepts only certain events\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/webhooks\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"name\\\":\\\"My webhook server\\\",\\\"url\\\":\\\"http://webhooks.company.com\\\",\\\"events\\\":[\\\"message:out:sent\\\",\\\"message:out:failed\\\"]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Create new webhooks endpoint\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/webhooks\"\n\n\tpayload := strings.NewReader(\"{\\\"name\\\":\\\"My webhook server\\\",\\\"url\\\":\\\"http://webhooks.company.com\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Create new webhooks endpoint that accepts only certain events\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/webhooks\"\n\n\tpayload := strings.NewReader(\"{\\\"name\\\":\\\"My webhook server\\\",\\\"url\\\":\\\"http://webhooks.company.com\\\",\\\"events\\\":[\\\"message:out:sent\\\",\\\"message:out:failed\\\"]}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Create new webhooks endpoint\nvar client = new RestClient(\"https://api.wassenger.com/v1/webhooks\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"name\\\":\\\"My webhook server\\\",\\\"url\\\":\\\"http://webhooks.company.com\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Create new webhooks endpoint that accepts only certain events\nvar client = new RestClient(\"https://api.wassenger.com/v1/webhooks\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"name\\\":\\\"My webhook server\\\",\\\"url\\\":\\\"http://webhooks.company.com\\\",\\\"events\\\":[\\\"message:out:sent\\\",\\\"message:out:failed\\\"]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Create new webhooks endpoint\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/webhooks\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"name\\\":\\\"My webhook server\\\",\\\"url\\\":\\\"http://webhooks.company.com\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Create new webhooks endpoint that accepts only certain events\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/webhooks\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"name\\\":\\\"My webhook server\\\",\\\"url\\\":\\\"http://webhooks.company.com\\\",\\\"events\\\":[\\\"message:out:sent\\\",\\\"message:out:failed\\\"]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Create new webhooks endpoint\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/webhooks\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"name\\\":\\\"My webhook server\\\",\\\"url\\\":\\\"http://webhooks.company.com\\\"}\")\n  .asString();\n\n\n// Create new webhooks endpoint that accepts only certain events\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/webhooks\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"name\\\":\\\"My webhook server\\\",\\\"url\\\":\\\"http://webhooks.company.com\\\",\\\"events\\\":[\\\"message:out:sent\\\",\\\"message:out:failed\\\"]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Create new webhooks endpoint\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"name\\\":\\\"My webhook server\\\",\\\"url\\\":\\\"http://webhooks.company.com\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/webhooks\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Create new webhooks endpoint that accepts only certain events\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"name\\\":\\\"My webhook server\\\",\\\"url\\\":\\\"http://webhooks.company.com\\\",\\\"events\\\":[\\\"message:out:sent\\\",\\\"message:out:failed\\\"]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/webhooks\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Create new webhooks endpoint\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/webhooks\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"name\\\":\\\"My webhook server\\\",\\\"url\\\":\\\"http://webhooks.company.com\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Create new webhooks endpoint that accepts only certain events\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/webhooks\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"name\\\":\\\"My webhook server\\\",\\\"url\\\":\\\"http://webhooks.company.com\\\",\\\"events\\\":[\\\"message:out:sent\\\",\\\"message:out:failed\\\"]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Create new webhooks endpoint\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/webhooks' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"name\":\"My webhook server\",\"url\":\"http://webhooks.company.com\"}'\n\n\n# Create new webhooks endpoint that accepts only certain events\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/webhooks' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"name\":\"My webhook server\",\"url\":\"http://webhooks.company.com\",\"events\":[\"message:out:sent\",\"message:out:failed\"]}'"},{"lang":"ObjC","source":"// Create new webhooks endpoint\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"name\": @\"My webhook server\",\n                              @\"url\": @\"http://webhooks.company.com\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/webhooks\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Create new webhooks endpoint that accepts only certain events\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"name\": @\"My webhook server\",\n                              @\"url\": @\"http://webhooks.company.com\",\n                              @\"events\": @[ @\"message:out:sent\", @\"message:out:failed\" ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/webhooks\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Create new webhooks endpoint\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"name\": \"My webhook server\",\n  \"url\": \"http://webhooks.company.com\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/webhooks\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Create new webhooks endpoint that accepts only certain events\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"name\": \"My webhook server\",\n  \"url\": \"http://webhooks.company.com\",\n  \"events\": [\"message:out:sent\", \"message:out:failed\"]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/webhooks\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/waba/templates/send":{"parameters":[]},"/waba/templates/media":{"parameters":[],"post":{"summary":"Upload template header media","description":"Upload a platform file to Meta via the Resumable Upload API and obtain a file handle.\n\n\n\nThe returned `handle` must be used as `example.headerHandle` when creating a template with an IMAGE, VIDEO or DOCUMENT header.\n\n\n\nSupported media types: JPEG, PNG images, MP4 video and PDF documents.\n\n\n\n**Note**: media handles are tied to the WhatsApp Business Account application and may expire, so they should be used shortly after being generated.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fwaba%2Ftemplates%2Fmedia&method=POST&body=%7B%0A%20%20%22file%22%3A%20%22%3Cfile-id%3E%22%2C%0A%20%20%22waba%22%3A%20%22%3Cwaba-id%3E%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"uploadTemplateMedia","security":[{"apiKey":[]}],"tags":["Templates"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"body","required":true,"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","description":"Platform file ID whose content will be uploaded to Meta"},"waba":{"type":"string","description":"Optional WhatsApp Business Account ID. Defaults to the latest valid connection"}}}}],"responses":{"200":{"description":"Media uploaded successfully","schema":{"type":"object","properties":{"handle":{"type":"string","description":"Meta file handle to use as template example.headerHandle"}}}},"400":{"description":"Invalid request parameters","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"File or WhatsApp Cloud API connection not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Upload a previously created platform file\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/waba/templates/media \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"file\":\"<file-id>\",\"waba\":\"<waba-id>\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Upload a previously created platform file\necho '{\"file\":\"<file-id>\",\"waba\":\"<waba-id>\"}' |  \\\n  http POST https://api.wassenger.com/v1/waba/templates/media \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Upload a previously created platform file\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/waba/templates/media';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"file\":\"<file-id>\",\"waba\":\"<waba-id>\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Upload a previously created platform file\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/waba/templates/media',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {file: '<file-id>', waba: '<waba-id>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Upload a previously created platform file\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/waba/templates/media');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  file: '<file-id>',\n  waba: '<waba-id>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Upload a previously created platform file\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/waba/templates/media', [\n  'body' => '{\"file\":\"<file-id>\",\"waba\":\"<waba-id>\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Upload a previously created platform file\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'file' => '<file-id>',\n  'waba' => '<waba-id>'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/waba/templates/media');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Upload a previously created platform file\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/waba/templates/media\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'file' => '<file-id>',\n    'waba' => '<waba-id>'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Upload a previously created platform file\nimport requests\n\nurl = \"https://api.wassenger.com/v1/waba/templates/media\"\n\npayload = {\n    \"file\": \"<file-id>\",\n    \"waba\": \"<waba-id>\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Upload a previously created platform file\nconst url = 'https://api.wassenger.com/v1/waba/templates/media';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"file\":\"<file-id>\",\"waba\":\"<waba-id>\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Upload a previously created platform file\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/waba/templates/media',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"file\":\"<file-id>\",\"waba\":\"<waba-id>\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Upload a previously created platform file\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/waba/templates/media\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"file\\\":\\\"<file-id>\\\",\\\"waba\\\":\\\"<waba-id>\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Upload a previously created platform file\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/waba/templates/media\"\n\n\tpayload := strings.NewReader(\"{\\\"file\\\":\\\"<file-id>\\\",\\\"waba\\\":\\\"<waba-id>\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Upload a previously created platform file\nvar client = new RestClient(\"https://api.wassenger.com/v1/waba/templates/media\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"file\\\":\\\"<file-id>\\\",\\\"waba\\\":\\\"<waba-id>\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Upload a previously created platform file\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/waba/templates/media\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"file\\\":\\\"<file-id>\\\",\\\"waba\\\":\\\"<waba-id>\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Upload a previously created platform file\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/waba/templates/media\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"file\\\":\\\"<file-id>\\\",\\\"waba\\\":\\\"<waba-id>\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Upload a previously created platform file\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"file\\\":\\\"<file-id>\\\",\\\"waba\\\":\\\"<waba-id>\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/waba/templates/media\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Upload a previously created platform file\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/waba/templates/media\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"file\\\":\\\"<file-id>\\\",\\\"waba\\\":\\\"<waba-id>\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Upload a previously created platform file\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/waba/templates/media' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"file\":\"<file-id>\",\"waba\":\"<waba-id>\"}'"},{"lang":"ObjC","source":"// Upload a previously created platform file\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"file\": @\"<file-id>\",\n                              @\"waba\": @\"<waba-id>\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/waba/templates/media\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Upload a previously created platform file\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"file\": \"<file-id>\",\n  \"waba\": \"<waba-id>\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/waba/templates/media\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/waba/templates":{"parameters":[],"get":{"summary":"List templates","description":"Retrieve a list of WhatsApp Cloud API message templates for the specific device.\n\n\n\nMessage templates are used to send proactive messages to users outside the 24-hour messaging window.\n\n\n\nTemplates must be approved by WhatsApp before they can be used.\n\n\n\nThis endpoint returns templates synced from the WhatsApp Business Account associated with the device.\n\n\n\n**Filtering**:\n\n\n\nYou can filter templates by:\n\n\n\n- **status**: Filter by template status (pending, approved, rejected, etc.)\n\n- **category**: Filter by template category (MARKETING, UTILITY, AUTHENTICATION)\n\n- **language**: Filter by template language code\n\n- **name**: Search templates by name (partial match, case-insensitive)\n\n\n\n\n\n**Note**: This endpoint is only available for devices connected via WhatsApp Cloud API.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fwaba%2Ftemplates)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getTemplates","security":[{"apiKey":[]}],"tags":["Templates"],"parameters":[{"in":"query","name":"status","type":"string","description":"Filter templates by status","default":"any","enum":["any","REMOVED","INVALID","DRAFT","PENDING","REVIEW","APPROVED","REJECTED","PAUSED","DISABLED","IN_APPEAL","DELETED","PENDING_DELETION"]},{"in":"query","name":"category","type":"string","description":"Filter templates by category","default":"any","enum":["any","MARKETING","UTILITY","SERVICE","AUTHENTICATION","AUTHENTICATION_INTERNATIONAL"]},{"in":"query","name":"language","type":"string","description":"Filter templates by language code","default":"any","enum":["any","af","sq","ar","az","bn","bg","ca","zh_CN","zh_HK","zh_TW","hr","cs","da","nl","en","en_GB","en_US","et","fil","fi","fr","ka","de","de_CH","el","gu","ha","he","hi","hu","id","ga","it","ja","kn","kk","rw_RW","ko","ky_KG","lo","lv","lt","mk","ms","ml","mr","nb","fa","pl","pt_BR","pt_PT","pa","ro","ru","sr","sk","sl","es","es_CL","es_AR","es_ES","es_MX","sw","sv","ta","te","th","tr","uk","ur","uz","vi","zu"]},{"in":"query","name":"name","type":"string","description":"Search templates by name (partial match, case-insensitive)","maxLength":512},{"in":"query","name":"waba","type":"string","description":"Filter templates by WhatsApp Business Account ID (WABA)","maxLength":64},{"in":"query","name":"size","description":"Maximum size of entries to return","type":"number","format":"integer","default":200,"minimum":1,"maximum":500},{"in":"query","name":"page","description":"Results page number (starting from 0)","type":"number","format":"integer","default":0,"minimum":0,"maximum":100}],"responses":{"200":{"description":"List of message templates","schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/definitions/template"}},"total":{"type":"number","description":"Total number of templates matching the filters"},"page":{"type":"number","description":"Current page number"},"size":{"type":"number","description":"Number of templates in current page"}}}},"400":{"description":"Device does not have a WhatsApp Cloud API connection","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Device not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Retrieve all templates\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/waba/templates \\\n  --header 'Token: <api token goes here>'\n\n\n// Retrieve approved templates only\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/waba/templates \\\n  --header 'Token: <api token goes here>'\n\n\n// Search templates by name\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/waba/templates \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Retrieve all templates\nhttp GET https://api.wassenger.com/v1/waba/templates \\\n  Token:'<api token goes here>'\n\n\n// Retrieve approved templates only\nhttp GET https://api.wassenger.com/v1/waba/templates \\\n  Token:'<api token goes here>'\n\n\n// Search templates by name\nhttp GET https://api.wassenger.com/v1/waba/templates \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Retrieve all templates\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/waba/templates';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Retrieve approved templates only\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/waba/templates';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Search templates by name\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/waba/templates';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Retrieve all templates\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/waba/templates',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Retrieve approved templates only\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/waba/templates',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Search templates by name\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/waba/templates',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Retrieve all templates\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/waba/templates');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Retrieve approved templates only\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/waba/templates');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Search templates by name\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/waba/templates');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Retrieve all templates\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/waba/templates', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Retrieve approved templates only\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/waba/templates', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Search templates by name\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/waba/templates', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Retrieve all templates\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/waba/templates');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Retrieve approved templates only\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/waba/templates');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Search templates by name\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/waba/templates');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Retrieve all templates\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/waba/templates\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Retrieve approved templates only\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/waba/templates\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Search templates by name\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/waba/templates\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Retrieve all templates\nimport requests\n\nurl = \"https://api.wassenger.com/v1/waba/templates\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())\n\n\n# Retrieve approved templates only\nimport requests\n\nurl = \"https://api.wassenger.com/v1/waba/templates\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())\n\n\n# Search templates by name\nimport requests\n\nurl = \"https://api.wassenger.com/v1/waba/templates\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Retrieve all templates\nconst url = 'https://api.wassenger.com/v1/waba/templates';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Retrieve approved templates only\nconst url = 'https://api.wassenger.com/v1/waba/templates';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Search templates by name\nconst url = 'https://api.wassenger.com/v1/waba/templates';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Retrieve all templates\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/waba/templates',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Retrieve approved templates only\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/waba/templates',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Search templates by name\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/waba/templates',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Retrieve all templates\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/waba/templates\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Retrieve approved templates only\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/waba/templates\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Search templates by name\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/waba/templates\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Retrieve all templates\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/waba/templates\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Retrieve approved templates only\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/waba/templates\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Search templates by name\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/waba/templates\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Retrieve all templates\nvar client = new RestClient(\"https://api.wassenger.com/v1/waba/templates\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Retrieve approved templates only\nvar client = new RestClient(\"https://api.wassenger.com/v1/waba/templates\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Search templates by name\nvar client = new RestClient(\"https://api.wassenger.com/v1/waba/templates\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Retrieve all templates\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/waba/templates\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Retrieve approved templates only\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/waba/templates\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Search templates by name\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/waba/templates\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Retrieve all templates\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/waba/templates\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Retrieve approved templates only\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/waba/templates\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Search templates by name\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/waba/templates\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Retrieve all templates\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/waba/templates\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Retrieve approved templates only\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/waba/templates\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Search templates by name\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/waba/templates\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Retrieve all templates\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/waba/templates\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Retrieve approved templates only\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/waba/templates\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Search templates by name\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/waba/templates\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Retrieve all templates\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/waba/templates' -Method GET -Headers $headers\n\n\n# Retrieve approved templates only\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/waba/templates' -Method GET -Headers $headers\n\n\n# Search templates by name\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/waba/templates' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Retrieve all templates\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/waba/templates\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Retrieve approved templates only\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/waba/templates\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Search templates by name\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/waba/templates\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Retrieve all templates\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/waba/templates\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Retrieve approved templates only\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/waba/templates\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Search templates by name\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/waba/templates\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"post":{"summary":"Create or update a template","description":"Create a new WhatsApp Cloud API message template or update an existing one.\n\n\n\nTemplates must be submitted to WhatsApp for approval before they can be used.\n\n\n\nThe template will be created in the WhatsApp Business Account associated with the device.\n\n\n\nAfter creation, the template will have a `pending` status until WhatsApp reviews and approves it.\n\n\n\n**Creation, Updates and Drafts**:\n\n\n\n- **Create**: To create a new template, provide the `name`, `language`, `category`, and `components`.\n\n- **Update**: To update an existing template, include its `id` (database ID) or `templateId` (WhatsApp ID) in the request body along with the fields to modify.\n\n- **Draft Mode**: To save a template as a draft without submitting it for approval, set `draft: true` in the request body. This is useful for saving progress before finalizing the template.\n\n\n\n**Template Structure**:\n\n\n\nTemplates consist of components:\n\n\n\n- **HEADER**: Optional header (text, image, video, document, location)\n\n- **BODY**: Required message body with optional variables {{1}}, {{2}}, etc.\n\n- **FOOTER**: Optional footer text\n\n- **BUTTONS**: Optional interactive buttons (quick reply, URL link, call phone number, etc.)\n\n\n\n**Categories**:\n\n\n\n- **MARKETING**: Promotional messages (requires opt-in)\n\n- **UTILITY**: Account updates, transactions, alerts\n\n- **AUTHENTICATION**: One-time passwords and verification codes\n\n\n\n\n\n**Note**: This endpoint is only available for devices connected via WhatsApp Cloud API.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fwaba%2Ftemplates&method=POST&body=%7B%0A%20%20%22name%22%3A%20%22welcome_message%22%2C%0A%20%20%22language%22%3A%20%22en%22%2C%0A%20%20%22category%22%3A%20%22UTILITY%22%2C%0A%20%20%22draft%22%3A%20false%2C%0A%20%20%22components%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22type%22%3A%20%22BODY%22%2C%0A%20%20%20%20%20%20%22text%22%3A%20%22Hello%20%7B%7B1%7D%7D!%20Welcome%20to%20our%20service.%22%0A%20%20%20%20%7D%0A%20%20%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"createOrUpdateTemplate","security":[{"apiKey":[]}],"tags":["Templates"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"template","schema":{"type":"object","description":"Template creation or update payload"}}],"responses":{"200":{"description":"Template created or updated successfully","schema":{"$ref":"#/definitions/template"}},"400":{"description":"Invalid or missing body fields, or device not connected via Cloud API","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Device not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Failed to create or update template in WhatsApp API","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"502":{"description":"Meta did not answer (errorCode template:meta_unreachable): the template was not created or changed. A Meta refusal answers with its 4xx and errorCode template:meta_refused, its reason in meta.reason","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Create a simple text template\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/waba/templates \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"name\":\"welcome_message\",\"language\":\"en\",\"category\":\"UTILITY\",\"draft\":false,\"components\":[{\"type\":\"BODY\",\"text\":\"Hello {{1}}! Welcome to our service.\"}]}'\n\n\n// Create template with header and buttons\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/waba/templates \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"name\":\"order_confirmation\",\"language\":\"en\",\"category\":\"UTILITY\",\"draft\":false,\"components\":[{\"type\":\"HEADER\",\"format\":\"TEXT\",\"text\":\"Order Confirmation\"},{\"type\":\"BODY\",\"text\":\"Your order {{1}} has been confirmed. Total: {{2}}\"},{\"type\":\"FOOTER\",\"text\":\"Thank you for your purchase\"},{\"type\":\"BUTTONS\",\"buttons\":[{\"type\":\"QUICK_REPLY\",\"text\":\"Track Order\"},{\"type\":\"URL\",\"text\":\"View Details\",\"url\":\"https://example.com/orders/{{1}}\",\"urlType\":\"DYNAMIC\"}]}]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Create a simple text template\necho '{\"name\":\"welcome_message\",\"language\":\"en\",\"category\":\"UTILITY\",\"draft\":false,\"components\":[{\"type\":\"BODY\",\"text\":\"Hello {{1}}! Welcome to our service.\"}]}' |  \\\n  http POST https://api.wassenger.com/v1/waba/templates \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Create template with header and buttons\necho '{\"name\":\"order_confirmation\",\"language\":\"en\",\"category\":\"UTILITY\",\"draft\":false,\"components\":[{\"type\":\"HEADER\",\"format\":\"TEXT\",\"text\":\"Order Confirmation\"},{\"type\":\"BODY\",\"text\":\"Your order {{1}} has been confirmed. Total: {{2}}\"},{\"type\":\"FOOTER\",\"text\":\"Thank you for your purchase\"},{\"type\":\"BUTTONS\",\"buttons\":[{\"type\":\"QUICK_REPLY\",\"text\":\"Track Order\"},{\"type\":\"URL\",\"text\":\"View Details\",\"url\":\"https://example.com/orders/{{1}}\",\"urlType\":\"DYNAMIC\"}]}]}' |  \\\n  http POST https://api.wassenger.com/v1/waba/templates \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Create a simple text template\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/waba/templates';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"welcome_message\",\"language\":\"en\",\"category\":\"UTILITY\",\"draft\":false,\"components\":[{\"type\":\"BODY\",\"text\":\"Hello {{1}}! Welcome to our service.\"}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Create template with header and buttons\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/waba/templates';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"order_confirmation\",\"language\":\"en\",\"category\":\"UTILITY\",\"draft\":false,\"components\":[{\"type\":\"HEADER\",\"format\":\"TEXT\",\"text\":\"Order Confirmation\"},{\"type\":\"BODY\",\"text\":\"Your order {{1}} has been confirmed. Total: {{2}}\"},{\"type\":\"FOOTER\",\"text\":\"Thank you for your purchase\"},{\"type\":\"BUTTONS\",\"buttons\":[{\"type\":\"QUICK_REPLY\",\"text\":\"Track Order\"},{\"type\":\"URL\",\"text\":\"View Details\",\"url\":\"https://example.com/orders/{{1}}\",\"urlType\":\"DYNAMIC\"}]}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Create a simple text template\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/waba/templates',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    name: 'welcome_message',\n    language: 'en',\n    category: 'UTILITY',\n    draft: false,\n    components: [{type: 'BODY', text: 'Hello {{1}}! Welcome to our service.'}]\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Create template with header and buttons\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/waba/templates',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    name: 'order_confirmation',\n    language: 'en',\n    category: 'UTILITY',\n    draft: false,\n    components: [\n      {type: 'HEADER', format: 'TEXT', text: 'Order Confirmation'},\n      {type: 'BODY', text: 'Your order {{1}} has been confirmed. Total: {{2}}'},\n      {type: 'FOOTER', text: 'Thank you for your purchase'},\n      {\n        type: 'BUTTONS',\n        buttons: [\n          {type: 'QUICK_REPLY', text: 'Track Order'},\n          {\n            type: 'URL',\n            text: 'View Details',\n            url: 'https://example.com/orders/{{1}}',\n            urlType: 'DYNAMIC'\n          }\n        ]\n      }\n    ]\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Create a simple text template\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/waba/templates');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  name: 'welcome_message',\n  language: 'en',\n  category: 'UTILITY',\n  draft: false,\n  components: [\n    {\n      type: 'BODY',\n      text: 'Hello {{1}}! Welcome to our service.'\n    }\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Create template with header and buttons\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/waba/templates');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  name: 'order_confirmation',\n  language: 'en',\n  category: 'UTILITY',\n  draft: false,\n  components: [\n    {\n      type: 'HEADER',\n      format: 'TEXT',\n      text: 'Order Confirmation'\n    },\n    {\n      type: 'BODY',\n      text: 'Your order {{1}} has been confirmed. Total: {{2}}'\n    },\n    {\n      type: 'FOOTER',\n      text: 'Thank you for your purchase'\n    },\n    {\n      type: 'BUTTONS',\n      buttons: [\n        {\n          type: 'QUICK_REPLY',\n          text: 'Track Order'\n        },\n        {\n          type: 'URL',\n          text: 'View Details',\n          url: 'https://example.com/orders/{{1}}',\n          urlType: 'DYNAMIC'\n        }\n      ]\n    }\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Create a simple text template\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/waba/templates', [\n  'body' => '{\"name\":\"welcome_message\",\"language\":\"en\",\"category\":\"UTILITY\",\"draft\":false,\"components\":[{\"type\":\"BODY\",\"text\":\"Hello {{1}}! Welcome to our service.\"}]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Create template with header and buttons\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/waba/templates', [\n  'body' => '{\"name\":\"order_confirmation\",\"language\":\"en\",\"category\":\"UTILITY\",\"draft\":false,\"components\":[{\"type\":\"HEADER\",\"format\":\"TEXT\",\"text\":\"Order Confirmation\"},{\"type\":\"BODY\",\"text\":\"Your order {{1}} has been confirmed. Total: {{2}}\"},{\"type\":\"FOOTER\",\"text\":\"Thank you for your purchase\"},{\"type\":\"BUTTONS\",\"buttons\":[{\"type\":\"QUICK_REPLY\",\"text\":\"Track Order\"},{\"type\":\"URL\",\"text\":\"View Details\",\"url\":\"https://example.com/orders/{{1}}\",\"urlType\":\"DYNAMIC\"}]}]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Create a simple text template\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'name' => 'welcome_message',\n  'language' => 'en',\n  'category' => 'UTILITY',\n  'draft' => null,\n  'components' => [\n    [\n        'type' => 'BODY',\n        'text' => 'Hello {{1}}! Welcome to our service.'\n    ]\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/waba/templates');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Create template with header and buttons\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'name' => 'order_confirmation',\n  'language' => 'en',\n  'category' => 'UTILITY',\n  'draft' => null,\n  'components' => [\n    [\n        'type' => 'HEADER',\n        'format' => 'TEXT',\n        'text' => 'Order Confirmation'\n    ],\n    [\n        'type' => 'BODY',\n        'text' => 'Your order {{1}} has been confirmed. Total: {{2}}'\n    ],\n    [\n        'type' => 'FOOTER',\n        'text' => 'Thank you for your purchase'\n    ],\n    [\n        'type' => 'BUTTONS',\n        'buttons' => [\n                [\n                                'type' => 'QUICK_REPLY',\n                                'text' => 'Track Order'\n                ],\n                [\n                                'type' => 'URL',\n                                'text' => 'View Details',\n                                'url' => 'https://example.com/orders/{{1}}',\n                                'urlType' => 'DYNAMIC'\n                ]\n        ]\n    ]\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/waba/templates');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Create a simple text template\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/waba/templates\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'name' => 'welcome_message',\n    'language' => 'en',\n    'category' => 'UTILITY',\n    'draft' => null,\n    'components' => [\n        [\n                'type' => 'BODY',\n                'text' => 'Hello {{1}}! Welcome to our service.'\n        ]\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Create template with header and buttons\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/waba/templates\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'name' => 'order_confirmation',\n    'language' => 'en',\n    'category' => 'UTILITY',\n    'draft' => null,\n    'components' => [\n        [\n                'type' => 'HEADER',\n                'format' => 'TEXT',\n                'text' => 'Order Confirmation'\n        ],\n        [\n                'type' => 'BODY',\n                'text' => 'Your order {{1}} has been confirmed. Total: {{2}}'\n        ],\n        [\n                'type' => 'FOOTER',\n                'text' => 'Thank you for your purchase'\n        ],\n        [\n                'type' => 'BUTTONS',\n                'buttons' => [\n                                [\n                                                                'type' => 'QUICK_REPLY',\n                                                                'text' => 'Track Order'\n                                ],\n                                [\n                                                                'type' => 'URL',\n                                                                'text' => 'View Details',\n                                                                'url' => 'https://example.com/orders/{{1}}',\n                                                                'urlType' => 'DYNAMIC'\n                                ]\n                ]\n        ]\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Create a simple text template\nimport requests\n\nurl = \"https://api.wassenger.com/v1/waba/templates\"\n\npayload = {\n    \"name\": \"welcome_message\",\n    \"language\": \"en\",\n    \"category\": \"UTILITY\",\n    \"draft\": False,\n    \"components\": [\n        {\n            \"type\": \"BODY\",\n            \"text\": \"Hello {{1}}! Welcome to our service.\"\n        }\n    ]\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Create template with header and buttons\nimport requests\n\nurl = \"https://api.wassenger.com/v1/waba/templates\"\n\npayload = {\n    \"name\": \"order_confirmation\",\n    \"language\": \"en\",\n    \"category\": \"UTILITY\",\n    \"draft\": False,\n    \"components\": [\n        {\n            \"type\": \"HEADER\",\n            \"format\": \"TEXT\",\n            \"text\": \"Order Confirmation\"\n        },\n        {\n            \"type\": \"BODY\",\n            \"text\": \"Your order {{1}} has been confirmed. Total: {{2}}\"\n        },\n        {\n            \"type\": \"FOOTER\",\n            \"text\": \"Thank you for your purchase\"\n        },\n        {\n            \"type\": \"BUTTONS\",\n            \"buttons\": [\n                {\n                    \"type\": \"QUICK_REPLY\",\n                    \"text\": \"Track Order\"\n                },\n                {\n                    \"type\": \"URL\",\n                    \"text\": \"View Details\",\n                    \"url\": \"https://example.com/orders/{{1}}\",\n                    \"urlType\": \"DYNAMIC\"\n                }\n            ]\n        }\n    ]\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create a simple text template\nconst url = 'https://api.wassenger.com/v1/waba/templates';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"welcome_message\",\"language\":\"en\",\"category\":\"UTILITY\",\"draft\":false,\"components\":[{\"type\":\"BODY\",\"text\":\"Hello {{1}}! Welcome to our service.\"}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Create template with header and buttons\nconst url = 'https://api.wassenger.com/v1/waba/templates';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"order_confirmation\",\"language\":\"en\",\"category\":\"UTILITY\",\"draft\":false,\"components\":[{\"type\":\"HEADER\",\"format\":\"TEXT\",\"text\":\"Order Confirmation\"},{\"type\":\"BODY\",\"text\":\"Your order {{1}} has been confirmed. Total: {{2}}\"},{\"type\":\"FOOTER\",\"text\":\"Thank you for your purchase\"},{\"type\":\"BUTTONS\",\"buttons\":[{\"type\":\"QUICK_REPLY\",\"text\":\"Track Order\"},{\"type\":\"URL\",\"text\":\"View Details\",\"url\":\"https://example.com/orders/{{1}}\",\"urlType\":\"DYNAMIC\"}]}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create a simple text template\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/waba/templates',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"name\":\"welcome_message\",\"language\":\"en\",\"category\":\"UTILITY\",\"draft\":false,\"components\":[{\"type\":\"BODY\",\"text\":\"Hello {{1}}! Welcome to our service.\"}]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Create template with header and buttons\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/waba/templates',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"name\":\"order_confirmation\",\"language\":\"en\",\"category\":\"UTILITY\",\"draft\":false,\"components\":[{\"type\":\"HEADER\",\"format\":\"TEXT\",\"text\":\"Order Confirmation\"},{\"type\":\"BODY\",\"text\":\"Your order {{1}} has been confirmed. Total: {{2}}\"},{\"type\":\"FOOTER\",\"text\":\"Thank you for your purchase\"},{\"type\":\"BUTTONS\",\"buttons\":[{\"type\":\"QUICK_REPLY\",\"text\":\"Track Order\"},{\"type\":\"URL\",\"text\":\"View Details\",\"url\":\"https://example.com/orders/{{1}}\",\"urlType\":\"DYNAMIC\"}]}]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Create a simple text template\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/waba/templates\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"name\\\":\\\"welcome_message\\\",\\\"language\\\":\\\"en\\\",\\\"category\\\":\\\"UTILITY\\\",\\\"draft\\\":false,\\\"components\\\":[{\\\"type\\\":\\\"BODY\\\",\\\"text\\\":\\\"Hello {{1}}! Welcome to our service.\\\"}]}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Create template with header and buttons\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/waba/templates\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"name\\\":\\\"order_confirmation\\\",\\\"language\\\":\\\"en\\\",\\\"category\\\":\\\"UTILITY\\\",\\\"draft\\\":false,\\\"components\\\":[{\\\"type\\\":\\\"HEADER\\\",\\\"format\\\":\\\"TEXT\\\",\\\"text\\\":\\\"Order Confirmation\\\"},{\\\"type\\\":\\\"BODY\\\",\\\"text\\\":\\\"Your order {{1}} has been confirmed. Total: {{2}}\\\"},{\\\"type\\\":\\\"FOOTER\\\",\\\"text\\\":\\\"Thank you for your purchase\\\"},{\\\"type\\\":\\\"BUTTONS\\\",\\\"buttons\\\":[{\\\"type\\\":\\\"QUICK_REPLY\\\",\\\"text\\\":\\\"Track Order\\\"},{\\\"type\\\":\\\"URL\\\",\\\"text\\\":\\\"View Details\\\",\\\"url\\\":\\\"https://example.com/orders/{{1}}\\\",\\\"urlType\\\":\\\"DYNAMIC\\\"}]}]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Create a simple text template\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/waba/templates\"\n\n\tpayload := strings.NewReader(\"{\\\"name\\\":\\\"welcome_message\\\",\\\"language\\\":\\\"en\\\",\\\"category\\\":\\\"UTILITY\\\",\\\"draft\\\":false,\\\"components\\\":[{\\\"type\\\":\\\"BODY\\\",\\\"text\\\":\\\"Hello {{1}}! Welcome to our service.\\\"}]}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Create template with header and buttons\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/waba/templates\"\n\n\tpayload := strings.NewReader(\"{\\\"name\\\":\\\"order_confirmation\\\",\\\"language\\\":\\\"en\\\",\\\"category\\\":\\\"UTILITY\\\",\\\"draft\\\":false,\\\"components\\\":[{\\\"type\\\":\\\"HEADER\\\",\\\"format\\\":\\\"TEXT\\\",\\\"text\\\":\\\"Order Confirmation\\\"},{\\\"type\\\":\\\"BODY\\\",\\\"text\\\":\\\"Your order {{1}} has been confirmed. Total: {{2}}\\\"},{\\\"type\\\":\\\"FOOTER\\\",\\\"text\\\":\\\"Thank you for your purchase\\\"},{\\\"type\\\":\\\"BUTTONS\\\",\\\"buttons\\\":[{\\\"type\\\":\\\"QUICK_REPLY\\\",\\\"text\\\":\\\"Track Order\\\"},{\\\"type\\\":\\\"URL\\\",\\\"text\\\":\\\"View Details\\\",\\\"url\\\":\\\"https://example.com/orders/{{1}}\\\",\\\"urlType\\\":\\\"DYNAMIC\\\"}]}]}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Create a simple text template\nvar client = new RestClient(\"https://api.wassenger.com/v1/waba/templates\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"name\\\":\\\"welcome_message\\\",\\\"language\\\":\\\"en\\\",\\\"category\\\":\\\"UTILITY\\\",\\\"draft\\\":false,\\\"components\\\":[{\\\"type\\\":\\\"BODY\\\",\\\"text\\\":\\\"Hello {{1}}! Welcome to our service.\\\"}]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Create template with header and buttons\nvar client = new RestClient(\"https://api.wassenger.com/v1/waba/templates\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"name\\\":\\\"order_confirmation\\\",\\\"language\\\":\\\"en\\\",\\\"category\\\":\\\"UTILITY\\\",\\\"draft\\\":false,\\\"components\\\":[{\\\"type\\\":\\\"HEADER\\\",\\\"format\\\":\\\"TEXT\\\",\\\"text\\\":\\\"Order Confirmation\\\"},{\\\"type\\\":\\\"BODY\\\",\\\"text\\\":\\\"Your order {{1}} has been confirmed. Total: {{2}}\\\"},{\\\"type\\\":\\\"FOOTER\\\",\\\"text\\\":\\\"Thank you for your purchase\\\"},{\\\"type\\\":\\\"BUTTONS\\\",\\\"buttons\\\":[{\\\"type\\\":\\\"QUICK_REPLY\\\",\\\"text\\\":\\\"Track Order\\\"},{\\\"type\\\":\\\"URL\\\",\\\"text\\\":\\\"View Details\\\",\\\"url\\\":\\\"https://example.com/orders/{{1}}\\\",\\\"urlType\\\":\\\"DYNAMIC\\\"}]}]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Create a simple text template\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/waba/templates\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"name\\\":\\\"welcome_message\\\",\\\"language\\\":\\\"en\\\",\\\"category\\\":\\\"UTILITY\\\",\\\"draft\\\":false,\\\"components\\\":[{\\\"type\\\":\\\"BODY\\\",\\\"text\\\":\\\"Hello {{1}}! Welcome to our service.\\\"}]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Create template with header and buttons\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/waba/templates\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"name\\\":\\\"order_confirmation\\\",\\\"language\\\":\\\"en\\\",\\\"category\\\":\\\"UTILITY\\\",\\\"draft\\\":false,\\\"components\\\":[{\\\"type\\\":\\\"HEADER\\\",\\\"format\\\":\\\"TEXT\\\",\\\"text\\\":\\\"Order Confirmation\\\"},{\\\"type\\\":\\\"BODY\\\",\\\"text\\\":\\\"Your order {{1}} has been confirmed. Total: {{2}}\\\"},{\\\"type\\\":\\\"FOOTER\\\",\\\"text\\\":\\\"Thank you for your purchase\\\"},{\\\"type\\\":\\\"BUTTONS\\\",\\\"buttons\\\":[{\\\"type\\\":\\\"QUICK_REPLY\\\",\\\"text\\\":\\\"Track Order\\\"},{\\\"type\\\":\\\"URL\\\",\\\"text\\\":\\\"View Details\\\",\\\"url\\\":\\\"https://example.com/orders/{{1}}\\\",\\\"urlType\\\":\\\"DYNAMIC\\\"}]}]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Create a simple text template\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/waba/templates\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"name\\\":\\\"welcome_message\\\",\\\"language\\\":\\\"en\\\",\\\"category\\\":\\\"UTILITY\\\",\\\"draft\\\":false,\\\"components\\\":[{\\\"type\\\":\\\"BODY\\\",\\\"text\\\":\\\"Hello {{1}}! Welcome to our service.\\\"}]}\")\n  .asString();\n\n\n// Create template with header and buttons\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/waba/templates\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"name\\\":\\\"order_confirmation\\\",\\\"language\\\":\\\"en\\\",\\\"category\\\":\\\"UTILITY\\\",\\\"draft\\\":false,\\\"components\\\":[{\\\"type\\\":\\\"HEADER\\\",\\\"format\\\":\\\"TEXT\\\",\\\"text\\\":\\\"Order Confirmation\\\"},{\\\"type\\\":\\\"BODY\\\",\\\"text\\\":\\\"Your order {{1}} has been confirmed. Total: {{2}}\\\"},{\\\"type\\\":\\\"FOOTER\\\",\\\"text\\\":\\\"Thank you for your purchase\\\"},{\\\"type\\\":\\\"BUTTONS\\\",\\\"buttons\\\":[{\\\"type\\\":\\\"QUICK_REPLY\\\",\\\"text\\\":\\\"Track Order\\\"},{\\\"type\\\":\\\"URL\\\",\\\"text\\\":\\\"View Details\\\",\\\"url\\\":\\\"https://example.com/orders/{{1}}\\\",\\\"urlType\\\":\\\"DYNAMIC\\\"}]}]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Create a simple text template\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"name\\\":\\\"welcome_message\\\",\\\"language\\\":\\\"en\\\",\\\"category\\\":\\\"UTILITY\\\",\\\"draft\\\":false,\\\"components\\\":[{\\\"type\\\":\\\"BODY\\\",\\\"text\\\":\\\"Hello {{1}}! Welcome to our service.\\\"}]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/waba/templates\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Create template with header and buttons\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"name\\\":\\\"order_confirmation\\\",\\\"language\\\":\\\"en\\\",\\\"category\\\":\\\"UTILITY\\\",\\\"draft\\\":false,\\\"components\\\":[{\\\"type\\\":\\\"HEADER\\\",\\\"format\\\":\\\"TEXT\\\",\\\"text\\\":\\\"Order Confirmation\\\"},{\\\"type\\\":\\\"BODY\\\",\\\"text\\\":\\\"Your order {{1}} has been confirmed. Total: {{2}}\\\"},{\\\"type\\\":\\\"FOOTER\\\",\\\"text\\\":\\\"Thank you for your purchase\\\"},{\\\"type\\\":\\\"BUTTONS\\\",\\\"buttons\\\":[{\\\"type\\\":\\\"QUICK_REPLY\\\",\\\"text\\\":\\\"Track Order\\\"},{\\\"type\\\":\\\"URL\\\",\\\"text\\\":\\\"View Details\\\",\\\"url\\\":\\\"https://example.com/orders/{{1}}\\\",\\\"urlType\\\":\\\"DYNAMIC\\\"}]}]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/waba/templates\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Create a simple text template\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/waba/templates\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"name\\\":\\\"welcome_message\\\",\\\"language\\\":\\\"en\\\",\\\"category\\\":\\\"UTILITY\\\",\\\"draft\\\":false,\\\"components\\\":[{\\\"type\\\":\\\"BODY\\\",\\\"text\\\":\\\"Hello {{1}}! Welcome to our service.\\\"}]}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Create template with header and buttons\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/waba/templates\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"name\\\":\\\"order_confirmation\\\",\\\"language\\\":\\\"en\\\",\\\"category\\\":\\\"UTILITY\\\",\\\"draft\\\":false,\\\"components\\\":[{\\\"type\\\":\\\"HEADER\\\",\\\"format\\\":\\\"TEXT\\\",\\\"text\\\":\\\"Order Confirmation\\\"},{\\\"type\\\":\\\"BODY\\\",\\\"text\\\":\\\"Your order {{1}} has been confirmed. Total: {{2}}\\\"},{\\\"type\\\":\\\"FOOTER\\\",\\\"text\\\":\\\"Thank you for your purchase\\\"},{\\\"type\\\":\\\"BUTTONS\\\",\\\"buttons\\\":[{\\\"type\\\":\\\"QUICK_REPLY\\\",\\\"text\\\":\\\"Track Order\\\"},{\\\"type\\\":\\\"URL\\\",\\\"text\\\":\\\"View Details\\\",\\\"url\\\":\\\"https://example.com/orders/{{1}}\\\",\\\"urlType\\\":\\\"DYNAMIC\\\"}]}]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Create a simple text template\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/waba/templates' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"name\":\"welcome_message\",\"language\":\"en\",\"category\":\"UTILITY\",\"draft\":false,\"components\":[{\"type\":\"BODY\",\"text\":\"Hello {{1}}! Welcome to our service.\"}]}'\n\n\n# Create template with header and buttons\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/waba/templates' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"name\":\"order_confirmation\",\"language\":\"en\",\"category\":\"UTILITY\",\"draft\":false,\"components\":[{\"type\":\"HEADER\",\"format\":\"TEXT\",\"text\":\"Order Confirmation\"},{\"type\":\"BODY\",\"text\":\"Your order {{1}} has been confirmed. Total: {{2}}\"},{\"type\":\"FOOTER\",\"text\":\"Thank you for your purchase\"},{\"type\":\"BUTTONS\",\"buttons\":[{\"type\":\"QUICK_REPLY\",\"text\":\"Track Order\"},{\"type\":\"URL\",\"text\":\"View Details\",\"url\":\"https://example.com/orders/{{1}}\",\"urlType\":\"DYNAMIC\"}]}]}'"},{"lang":"ObjC","source":"// Create a simple text template\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"name\": @\"welcome_message\",\n                              @\"language\": @\"en\",\n                              @\"category\": @\"UTILITY\",\n                              @\"draft\": @NO,\n                              @\"components\": @[ @{ @\"type\": @\"BODY\", @\"text\": @\"Hello {{1}}! Welcome to our service.\" } ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/waba/templates\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Create template with header and buttons\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"name\": @\"order_confirmation\",\n                              @\"language\": @\"en\",\n                              @\"category\": @\"UTILITY\",\n                              @\"draft\": @NO,\n                              @\"components\": @[ @{ @\"type\": @\"HEADER\", @\"format\": @\"TEXT\", @\"text\": @\"Order Confirmation\" }, @{ @\"type\": @\"BODY\", @\"text\": @\"Your order {{1}} has been confirmed. Total: {{2}}\" }, @{ @\"type\": @\"FOOTER\", @\"text\": @\"Thank you for your purchase\" }, @{ @\"type\": @\"BUTTONS\", @\"buttons\": @[ @{ @\"type\": @\"QUICK_REPLY\", @\"text\": @\"Track Order\" }, @{ @\"type\": @\"URL\", @\"text\": @\"View Details\", @\"url\": @\"https://example.com/orders/{{1}}\", @\"urlType\": @\"DYNAMIC\" } ] } ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/waba/templates\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Create a simple text template\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"name\": \"welcome_message\",\n  \"language\": \"en\",\n  \"category\": \"UTILITY\",\n  \"draft\": false,\n  \"components\": [\n    [\n      \"type\": \"BODY\",\n      \"text\": \"Hello {{1}}! Welcome to our service.\"\n    ]\n  ]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/waba/templates\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Create template with header and buttons\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"name\": \"order_confirmation\",\n  \"language\": \"en\",\n  \"category\": \"UTILITY\",\n  \"draft\": false,\n  \"components\": [\n    [\n      \"type\": \"HEADER\",\n      \"format\": \"TEXT\",\n      \"text\": \"Order Confirmation\"\n    ],\n    [\n      \"type\": \"BODY\",\n      \"text\": \"Your order {{1}} has been confirmed. Total: {{2}}\"\n    ],\n    [\n      \"type\": \"FOOTER\",\n      \"text\": \"Thank you for your purchase\"\n    ],\n    [\n      \"type\": \"BUTTONS\",\n      \"buttons\": [\n        [\n          \"type\": \"QUICK_REPLY\",\n          \"text\": \"Track Order\"\n        ],\n        [\n          \"type\": \"URL\",\n          \"text\": \"View Details\",\n          \"url\": \"https://example.com/orders/{{1}}\",\n          \"urlType\": \"DYNAMIC\"\n        ]\n      ]\n    ]\n  ]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/waba/templates\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Delete templates","description":"Delete one or multiple WABA message templates.\n\n\n\nTemplates can be deleted by:\n\n\n\n- **templateId**: WhatsApp template ID\n\n- **id**: Database document ID\n\n- **name**: Template name (optionally with language)\n\n\n\nTo delete all templates at once, use: `[{ all: true }]`\n\n\n\n**Warning**: Deleting a template will remove it from WhatsApp and it cannot be recovered.\n\nYou will need to create and get approval for a new template if needed.\n\n\n\n**Note**: This endpoint is only available for devices connected via WhatsApp Cloud API.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fwaba%2Ftemplates&method=DELETE&body=%5B%0A%20%20%7B%0A%20%20%20%20%22templateId%22%3A%20%221234567890%22%0A%20%20%7D%0A%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deleteTemplates","security":[{"apiKey":[]}],"tags":["Templates"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"templates","schema":{"oneOf":[{"type":"array","items":{"type":"object","properties":{"templateId":{"type":"string","description":"WhatsApp template ID"},"id":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","description":"Database document ID"},"name":{"type":"string","description":"Template name"},"language":{"type":"string","description":"Template language (required when using name)"},"all":{"type":"boolean","description":"Delete all templates"}}}},{"type":"object","properties":{"templateId":{"type":"string"},"id":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$"},"name":{"type":"string"},"language":{"type":"string"},"all":{"type":"boolean"}}}]}}],"responses":{"200":{"description":"Templates deletion result","schema":{"type":"object","properties":{"deleted":{"type":"number","description":"Number of templates deleted successfully"},"errors":{"type":"array","description":"List of errors encountered during deletion","items":{"type":"object","properties":{"templateId":{"type":"string"},"name":{"type":"string"},"error":{"type":"string"}}}}}}},"400":{"description":"Invalid request or device not connected via Cloud API","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Device not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Delete one template by ID\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/waba/templates \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '[{\"templateId\":\"1234567890\"}]'\n\n\n// Delete template by name\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/waba/templates \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '[{\"name\":\"welcome_message\",\"language\":\"en\"}]'\n\n\n// Delete all templates\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/waba/templates \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '[{\"all\":true}]'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Delete one template by ID\necho '[{\"templateId\":\"1234567890\"}]' |  \\\n  http DELETE https://api.wassenger.com/v1/waba/templates \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Delete template by name\necho '[{\"name\":\"welcome_message\",\"language\":\"en\"}]' |  \\\n  http DELETE https://api.wassenger.com/v1/waba/templates \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Delete all templates\necho '[{\"all\":true}]' |  \\\n  http DELETE https://api.wassenger.com/v1/waba/templates \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Delete one template by ID\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/waba/templates';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"templateId\":\"1234567890\"}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete template by name\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/waba/templates';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"name\":\"welcome_message\",\"language\":\"en\"}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete all templates\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/waba/templates';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"all\":true}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Delete one template by ID\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/waba/templates',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: [{templateId: '1234567890'}]\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete template by name\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/waba/templates',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: [{name: 'welcome_message', language: 'en'}]\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete all templates\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/waba/templates',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: [{all: true}]\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Delete one template by ID\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/waba/templates');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send([\n  {\n    templateId: '1234567890'\n  }\n]);\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Delete template by name\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/waba/templates');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send([\n  {\n    name: 'welcome_message',\n    language: 'en'\n  }\n]);\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Delete all templates\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/waba/templates');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send([\n  {\n    all: true\n  }\n]);\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Delete one template by ID\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/waba/templates', [\n  'body' => '[{\"templateId\":\"1234567890\"}]',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Delete template by name\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/waba/templates', [\n  'body' => '[{\"name\":\"welcome_message\",\"language\":\"en\"}]',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Delete all templates\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/waba/templates', [\n  'body' => '[{\"all\":true}]',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Delete one template by ID\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  [\n    'templateId' => '1234567890'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/waba/templates');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Delete template by name\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  [\n    'name' => 'welcome_message',\n    'language' => 'en'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/waba/templates');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Delete all templates\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  [\n    'all' => null\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/waba/templates');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Delete one template by ID\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/waba/templates\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    [\n        'templateId' => '1234567890'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Delete template by name\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/waba/templates\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    [\n        'name' => 'welcome_message',\n        'language' => 'en'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Delete all templates\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/waba/templates\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    [\n        'all' => null\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Delete one template by ID\nimport requests\n\nurl = \"https://api.wassenger.com/v1/waba/templates\"\n\npayload = [{ \"templateId\": \"1234567890\" }]\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Delete template by name\nimport requests\n\nurl = \"https://api.wassenger.com/v1/waba/templates\"\n\npayload = [\n    {\n        \"name\": \"welcome_message\",\n        \"language\": \"en\"\n    }\n]\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Delete all templates\nimport requests\n\nurl = \"https://api.wassenger.com/v1/waba/templates\"\n\npayload = [{ \"all\": True }]\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete one template by ID\nconst url = 'https://api.wassenger.com/v1/waba/templates';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"templateId\":\"1234567890\"}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete template by name\nconst url = 'https://api.wassenger.com/v1/waba/templates';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"name\":\"welcome_message\",\"language\":\"en\"}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete all templates\nconst url = 'https://api.wassenger.com/v1/waba/templates';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"all\":true}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete one template by ID\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/waba/templates',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '[{\"templateId\":\"1234567890\"}]'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Delete template by name\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/waba/templates',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '[{\"name\":\"welcome_message\",\"language\":\"en\"}]'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Delete all templates\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/waba/templates',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '[{\"all\":true}]'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Delete one template by ID\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/waba/templates\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"[{\\\"templateId\\\":\\\"1234567890\\\"}]\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Delete template by name\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/waba/templates\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"[{\\\"name\\\":\\\"welcome_message\\\",\\\"language\\\":\\\"en\\\"}]\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Delete all templates\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/waba/templates\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"[{\\\"all\\\":true}]\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Delete one template by ID\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/waba/templates\"\n\n\tpayload := strings.NewReader(\"[{\\\"templateId\\\":\\\"1234567890\\\"}]\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Delete template by name\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/waba/templates\"\n\n\tpayload := strings.NewReader(\"[{\\\"name\\\":\\\"welcome_message\\\",\\\"language\\\":\\\"en\\\"}]\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Delete all templates\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/waba/templates\"\n\n\tpayload := strings.NewReader(\"[{\\\"all\\\":true}]\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Delete one template by ID\nvar client = new RestClient(\"https://api.wassenger.com/v1/waba/templates\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"[{\\\"templateId\\\":\\\"1234567890\\\"}]\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Delete template by name\nvar client = new RestClient(\"https://api.wassenger.com/v1/waba/templates\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"[{\\\"name\\\":\\\"welcome_message\\\",\\\"language\\\":\\\"en\\\"}]\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Delete all templates\nvar client = new RestClient(\"https://api.wassenger.com/v1/waba/templates\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"[{\\\"all\\\":true}]\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Delete one template by ID\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/waba/templates\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"[{\\\"templateId\\\":\\\"1234567890\\\"}]\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Delete template by name\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/waba/templates\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"[{\\\"name\\\":\\\"welcome_message\\\",\\\"language\\\":\\\"en\\\"}]\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Delete all templates\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/waba/templates\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"[{\\\"all\\\":true}]\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Delete one template by ID\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/waba/templates\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"[{\\\"templateId\\\":\\\"1234567890\\\"}]\")\n  .asString();\n\n\n// Delete template by name\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/waba/templates\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"[{\\\"name\\\":\\\"welcome_message\\\",\\\"language\\\":\\\"en\\\"}]\")\n  .asString();\n\n\n// Delete all templates\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/waba/templates\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"[{\\\"all\\\":true}]\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Delete one template by ID\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"[{\\\"templateId\\\":\\\"1234567890\\\"}]\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/waba/templates\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Delete template by name\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"[{\\\"name\\\":\\\"welcome_message\\\",\\\"language\\\":\\\"en\\\"}]\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/waba/templates\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Delete all templates\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"[{\\\"all\\\":true}]\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/waba/templates\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Delete one template by ID\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/waba/templates\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"[{\\\"templateId\\\":\\\"1234567890\\\"}]\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Delete template by name\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/waba/templates\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"[{\\\"name\\\":\\\"welcome_message\\\",\\\"language\\\":\\\"en\\\"}]\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Delete all templates\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/waba/templates\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"[{\\\"all\\\":true}]\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Delete one template by ID\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/waba/templates' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '[{\"templateId\":\"1234567890\"}]'\n\n\n# Delete template by name\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/waba/templates' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '[{\"name\":\"welcome_message\",\"language\":\"en\"}]'\n\n\n# Delete all templates\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/waba/templates' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '[{\"all\":true}]'"},{"lang":"ObjC","source":"// Delete one template by ID\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @[ @{ @\"templateId\": @\"1234567890\" } ];\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/waba/templates\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Delete template by name\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @[ @{ @\"name\": @\"welcome_message\", @\"language\": @\"en\" } ];\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/waba/templates\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Delete all templates\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @[ @{ @\"all\": @YES } ];\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/waba/templates\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Delete one template by ID\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [[\"templateId\": \"1234567890\"]] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/waba/templates\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Delete template by name\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  [\n    \"name\": \"welcome_message\",\n    \"language\": \"en\"\n  ]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/waba/templates\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Delete all templates\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [[\"all\": true]] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/waba/templates\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/waba/sync-report":{"parameters":[]},"/waba/prices":{"parameters":[],"get":{"summary":"Get messaging prices","description":"Retrieve up-to-date WhatsApp Business API pricing information across countries, regions and currencies.\n\n\n\nPricing varies by:\n\n\n\n- **Country/Region**: Different rates apply per country or regional grouping\n\n- **Message Category**: MARKETING, UTILITY, AUTHENTICATION, SERVICE\n\n- **Currency**: Multiple currencies available USD, AED, ARS, AUD, BRL, CLP, COP, EUR, GBP, IDR, INR, MXN, MYR, PEN, SAR, SGD\n\n\n\n**Filtering**:\n\n\n\n- **country**: Filter by ISO 3166-1 alpha-2 country code (e.g., US, GB, IN)\n\n- **phonePrefix**: Filter by phone number prefix\n\n- **currency**: Filter by available currency (USD, EUR, GBP, etc.)\n\n\n\n**Note**: Prices are updated periodically from Meta's official pricing page and may change over time.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fwaba%2Fprices)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getWabaPrices","security":[{"apiKey":[]}],"tags":["Templates Pricing"],"parameters":[{"in":"query","name":"country","type":"string","description":"Filter by ISO 3166-1 alpha-2 country code (e.g., US, GB, IN)","minLength":2,"maxLength":2},{"in":"query","name":"phonePrefix","type":"number","format":"integer","description":"Filter by phone number prefix (e.g., 1 for US/Canada, 44 for UK)","maximum":999,"minimum":1},{"in":"query","name":"currency","type":"string","description":"Filter by available currency (USD, EUR, GBP, INR, IDR, AUD)","enum":["USD","AED","ARS","AUD","BRL","CLP","COP","EUR","GBP","IDR","INR","MXN","MYR","PEN","SAR","SGD"],"minLength":3,"maxLength":3},{"in":"query","name":"size","description":"Maximum size of entries to return","type":"number","format":"integer","default":100,"minimum":1,"maximum":200},{"in":"query","name":"page","description":"Results page number (starting from 0)","type":"number","format":"integer","default":0,"minimum":0,"maximum":100}],"responses":{"200":{"description":"List of WABA pricing information","schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Document ID"},"country":{"type":"string","description":"ISO 3166-1 alpha-2 country code"},"marketName":{"type":"string","description":"Country/market name"},"currencies":{"type":"object","description":"Pricing by currency","additionalProperties":{"type":"object","properties":{"marketing":{"type":"number","description":"Marketing message price"},"utility":{"type":"number","description":"Utility message price"},"authentication":{"type":"number","description":"Authentication message price"},"authenticationInternational":{"type":"number","description":"International authentication message price"},"service":{"type":"number","description":"Service conversation price"},"effectiveDate":{"type":"string","format":"date-time","description":"Date when these prices became effective"}}}},"isRegional":{"type":"boolean","description":"Whether this is a regional pricing (not specific country)"}}}},"total":{"type":"number","description":"Total number of price records matching filters"},"page":{"type":"number","description":"Current page number"},"size":{"type":"number","description":"Number of records in current page"}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get all pricing information\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/waba/prices \\\n  --header 'Token: <api token goes here>'\n\n\n// Get pricing for a specific country\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/waba/prices \\\n  --header 'Token: <api token goes here>'\n\n\n// Get pricing by phone prefix\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/waba/prices \\\n  --header 'Token: <api token goes here>'\n\n\n// Get pricing available in EUR\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/waba/prices \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get all pricing information\nhttp GET https://api.wassenger.com/v1/waba/prices \\\n  Token:'<api token goes here>'\n\n\n// Get pricing for a specific country\nhttp GET https://api.wassenger.com/v1/waba/prices \\\n  Token:'<api token goes here>'\n\n\n// Get pricing by phone prefix\nhttp GET https://api.wassenger.com/v1/waba/prices \\\n  Token:'<api token goes here>'\n\n\n// Get pricing available in EUR\nhttp GET https://api.wassenger.com/v1/waba/prices \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get all pricing information\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/waba/prices';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get pricing for a specific country\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/waba/prices';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get pricing by phone prefix\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/waba/prices';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get pricing available in EUR\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/waba/prices';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get all pricing information\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/waba/prices',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get pricing for a specific country\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/waba/prices',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get pricing by phone prefix\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/waba/prices',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get pricing available in EUR\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/waba/prices',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get all pricing information\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/waba/prices');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get pricing for a specific country\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/waba/prices');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get pricing by phone prefix\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/waba/prices');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get pricing available in EUR\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/waba/prices');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get all pricing information\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/waba/prices', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get pricing for a specific country\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/waba/prices', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get pricing by phone prefix\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/waba/prices', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get pricing available in EUR\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/waba/prices', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get all pricing information\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/waba/prices');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get pricing for a specific country\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/waba/prices');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get pricing by phone prefix\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/waba/prices');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get pricing available in EUR\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/waba/prices');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get all pricing information\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/waba/prices\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get pricing for a specific country\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/waba/prices\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get pricing by phone prefix\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/waba/prices\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get pricing available in EUR\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/waba/prices\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get all pricing information\nimport requests\n\nurl = \"https://api.wassenger.com/v1/waba/prices\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())\n\n\n# Get pricing for a specific country\nimport requests\n\nurl = \"https://api.wassenger.com/v1/waba/prices\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())\n\n\n# Get pricing by phone prefix\nimport requests\n\nurl = \"https://api.wassenger.com/v1/waba/prices\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())\n\n\n# Get pricing available in EUR\nimport requests\n\nurl = \"https://api.wassenger.com/v1/waba/prices\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get all pricing information\nconst url = 'https://api.wassenger.com/v1/waba/prices';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get pricing for a specific country\nconst url = 'https://api.wassenger.com/v1/waba/prices';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get pricing by phone prefix\nconst url = 'https://api.wassenger.com/v1/waba/prices';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get pricing available in EUR\nconst url = 'https://api.wassenger.com/v1/waba/prices';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get all pricing information\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/waba/prices',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get pricing for a specific country\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/waba/prices',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get pricing by phone prefix\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/waba/prices',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get pricing available in EUR\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/waba/prices',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get all pricing information\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/waba/prices\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get pricing for a specific country\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/waba/prices\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get pricing by phone prefix\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/waba/prices\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get pricing available in EUR\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/waba/prices\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get all pricing information\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/waba/prices\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get pricing for a specific country\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/waba/prices\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get pricing by phone prefix\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/waba/prices\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get pricing available in EUR\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/waba/prices\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get all pricing information\nvar client = new RestClient(\"https://api.wassenger.com/v1/waba/prices\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Get pricing for a specific country\nvar client = new RestClient(\"https://api.wassenger.com/v1/waba/prices\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Get pricing by phone prefix\nvar client = new RestClient(\"https://api.wassenger.com/v1/waba/prices\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Get pricing available in EUR\nvar client = new RestClient(\"https://api.wassenger.com/v1/waba/prices\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get all pricing information\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/waba/prices\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get pricing for a specific country\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/waba/prices\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get pricing by phone prefix\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/waba/prices\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get pricing available in EUR\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/waba/prices\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get all pricing information\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/waba/prices\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Get pricing for a specific country\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/waba/prices\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Get pricing by phone prefix\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/waba/prices\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Get pricing available in EUR\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/waba/prices\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get all pricing information\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/waba/prices\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get pricing for a specific country\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/waba/prices\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get pricing by phone prefix\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/waba/prices\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get pricing available in EUR\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/waba/prices\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get all pricing information\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/waba/prices\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get pricing for a specific country\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/waba/prices\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get pricing by phone prefix\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/waba/prices\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get pricing available in EUR\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/waba/prices\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get all pricing information\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/waba/prices' -Method GET -Headers $headers\n\n\n# Get pricing for a specific country\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/waba/prices' -Method GET -Headers $headers\n\n\n# Get pricing by phone prefix\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/waba/prices' -Method GET -Headers $headers\n\n\n# Get pricing available in EUR\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/waba/prices' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get all pricing information\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/waba/prices\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get pricing for a specific country\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/waba/prices\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get pricing by phone prefix\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/waba/prices\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get pricing available in EUR\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/waba/prices\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get all pricing information\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/waba/prices\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get pricing for a specific country\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/waba/prices\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get pricing by phone prefix\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/waba/prices\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get pricing available in EUR\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/waba/prices\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"post":{"summary":"Calculate messaging costs","description":"Calculate the cost of sending WhatsApp template messages based on country, category, and message volume.\n\n\n\nProvide an array of calculation requests, each specifying:\n\n\n\n- **country** or **phonePrefix**: Target country (ISO code) or phone prefix\n\n- **category**: Message category (marketing, utility, authentication, authenticationInternational, service)\n\n- **messages**: Number of messages to calculate cost for\n\n\n\nThe endpoint returns pricing in all available currencies for each country.\n\n\n\n**Message Categories**:\n\n\n\n- **marketing**: Promotional content, offers, announcements\n\n- **utility**: Account updates, order notifications, alerts\n\n- **authentication**: One-time passwords, verification codes\n\n- **authenticationInternational**: International authentication messages (only applicable in some countries)\n\n- **service**: Customer service conversations\n\n\n\n**Note**: Pricing varies significantly by country and currency.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fwaba%2Fprices&method=POST&body=%5B%0A%20%20%7B%0A%20%20%20%20%22country%22%3A%20%22US%22%2C%0A%20%20%20%20%22category%22%3A%20%22marketing%22%2C%0A%20%20%20%20%22quantity%22%3A%201000%0A%20%20%7D%0A%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"calculateWabaCosts","security":[{"apiKey":[]}],"tags":["Templates Pricing"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"calculations","required":true,"schema":{"type":"array","items":{"type":"object","properties":{"country":{"type":"string","description":"ISO 3166-1 alpha-2 country code (required if phonePrefix not provided)","minLength":2,"maxLength":2,"example":"US"},"phonePrefix":{"type":"number","format":"integer","description":"Phone number country prefix (required if country not provided)","example":1},"category":{"type":"string","enum":["marketing","utility","authentication","authenticationInternational","service"],"description":"Message category","example":"marketing"},"quantity":{"type":"number","format":"integer","minimum":1,"description":"Quantity of messages to calculate cost for","example":1000}},"required":["category","quantity"]}}}],"responses":{"200":{"description":"Cost calculations","schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"country":{"type":"string","description":"ISO country code"},"marketName":{"type":"string","description":"Country/market name"},"category":{"type":"string","description":"Message category"},"messages":{"type":"number","description":"Number of messages"},"isRegional":{"type":"boolean","description":"Whether this is regional pricing"},"pricing":{"type":"array","description":"Cost breakdown by currency","items":{"type":"object","properties":{"currency":{"type":"string","description":"Currency code"},"pricePerMessage":{"type":"number","description":"Price per message in this currency"},"messages":{"type":"number","description":"Number of messages"},"totalCost":{"type":"number","description":"Total cost in this currency"},"effectiveDate":{"type":"string","format":"date-time","description":"Date when price became effective"}}}},"error":{"type":"string","description":"Error message if calculation failed"}}}},"total":{"type":"number","description":"Total number of calculations"}}}},"400":{"description":"Invalid request body","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Calculate cost for single country\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/waba/prices \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '[{\"country\":\"US\",\"category\":\"marketing\",\"quantity\":1000}]'\n\n\n// Calculate messaging costs by phone prefix and category\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/waba/prices \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '[{\"phonePrefix\":44,\"category\":\"utility\",\"quantity\":1200},{\"phonePrefix\":44,\"category\":\"marketing\",\"quantity\":3000}]'\n\n\n// Calculate messaging costs for multiple countries and phone prefixes\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/waba/prices \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '[{\"country\":\"US\",\"category\":\"marketing\",\"quantity\":1000},{\"country\":\"GB\",\"category\":\"utility\",\"quantity\":2000},{\"phonePrefix\":91,\"category\":\"authentication\",\"quantity\":10000}]'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Calculate cost for single country\necho '[{\"country\":\"US\",\"category\":\"marketing\",\"quantity\":1000}]' |  \\\n  http POST https://api.wassenger.com/v1/waba/prices \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Calculate messaging costs by phone prefix and category\necho '[{\"phonePrefix\":44,\"category\":\"utility\",\"quantity\":1200},{\"phonePrefix\":44,\"category\":\"marketing\",\"quantity\":3000}]' |  \\\n  http POST https://api.wassenger.com/v1/waba/prices \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Calculate messaging costs for multiple countries and phone prefixes\necho '[{\"country\":\"US\",\"category\":\"marketing\",\"quantity\":1000},{\"country\":\"GB\",\"category\":\"utility\",\"quantity\":2000},{\"phonePrefix\":91,\"category\":\"authentication\",\"quantity\":10000}]' |  \\\n  http POST https://api.wassenger.com/v1/waba/prices \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Calculate cost for single country\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/waba/prices';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"country\":\"US\",\"category\":\"marketing\",\"quantity\":1000}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Calculate messaging costs by phone prefix and category\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/waba/prices';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"phonePrefix\":44,\"category\":\"utility\",\"quantity\":1200},{\"phonePrefix\":44,\"category\":\"marketing\",\"quantity\":3000}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Calculate messaging costs for multiple countries and phone prefixes\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/waba/prices';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"country\":\"US\",\"category\":\"marketing\",\"quantity\":1000},{\"country\":\"GB\",\"category\":\"utility\",\"quantity\":2000},{\"phonePrefix\":91,\"category\":\"authentication\",\"quantity\":10000}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Calculate cost for single country\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/waba/prices',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: [{country: 'US', category: 'marketing', quantity: 1000}]\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Calculate messaging costs by phone prefix and category\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/waba/prices',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: [\n    {phonePrefix: 44, category: 'utility', quantity: 1200},\n    {phonePrefix: 44, category: 'marketing', quantity: 3000}\n  ]\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Calculate messaging costs for multiple countries and phone prefixes\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/waba/prices',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: [\n    {country: 'US', category: 'marketing', quantity: 1000},\n    {country: 'GB', category: 'utility', quantity: 2000},\n    {phonePrefix: 91, category: 'authentication', quantity: 10000}\n  ]\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Calculate cost for single country\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/waba/prices');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send([\n  {\n    country: 'US',\n    category: 'marketing',\n    quantity: 1000\n  }\n]);\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Calculate messaging costs by phone prefix and category\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/waba/prices');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send([\n  {\n    phonePrefix: 44,\n    category: 'utility',\n    quantity: 1200\n  },\n  {\n    phonePrefix: 44,\n    category: 'marketing',\n    quantity: 3000\n  }\n]);\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Calculate messaging costs for multiple countries and phone prefixes\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/waba/prices');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send([\n  {\n    country: 'US',\n    category: 'marketing',\n    quantity: 1000\n  },\n  {\n    country: 'GB',\n    category: 'utility',\n    quantity: 2000\n  },\n  {\n    phonePrefix: 91,\n    category: 'authentication',\n    quantity: 10000\n  }\n]);\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Calculate cost for single country\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/waba/prices', [\n  'body' => '[{\"country\":\"US\",\"category\":\"marketing\",\"quantity\":1000}]',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Calculate messaging costs by phone prefix and category\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/waba/prices', [\n  'body' => '[{\"phonePrefix\":44,\"category\":\"utility\",\"quantity\":1200},{\"phonePrefix\":44,\"category\":\"marketing\",\"quantity\":3000}]',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Calculate messaging costs for multiple countries and phone prefixes\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/waba/prices', [\n  'body' => '[{\"country\":\"US\",\"category\":\"marketing\",\"quantity\":1000},{\"country\":\"GB\",\"category\":\"utility\",\"quantity\":2000},{\"phonePrefix\":91,\"category\":\"authentication\",\"quantity\":10000}]',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Calculate cost for single country\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  [\n    'country' => 'US',\n    'category' => 'marketing',\n    'quantity' => 1000\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/waba/prices');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Calculate messaging costs by phone prefix and category\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  [\n    'phonePrefix' => 44,\n    'category' => 'utility',\n    'quantity' => 1200\n  ],\n  [\n    'phonePrefix' => 44,\n    'category' => 'marketing',\n    'quantity' => 3000\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/waba/prices');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Calculate messaging costs for multiple countries and phone prefixes\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  [\n    'country' => 'US',\n    'category' => 'marketing',\n    'quantity' => 1000\n  ],\n  [\n    'country' => 'GB',\n    'category' => 'utility',\n    'quantity' => 2000\n  ],\n  [\n    'phonePrefix' => 91,\n    'category' => 'authentication',\n    'quantity' => 10000\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/waba/prices');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Calculate cost for single country\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/waba/prices\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    [\n        'country' => 'US',\n        'category' => 'marketing',\n        'quantity' => 1000\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Calculate messaging costs by phone prefix and category\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/waba/prices\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    [\n        'phonePrefix' => 44,\n        'category' => 'utility',\n        'quantity' => 1200\n    ],\n    [\n        'phonePrefix' => 44,\n        'category' => 'marketing',\n        'quantity' => 3000\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Calculate messaging costs for multiple countries and phone prefixes\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/waba/prices\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    [\n        'country' => 'US',\n        'category' => 'marketing',\n        'quantity' => 1000\n    ],\n    [\n        'country' => 'GB',\n        'category' => 'utility',\n        'quantity' => 2000\n    ],\n    [\n        'phonePrefix' => 91,\n        'category' => 'authentication',\n        'quantity' => 10000\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Calculate cost for single country\nimport requests\n\nurl = \"https://api.wassenger.com/v1/waba/prices\"\n\npayload = [\n    {\n        \"country\": \"US\",\n        \"category\": \"marketing\",\n        \"quantity\": 1000\n    }\n]\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Calculate messaging costs by phone prefix and category\nimport requests\n\nurl = \"https://api.wassenger.com/v1/waba/prices\"\n\npayload = [\n    {\n        \"phonePrefix\": 44,\n        \"category\": \"utility\",\n        \"quantity\": 1200\n    },\n    {\n        \"phonePrefix\": 44,\n        \"category\": \"marketing\",\n        \"quantity\": 3000\n    }\n]\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Calculate messaging costs for multiple countries and phone prefixes\nimport requests\n\nurl = \"https://api.wassenger.com/v1/waba/prices\"\n\npayload = [\n    {\n        \"country\": \"US\",\n        \"category\": \"marketing\",\n        \"quantity\": 1000\n    },\n    {\n        \"country\": \"GB\",\n        \"category\": \"utility\",\n        \"quantity\": 2000\n    },\n    {\n        \"phonePrefix\": 91,\n        \"category\": \"authentication\",\n        \"quantity\": 10000\n    }\n]\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Calculate cost for single country\nconst url = 'https://api.wassenger.com/v1/waba/prices';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"country\":\"US\",\"category\":\"marketing\",\"quantity\":1000}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Calculate messaging costs by phone prefix and category\nconst url = 'https://api.wassenger.com/v1/waba/prices';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"phonePrefix\":44,\"category\":\"utility\",\"quantity\":1200},{\"phonePrefix\":44,\"category\":\"marketing\",\"quantity\":3000}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Calculate messaging costs for multiple countries and phone prefixes\nconst url = 'https://api.wassenger.com/v1/waba/prices';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"country\":\"US\",\"category\":\"marketing\",\"quantity\":1000},{\"country\":\"GB\",\"category\":\"utility\",\"quantity\":2000},{\"phonePrefix\":91,\"category\":\"authentication\",\"quantity\":10000}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Calculate cost for single country\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/waba/prices',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '[{\"country\":\"US\",\"category\":\"marketing\",\"quantity\":1000}]'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Calculate messaging costs by phone prefix and category\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/waba/prices',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '[{\"phonePrefix\":44,\"category\":\"utility\",\"quantity\":1200},{\"phonePrefix\":44,\"category\":\"marketing\",\"quantity\":3000}]'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Calculate messaging costs for multiple countries and phone prefixes\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/waba/prices',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '[{\"country\":\"US\",\"category\":\"marketing\",\"quantity\":1000},{\"country\":\"GB\",\"category\":\"utility\",\"quantity\":2000},{\"phonePrefix\":91,\"category\":\"authentication\",\"quantity\":10000}]'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Calculate cost for single country\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/waba/prices\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"[{\\\"country\\\":\\\"US\\\",\\\"category\\\":\\\"marketing\\\",\\\"quantity\\\":1000}]\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Calculate messaging costs by phone prefix and category\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/waba/prices\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"[{\\\"phonePrefix\\\":44,\\\"category\\\":\\\"utility\\\",\\\"quantity\\\":1200},{\\\"phonePrefix\\\":44,\\\"category\\\":\\\"marketing\\\",\\\"quantity\\\":3000}]\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Calculate messaging costs for multiple countries and phone prefixes\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/waba/prices\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"[{\\\"country\\\":\\\"US\\\",\\\"category\\\":\\\"marketing\\\",\\\"quantity\\\":1000},{\\\"country\\\":\\\"GB\\\",\\\"category\\\":\\\"utility\\\",\\\"quantity\\\":2000},{\\\"phonePrefix\\\":91,\\\"category\\\":\\\"authentication\\\",\\\"quantity\\\":10000}]\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Calculate cost for single country\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/waba/prices\"\n\n\tpayload := strings.NewReader(\"[{\\\"country\\\":\\\"US\\\",\\\"category\\\":\\\"marketing\\\",\\\"quantity\\\":1000}]\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Calculate messaging costs by phone prefix and category\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/waba/prices\"\n\n\tpayload := strings.NewReader(\"[{\\\"phonePrefix\\\":44,\\\"category\\\":\\\"utility\\\",\\\"quantity\\\":1200},{\\\"phonePrefix\\\":44,\\\"category\\\":\\\"marketing\\\",\\\"quantity\\\":3000}]\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Calculate messaging costs for multiple countries and phone prefixes\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/waba/prices\"\n\n\tpayload := strings.NewReader(\"[{\\\"country\\\":\\\"US\\\",\\\"category\\\":\\\"marketing\\\",\\\"quantity\\\":1000},{\\\"country\\\":\\\"GB\\\",\\\"category\\\":\\\"utility\\\",\\\"quantity\\\":2000},{\\\"phonePrefix\\\":91,\\\"category\\\":\\\"authentication\\\",\\\"quantity\\\":10000}]\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Calculate cost for single country\nvar client = new RestClient(\"https://api.wassenger.com/v1/waba/prices\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"[{\\\"country\\\":\\\"US\\\",\\\"category\\\":\\\"marketing\\\",\\\"quantity\\\":1000}]\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Calculate messaging costs by phone prefix and category\nvar client = new RestClient(\"https://api.wassenger.com/v1/waba/prices\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"[{\\\"phonePrefix\\\":44,\\\"category\\\":\\\"utility\\\",\\\"quantity\\\":1200},{\\\"phonePrefix\\\":44,\\\"category\\\":\\\"marketing\\\",\\\"quantity\\\":3000}]\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Calculate messaging costs for multiple countries and phone prefixes\nvar client = new RestClient(\"https://api.wassenger.com/v1/waba/prices\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"[{\\\"country\\\":\\\"US\\\",\\\"category\\\":\\\"marketing\\\",\\\"quantity\\\":1000},{\\\"country\\\":\\\"GB\\\",\\\"category\\\":\\\"utility\\\",\\\"quantity\\\":2000},{\\\"phonePrefix\\\":91,\\\"category\\\":\\\"authentication\\\",\\\"quantity\\\":10000}]\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Calculate cost for single country\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/waba/prices\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"[{\\\"country\\\":\\\"US\\\",\\\"category\\\":\\\"marketing\\\",\\\"quantity\\\":1000}]\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Calculate messaging costs by phone prefix and category\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/waba/prices\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"[{\\\"phonePrefix\\\":44,\\\"category\\\":\\\"utility\\\",\\\"quantity\\\":1200},{\\\"phonePrefix\\\":44,\\\"category\\\":\\\"marketing\\\",\\\"quantity\\\":3000}]\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Calculate messaging costs for multiple countries and phone prefixes\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/waba/prices\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"[{\\\"country\\\":\\\"US\\\",\\\"category\\\":\\\"marketing\\\",\\\"quantity\\\":1000},{\\\"country\\\":\\\"GB\\\",\\\"category\\\":\\\"utility\\\",\\\"quantity\\\":2000},{\\\"phonePrefix\\\":91,\\\"category\\\":\\\"authentication\\\",\\\"quantity\\\":10000}]\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Calculate cost for single country\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/waba/prices\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"[{\\\"country\\\":\\\"US\\\",\\\"category\\\":\\\"marketing\\\",\\\"quantity\\\":1000}]\")\n  .asString();\n\n\n// Calculate messaging costs by phone prefix and category\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/waba/prices\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"[{\\\"phonePrefix\\\":44,\\\"category\\\":\\\"utility\\\",\\\"quantity\\\":1200},{\\\"phonePrefix\\\":44,\\\"category\\\":\\\"marketing\\\",\\\"quantity\\\":3000}]\")\n  .asString();\n\n\n// Calculate messaging costs for multiple countries and phone prefixes\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/waba/prices\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"[{\\\"country\\\":\\\"US\\\",\\\"category\\\":\\\"marketing\\\",\\\"quantity\\\":1000},{\\\"country\\\":\\\"GB\\\",\\\"category\\\":\\\"utility\\\",\\\"quantity\\\":2000},{\\\"phonePrefix\\\":91,\\\"category\\\":\\\"authentication\\\",\\\"quantity\\\":10000}]\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Calculate cost for single country\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"[{\\\"country\\\":\\\"US\\\",\\\"category\\\":\\\"marketing\\\",\\\"quantity\\\":1000}]\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/waba/prices\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Calculate messaging costs by phone prefix and category\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"[{\\\"phonePrefix\\\":44,\\\"category\\\":\\\"utility\\\",\\\"quantity\\\":1200},{\\\"phonePrefix\\\":44,\\\"category\\\":\\\"marketing\\\",\\\"quantity\\\":3000}]\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/waba/prices\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Calculate messaging costs for multiple countries and phone prefixes\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"[{\\\"country\\\":\\\"US\\\",\\\"category\\\":\\\"marketing\\\",\\\"quantity\\\":1000},{\\\"country\\\":\\\"GB\\\",\\\"category\\\":\\\"utility\\\",\\\"quantity\\\":2000},{\\\"phonePrefix\\\":91,\\\"category\\\":\\\"authentication\\\",\\\"quantity\\\":10000}]\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/waba/prices\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Calculate cost for single country\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/waba/prices\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"[{\\\"country\\\":\\\"US\\\",\\\"category\\\":\\\"marketing\\\",\\\"quantity\\\":1000}]\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Calculate messaging costs by phone prefix and category\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/waba/prices\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"[{\\\"phonePrefix\\\":44,\\\"category\\\":\\\"utility\\\",\\\"quantity\\\":1200},{\\\"phonePrefix\\\":44,\\\"category\\\":\\\"marketing\\\",\\\"quantity\\\":3000}]\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Calculate messaging costs for multiple countries and phone prefixes\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/waba/prices\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"[{\\\"country\\\":\\\"US\\\",\\\"category\\\":\\\"marketing\\\",\\\"quantity\\\":1000},{\\\"country\\\":\\\"GB\\\",\\\"category\\\":\\\"utility\\\",\\\"quantity\\\":2000},{\\\"phonePrefix\\\":91,\\\"category\\\":\\\"authentication\\\",\\\"quantity\\\":10000}]\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Calculate cost for single country\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/waba/prices' -Method POST -Headers $headers -ContentType 'application/json' -Body '[{\"country\":\"US\",\"category\":\"marketing\",\"quantity\":1000}]'\n\n\n# Calculate messaging costs by phone prefix and category\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/waba/prices' -Method POST -Headers $headers -ContentType 'application/json' -Body '[{\"phonePrefix\":44,\"category\":\"utility\",\"quantity\":1200},{\"phonePrefix\":44,\"category\":\"marketing\",\"quantity\":3000}]'\n\n\n# Calculate messaging costs for multiple countries and phone prefixes\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/waba/prices' -Method POST -Headers $headers -ContentType 'application/json' -Body '[{\"country\":\"US\",\"category\":\"marketing\",\"quantity\":1000},{\"country\":\"GB\",\"category\":\"utility\",\"quantity\":2000},{\"phonePrefix\":91,\"category\":\"authentication\",\"quantity\":10000}]'"},{"lang":"ObjC","source":"// Calculate cost for single country\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @[ @{ @\"country\": @\"US\", @\"category\": @\"marketing\", @\"quantity\": @1000 } ];\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/waba/prices\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Calculate messaging costs by phone prefix and category\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @[ @{ @\"phonePrefix\": @44, @\"category\": @\"utility\", @\"quantity\": @1200 },\n                              @{ @\"phonePrefix\": @44, @\"category\": @\"marketing\", @\"quantity\": @3000 } ];\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/waba/prices\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Calculate messaging costs for multiple countries and phone prefixes\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @[ @{ @\"country\": @\"US\", @\"category\": @\"marketing\", @\"quantity\": @1000 },\n                              @{ @\"country\": @\"GB\", @\"category\": @\"utility\", @\"quantity\": @2000 },\n                              @{ @\"phonePrefix\": @91, @\"category\": @\"authentication\", @\"quantity\": @10000 } ];\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/waba/prices\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Calculate cost for single country\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  [\n    \"country\": \"US\",\n    \"category\": \"marketing\",\n    \"quantity\": 1000\n  ]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/waba/prices\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Calculate messaging costs by phone prefix and category\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  [\n    \"phonePrefix\": 44,\n    \"category\": \"utility\",\n    \"quantity\": 1200\n  ],\n  [\n    \"phonePrefix\": 44,\n    \"category\": \"marketing\",\n    \"quantity\": 3000\n  ]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/waba/prices\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Calculate messaging costs for multiple countries and phone prefixes\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  [\n    \"country\": \"US\",\n    \"category\": \"marketing\",\n    \"quantity\": 1000\n  ],\n  [\n    \"country\": \"GB\",\n    \"category\": \"utility\",\n    \"quantity\": 2000\n  ],\n  [\n    \"phonePrefix\": 91,\n    \"category\": \"authentication\",\n    \"quantity\": 10000\n  ]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/waba/prices\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/waba/flows/responses":{"parameters":[],"get":{"summary":"List the responses to a WhatsApp Form","description":"Answers customers sent through a WhatsApp Form (Meta WhatsApp Flow), newest first. Only the account owner and admins can read them.","operationId":"getFlowResponses","tags":["Flows"],"security":[{"apiKey":[]}],"parameters":[{"in":"query","name":"id","type":"string","required":true,"minLength":24,"maxLength":24,"pattern":"^[a-fA-F0-9]{24}$","description":"WhatsApp Form ID (the \"id\" returned by GET /waba/flows)"},{"in":"query","name":"from","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"First day (YYYY-MM-DD, UTC)"},{"in":"query","name":"to","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Last day (YYYY-MM-DD, UTC)"},{"in":"query","name":"campaign","type":"string","pattern":"^[a-fA-F0-9]{24}$","description":"Only responses to this campaign"},{"in":"query","name":"device","type":"string","pattern":"^[a-fA-F0-9]{24}$","description":"Only responses received on this number"},{"in":"query","name":"page","type":"integer","minimum":0,"description":"Page, from 0"},{"in":"query","name":"size","type":"integer","minimum":1,"maximum":100,"description":"Responses per page (default 25)"}],"responses":{"200":{"description":"A page of responses, newest first, with the total"},"403":{"description":"The key belongs to a team member who is not an admin"},"404":{"description":"No such form in this account"}}}},"/waba/flows":{"parameters":[],"get":{"summary":"List WhatsApp Flows","operationId":"getFlows","tags":["Flows"],"security":[{"apiKey":[]}],"parameters":[{"in":"query","name":"waba","type":"string","description":"Filter by WhatsApp Business Account (WABA) ID"},{"in":"query","name":"status","type":"string","description":"Filter by flow status (DRAFT, PUBLISHED, DEPRECATED, THROTTLED, BLOCKED)"}],"responses":{"200":{"description":"List of WhatsApp Flows"}}}},"/waba/dedupe-templates":{"parameters":[]},"/waba/dedupe-flows":{"parameters":[]},"/waba/catalog":{"parameters":[]},"/verify/username":{"parameters":[],"post":{"summary":"Username exists","description":"Check if a given WhatsApp username / handle exists in WhatsApp and retrieve its associated account id (`wid`). The check is performed in real-time against WhatsApp.\n\n\n\n\n\nYou can check one username at a time. In order to check multiple usernames, you may send multiple HTTPS requests to the API.\n\n\n\n\n\nThe username check is performend in real-time, so your WhatsApp number session must be online and synced, otherwise the API will return a `503 - Not Available` error.\n\n\n\n\n\n**Important**: some usernames require a 4-digit key before WhatsApp will reveal the associated account id. When this happens the response comes back with `exists: true`, `keyRequired: true` and `wid: null` -- this is a normal, positive existence result and currently the common case during rollout, not an error. Resubmit the request with the `key` field once you have it to resolve the `wid`.\n\n\n\n\n\nFor username format validation with no WhatsApp existence check, please see the [Validate/Username](#operation/validateUsername) API endpoint.\n\n\n\n\n\n**Billing note**: each check that returns a `200` (`exists: true` or `false`, with or without `keyRequired`) consumes one unit from the same monthly number-check allowance used by [Numbers/Exists](#operation/verifyNumber) -- username and phone verification share one quota, they are not counted separately. The allowance is enforced, not merely counted: once it is exhausted the request is refused with a `429` before any check is made against WhatsApp. A request rejected by the local format pre-check, refused or throttled with a `429`, or failing with a `503` (no candidate device could complete the check) consumes nothing. Format-only checks cost nothing regardless; see [Validate/Username](#operation/validateUsername) for those.\n\n\n\n\n\nThe `errorCode` field on a `400` response is a code you can match on. Three outcomes are possible. A request rejected by the local format pre-check (the common case) returns `error:username:<CODE>`, where `<CODE>` is exactly the `error` value documented on [Validate/Username](#operation/validateUsername) -- `INVALID_CHARACTER`, `INVALID_LENGTH`, `INVALID_NO_LETTERS`, `INVALID_PERIODS`, `INVALID_WWW_PREFIX`, `INVALID_DOMAIN_SUFFIX` or `INVALID_WORD`. In the rarer case where our local pre-check disagrees with WhatsApp's own live validator, the `400` is passed through from WhatsApp's side instead, as `error:usernameExists:<code>` with `<code>` one of `empty`, `length`, `invalid_character`, `invalid_no_letters`, `invalid_periods`, `invalid_www_prefix`, `invalid_domain_suffix` or `invalid_word` (lowercase). Third, a malformed `key` (not exactly 4 digits) fails validation before any WhatsApp call and returns a generic `error:generic` with no more specific code -- send a well-formed `key` to avoid it. See the exact set in the `400` response schema below. A WhatsApp-side timeout or unavailability is never a `400` -- it surfaces as a `503` with a generic `errorCode`, since no candidate device could complete the check.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fverify%2Fusername&method=POST&body=%7B%0A%20%20%22username%22%3A%20%22johndoe%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"verifyUsername","tags":["Verify"],"produces":["application/json","application/x-www-form-urlencoded"],"consumes":["application/json"],"security":[{"apiKey":[]}],"parameters":[{"in":"body","name":"body","description":"Username to check for existence in WhatsApp","schema":{"type":"object","required":["username"],"properties":{"username":{"type":"string","description":"WhatsApp username / handle to verify, with or without the leading \"@\""},"key":{"type":"string","description":"Key required by WhatsApp to reveal the account id for some usernames, once known -- must be exactly 4 digits (0-9), or the request is rejected before reaching WhatsApp. See the `keyRequired` response field."}}}}],"responses":{"200":{"description":"Username lookup result","schema":{"type":"object","properties":{"username":{"type":"string","description":"Normalized username that was checked"},"exists":{"type":"boolean","default":false,"description":"Value will be `true` if the given username exists within the WhatsApp network, otherwise `false`."},"keyRequired":{"type":"boolean","default":false,"description":"Value will be `true` when the handle exists but WhatsApp requires a 4-digit key before revealing the account id. This is a positive existence result -- the common case during rollout -- and must not be treated as an error."},"wid":{"type":"string","description":"WhatsApp contact ID resolved for the username, when available. This is a LID (`<id>@lid`), not a phone-based id -- WhatsApp does not expose a phone number for an account resolved by username, so no `@c.us` id or E.164 number is available from this endpoint. `null` while `keyRequired` is `true` and the key has not been supplied."},"isBusiness":{"type":"boolean","default":false,"description":"If the given username exists and is a WhatsApp Business account it will be `true`, otherwise `false`."},"businessInfo":{"type":"object","description":"If the account is a Business account, the WhatsApp Business information will be available here"},"wasUpdated":{"type":"boolean","default":false,"description":"Reported by WhatsApp: `true` when the lookup created or refreshed a local record for the account as a side effect. Informational only -- it says nothing about whether the username exists."},"isUsernameSearch":{"type":"boolean","default":false,"description":"Reported by WhatsApp: `true` when the answer came from the username directory rather than a phone or account-id query. Present on `keyRequired` results as well as fully resolved ones."}}}},"400":{"description":"Bad request or invalid username format","schema":{"type":"object","properties":{"message":{"type":"string","description":"Human-readable rejection reason"},"errorCode":{"type":"string","description":"Machine-readable rejection reason. `error:username:<CODE>` comes from the local format pre-check (the common case); `error:usernameExists:<code>` is passed through from WhatsApp's own validator on the rarer occasions it disagrees with the local pre-check; `error:generic` means a malformed `key` (not exactly 4 digits) was rejected before any WhatsApp call was made.","enum":["error:username:INVALID_CHARACTER","error:username:INVALID_LENGTH","error:username:INVALID_NO_LETTERS","error:username:INVALID_PERIODS","error:username:INVALID_WWW_PREFIX","error:username:INVALID_DOMAIN_SUFFIX","error:username:INVALID_WORD","error:usernameExists:empty","error:usernameExists:length","error:usernameExists:invalid_character","error:usernameExists:invalid_no_letters","error:usernameExists:invalid_periods","error:usernameExists:invalid_www_prefix","error:usernameExists:invalid_domain_suffix","error:usernameExists:invalid_word","error:generic"]}}}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Either the monthly number-check allowance for your subscription plan is exhausted, or WhatsApp is throttling username checks for this number session -- the message body tells the two apart. The throttling case clears in a few seconds; the allowance case needs a plan upgrade or the next billing cycle.","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Server error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"WhatsApp session not online or Service not available","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Validate if a username exists in WhatsApp\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/verify/username \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"username\":\"johndoe\"}'\n\n\n// Resolve a username that previously required a key\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/verify/username \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"username\":\"johndoe\",\"key\":\"1234\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Validate if a username exists in WhatsApp\necho '{\"username\":\"johndoe\"}' |  \\\n  http POST https://api.wassenger.com/v1/verify/username \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Resolve a username that previously required a key\necho '{\"username\":\"johndoe\",\"key\":\"1234\"}' |  \\\n  http POST https://api.wassenger.com/v1/verify/username \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Validate if a username exists in WhatsApp\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/verify/username';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"username\":\"johndoe\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Resolve a username that previously required a key\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/verify/username';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"username\":\"johndoe\",\"key\":\"1234\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Validate if a username exists in WhatsApp\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/verify/username',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {username: 'johndoe'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Resolve a username that previously required a key\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/verify/username',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {username: 'johndoe', key: '1234'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Validate if a username exists in WhatsApp\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/verify/username');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  username: 'johndoe'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Resolve a username that previously required a key\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/verify/username');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  username: 'johndoe',\n  key: '1234'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Validate if a username exists in WhatsApp\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/verify/username', [\n  'body' => '{\"username\":\"johndoe\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Resolve a username that previously required a key\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/verify/username', [\n  'body' => '{\"username\":\"johndoe\",\"key\":\"1234\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Validate if a username exists in WhatsApp\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'username' => 'johndoe'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/verify/username');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Resolve a username that previously required a key\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'username' => 'johndoe',\n  'key' => '1234'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/verify/username');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Validate if a username exists in WhatsApp\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/verify/username\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'username' => 'johndoe'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Resolve a username that previously required a key\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/verify/username\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'username' => 'johndoe',\n    'key' => '1234'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Validate if a username exists in WhatsApp\nimport requests\n\nurl = \"https://api.wassenger.com/v1/verify/username\"\n\npayload = { \"username\": \"johndoe\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Resolve a username that previously required a key\nimport requests\n\nurl = \"https://api.wassenger.com/v1/verify/username\"\n\npayload = {\n    \"username\": \"johndoe\",\n    \"key\": \"1234\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Validate if a username exists in WhatsApp\nconst url = 'https://api.wassenger.com/v1/verify/username';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"username\":\"johndoe\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Resolve a username that previously required a key\nconst url = 'https://api.wassenger.com/v1/verify/username';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"username\":\"johndoe\",\"key\":\"1234\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Validate if a username exists in WhatsApp\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/verify/username',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"username\":\"johndoe\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Resolve a username that previously required a key\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/verify/username',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"username\":\"johndoe\",\"key\":\"1234\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Validate if a username exists in WhatsApp\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/verify/username\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"username\\\":\\\"johndoe\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Resolve a username that previously required a key\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/verify/username\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"username\\\":\\\"johndoe\\\",\\\"key\\\":\\\"1234\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Validate if a username exists in WhatsApp\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/verify/username\"\n\n\tpayload := strings.NewReader(\"{\\\"username\\\":\\\"johndoe\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Resolve a username that previously required a key\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/verify/username\"\n\n\tpayload := strings.NewReader(\"{\\\"username\\\":\\\"johndoe\\\",\\\"key\\\":\\\"1234\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Validate if a username exists in WhatsApp\nvar client = new RestClient(\"https://api.wassenger.com/v1/verify/username\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"username\\\":\\\"johndoe\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Resolve a username that previously required a key\nvar client = new RestClient(\"https://api.wassenger.com/v1/verify/username\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"username\\\":\\\"johndoe\\\",\\\"key\\\":\\\"1234\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Validate if a username exists in WhatsApp\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/verify/username\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"username\\\":\\\"johndoe\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Resolve a username that previously required a key\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/verify/username\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"username\\\":\\\"johndoe\\\",\\\"key\\\":\\\"1234\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Validate if a username exists in WhatsApp\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/verify/username\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"username\\\":\\\"johndoe\\\"}\")\n  .asString();\n\n\n// Resolve a username that previously required a key\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/verify/username\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"username\\\":\\\"johndoe\\\",\\\"key\\\":\\\"1234\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Validate if a username exists in WhatsApp\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"username\\\":\\\"johndoe\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/verify/username\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Resolve a username that previously required a key\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"username\\\":\\\"johndoe\\\",\\\"key\\\":\\\"1234\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/verify/username\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Validate if a username exists in WhatsApp\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/verify/username\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"username\\\":\\\"johndoe\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Resolve a username that previously required a key\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/verify/username\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"username\\\":\\\"johndoe\\\",\\\"key\\\":\\\"1234\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Validate if a username exists in WhatsApp\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/verify/username' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"username\":\"johndoe\"}'\n\n\n# Resolve a username that previously required a key\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/verify/username' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"username\":\"johndoe\",\"key\":\"1234\"}'"},{"lang":"ObjC","source":"// Validate if a username exists in WhatsApp\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"username\": @\"johndoe\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/verify/username\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Resolve a username that previously required a key\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"username\": @\"johndoe\",\n                              @\"key\": @\"1234\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/verify/username\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Validate if a username exists in WhatsApp\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"username\": \"johndoe\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/verify/username\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Resolve a username that previously required a key\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"username\": \"johndoe\",\n  \"key\": \"1234\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/verify/username\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/verify/number":{"parameters":[],"post":{"summary":"Number exists","description":"Verify if a given phone number exists in WhatsApp and is able to receive messages.\n\n\n\nThe number format must be in E164 format, e.g: `+44692831121` or `+182932001912`\n\n\n\nYou can check one number at a time. In order to check multiple numbers, you may send multiple HTTPS requests to the API.\n\n\n\n\n\nDepending on your plan subscription, you may be able to check from 2,000 to 50,000 phone numbers per month.\n\n\n\n\n\nResults are cached. If the number was found on WhatsApp in the last 7 days, the answer comes from cache and does not count towards your monthly quota.\n\n\n\n\n\nOtherwise the number is checked in WhatsApp again, which counts towards your monthly quota. Sending `refresh: true` in the request body does the same: it skips the cache. Even a check in WhatsApp can return a result up to a day old.\n\n\n\n\n\nA check in WhatsApp needs your WhatsApp number session to be online and synced, otherwise the API will return a `503 - Not Available` error.\n\n\n\n\n\n**Important note**: avoid checking many numbers in a short period of time, as this may cause issues or even a ban of your WhatsApp number. We recommend no more than 30 number checks per minute, or 1 checks every 2 seconds.\n\n\n\n\n\nFor phone number format validation with no WhatsApp existence check, please see the [Numbers/Validate](#operation/validateNumbers) API endpoint.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fverify%2Fnumber&method=POST&body=%7B%0A%20%20%22phone%22%3A%20%22%2B1234567890%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"verifyNumber","tags":["Verify"],"produces":["application/json","application/x-www-form-urlencoded"],"consumes":["application/json"],"security":[{"apiKey":[]}],"parameters":[{"in":"body","name":"phone","description":"Check if a phone number exists in WhatsApp","schema":{"type":"object","properties":{"phone":{"type":"string","minLength":8,"maxLength":16},"refresh":{"type":"boolean","description":"Set to `true` to skip the cache and check the number in WhatsApp again. Without it, a number found on WhatsApp in the last 7 days is answered from cache. A check in WhatsApp counts towards your monthly quota, and can still return a result up to a day old.","default":false}},"required":["phone"],"additionalProperties":false}}],"responses":{"200":{"description":"Number exists","schema":{"type":"object","properties":{"phone":{"type":"string","description":"Normalized phone number in E164 format linked to WhatsApp"},"wid":{"type":"string","description":"WhatsApp contact ID"},"exists":{"type":"boolean","default":true,"description":"Value will be `true` if the given phone number exists within the WhatsApp network, otherwise `false`."},"isBusiness":{"type":"boolean","default":false,"description":"If the given number exists and is a WhatsApp Business number it will be `true`, otherwise `false`."},"link":{"type":"string","description":"WhatsApp open chat direct URL"},"businessInfo":{"type":"object","description":"If the number is a Business account, the WhatsApp Business information will be available here","properties":{"name":{"type":"string","description":"Business name"},"isApi":{"type":"boolean","default":false,"description":"If the business is an API account it will be `true`, otherwise `false`."},"isSmb":{"type":"boolean","default":true,"description":"If the business is a Small and Medium Business it will be `true`, otherwise `false`."},"level":{"type":"string","description":"Business verification level"},"privacyMode":{"type":"string","description":"Business privacy mode (optional)"}}},"country":{"type":"object","description":"Phone number country information","properties":{"code":{"type":"string","description":"Country 2-letter ISO code where the number is registered. Example: `GB`, `US`, `DE`, `IN`"},"name":{"type":"string","description":"Country name"},"officialName":{"type":"string","description":"Country official name"},"phonePrefix":{"type":"string","description":"Country phone international prefix"},"flag":{"type":"string","description":"Country flag emoji"},"domain":{"type":"string","description":"Country official domain name"},"currency":{"type":"string","description":"Country official currency as 3-letter ISO code. Example: `USD`, `EUR`, `GBP`"},"currencyName":{"type":"string","description":"Country official currency name"},"languages":{"type":"array","items":{"type":"string","description":"Country official 2-letter language code. Example: `en`, `es`, `de`, `hi`"}},"locales":{"type":"array","items":{"type":"string","description":"Country official locale code. Example: `en-US`, `es-ES`, `de-DE`, `hi-IN`"}},"timezones":{"type":"array","items":{"type":"string","description":"Country official timezone. Example: `America/New_York`, `Europe/Berlin`, `Asia/Kolkata`"}}}}}}},"400":{"description":"Bad request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Phone number does not exists in WhatsApp","schema":{"type":"object","properties":{"exists":{"type":"boolean","default":false}}}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Maximum number checks per month excedded","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Server error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"WhatsApp session not online or Service not available","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Validate if phone number exists in WhatsApp\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/verify/number \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"phone\":\"+1234567890\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Validate if phone number exists in WhatsApp\necho '{\"phone\":\"+1234567890\"}' |  \\\n  http POST https://api.wassenger.com/v1/verify/number \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Validate if phone number exists in WhatsApp\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/verify/number';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phone\":\"+1234567890\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Validate if phone number exists in WhatsApp\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/verify/number',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {phone: '+1234567890'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Validate if phone number exists in WhatsApp\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/verify/number');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  phone: '+1234567890'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Validate if phone number exists in WhatsApp\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/verify/number', [\n  'body' => '{\"phone\":\"+1234567890\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Validate if phone number exists in WhatsApp\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'phone' => '+1234567890'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/verify/number');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Validate if phone number exists in WhatsApp\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/verify/number\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'phone' => '+1234567890'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Validate if phone number exists in WhatsApp\nimport requests\n\nurl = \"https://api.wassenger.com/v1/verify/number\"\n\npayload = { \"phone\": \"+1234567890\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Validate if phone number exists in WhatsApp\nconst url = 'https://api.wassenger.com/v1/verify/number';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phone\":\"+1234567890\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Validate if phone number exists in WhatsApp\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/verify/number',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"phone\":\"+1234567890\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Validate if phone number exists in WhatsApp\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/verify/number\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"phone\\\":\\\"+1234567890\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Validate if phone number exists in WhatsApp\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/verify/number\"\n\n\tpayload := strings.NewReader(\"{\\\"phone\\\":\\\"+1234567890\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Validate if phone number exists in WhatsApp\nvar client = new RestClient(\"https://api.wassenger.com/v1/verify/number\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"phone\\\":\\\"+1234567890\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Validate if phone number exists in WhatsApp\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/verify/number\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"phone\\\":\\\"+1234567890\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Validate if phone number exists in WhatsApp\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/verify/number\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"phone\\\":\\\"+1234567890\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Validate if phone number exists in WhatsApp\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"phone\\\":\\\"+1234567890\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/verify/number\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Validate if phone number exists in WhatsApp\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/verify/number\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"phone\\\":\\\"+1234567890\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Validate if phone number exists in WhatsApp\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/verify/number' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"phone\":\"+1234567890\"}'"},{"lang":"ObjC","source":"// Validate if phone number exists in WhatsApp\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"phone\": @\"+1234567890\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/verify/number\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Validate if phone number exists in WhatsApp\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"phone\": \"+1234567890\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/verify/number\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/validate/username":{"parameters":[],"post":{"summary":"Validate username","description":"Helpful endpoint to validate and normalize a WhatsApp username / handle format.\n\n\n\n\n\nThe validation is only performed at format level (allowed characters, length, letters, periods and reserved domain suffixes) -- it does not check if the username actually exists on WhatsApp, requires no device session and consumes no number checks quota.\n\n\n\n\n\nThis endpoint is completely free and unmetered: unlike [Verify/Username](#operation/verifyUsername), it never counts against your monthly number-check allowance, regardless of how many times you call it.\n\n\n\n\n\nFor WhatsApp username existence validation, please see the [Verify/Username](#operation/verifyUsername) API endpoint.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fvalidate%2Fusername&method=POST&body=%7B%0A%20%20%22username%22%3A%20%22%40johndoe%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"validateUsername","tags":["Verify"],"produces":["application/json","application/x-www-form-urlencoded"],"consumes":["application/json"],"security":[{"apiKey":[]}],"parameters":[{"in":"body","name":"body","description":"Username to validate and normalize","schema":{"type":"object","required":["username"],"properties":{"username":{"type":"string","description":"WhatsApp username / handle to validate, with or without the leading \"@\""}}}}],"responses":{"200":{"description":"Validation result","schema":{"type":"object","properties":{"valid":{"type":"boolean","description":"Whether if the given username format is valid (`true`) or not (`false`)"},"error":{"description":"Error code when `valid` is `false`, otherwise `null`","enum":["INVALID_CHARACTER","INVALID_LENGTH","INVALID_NO_LETTERS","INVALID_PERIODS","INVALID_WWW_PREFIX","INVALID_DOMAIN_SUFFIX","INVALID_WORD",null]},"username":{"type":"string","description":"Normalized username (trimmed, leading \"@\" stripped), or `null` when empty"}}}},"400":{"description":"Bad request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Validates and normalizes a username format\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/validate/username \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"username\":\"@johndoe\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Validates and normalizes a username format\necho '{\"username\":\"@johndoe\"}' |  \\\n  http POST https://api.wassenger.com/v1/validate/username \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Validates and normalizes a username format\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/validate/username';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"username\":\"@johndoe\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Validates and normalizes a username format\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/validate/username',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {username: '@johndoe'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Validates and normalizes a username format\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/validate/username');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  username: '@johndoe'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Validates and normalizes a username format\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/validate/username', [\n  'body' => '{\"username\":\"@johndoe\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Validates and normalizes a username format\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'username' => '@johndoe'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/validate/username');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Validates and normalizes a username format\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/validate/username\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'username' => '@johndoe'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Validates and normalizes a username format\nimport requests\n\nurl = \"https://api.wassenger.com/v1/validate/username\"\n\npayload = { \"username\": \"@johndoe\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Validates and normalizes a username format\nconst url = 'https://api.wassenger.com/v1/validate/username';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"username\":\"@johndoe\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Validates and normalizes a username format\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/validate/username',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"username\":\"@johndoe\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Validates and normalizes a username format\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/validate/username\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"username\\\":\\\"@johndoe\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Validates and normalizes a username format\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/validate/username\"\n\n\tpayload := strings.NewReader(\"{\\\"username\\\":\\\"@johndoe\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Validates and normalizes a username format\nvar client = new RestClient(\"https://api.wassenger.com/v1/validate/username\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"username\\\":\\\"@johndoe\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Validates and normalizes a username format\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/validate/username\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"username\\\":\\\"@johndoe\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Validates and normalizes a username format\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/validate/username\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"username\\\":\\\"@johndoe\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Validates and normalizes a username format\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"username\\\":\\\"@johndoe\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/validate/username\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Validates and normalizes a username format\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/validate/username\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"username\\\":\\\"@johndoe\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Validates and normalizes a username format\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/validate/username' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"username\":\"@johndoe\"}'"},{"lang":"ObjC","source":"// Validates and normalizes a username format\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"username\": @\"@johndoe\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/validate/username\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Validates and normalizes a username format\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"username\": \"@johndoe\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/validate/username\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/validate/number":{"parameters":[],"post":{"summary":"Validate numbers (Validate alias)","description":"Alias of [Numbers/Validate](#operation/validateNumbers), grouped under `/validate` so number and username validation read as one family.\n\n\n\n\n\nSame handler, same response shape -- see that endpoint for full documentation.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fvalidate%2Fnumber&method=POST&body=%7B%0A%20%20%22prefix%22%3A%201%2C%0A%20%20%22numbers%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22phone%22%3A%20%22415-555-0142%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22phone%22%3A%20%22%2B1%20415%20555%200142%22%0A%20%20%20%20%7D%0A%20%20%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"validateNumber","tags":["Verify"],"produces":["application/json","application/x-www-form-urlencoded"],"consumes":["application/json"],"security":[{"apiKey":[]}],"parameters":[{"in":"body","name":"numbers","description":"List of phone numbers to validate and normalize","schema":{"type":"object","properties":{"country":{"type":"string","minLength":2,"maxLength":2,"description":"Optional country code of the numbers on the list. E.g: US, GB, IT, FR, DE. It does not change how the numbers are read: to read the ones written without + as numbers of a country, send its calling code as `prefix`."},"prefix":{"type":"number","format":"float","minimum":1,"maximum":9999,"description":"Optional country calling code as numeric value, put in front of every number on the list that does not start with +. E.g: 1, 2, 33, 44, 36..."},"numbers":{"type":"array","items":{"type":"object","properties":{"phone":{"type":"string","minLength":5,"maxLength":20,"description":"Phone number to parse and validate. It might be any type of string value with different formatting. The validator will parse and normalize the number for you. E.g: +1-415-555-0142, +1 (415) 555-0142, +14155550142, or (415) 555-0142 with prefix 1"},"country":{"type":"string","minLength":2,"maxLength":2,"description":"Optional country code of this number. E.g: US, GB, IT, FR, DE. It does not change how the number is read: to read it as a number of a country when written without +, send its calling code as `prefix`."},"prefix":{"type":"number","format":"float","minimum":1,"maximum":9999,"description":"Optional country calling code as numeric value, put in front of this number unless it starts with +. E.g: 1, 2, 33, 44, 36..."}},"required":["phone"],"additionalProperties":false},"minItems":1,"maxItems":1000,"description":"List of phone numbers to validate and normalize. At least one item should be provided."}},"required":["numbers"],"additionalProperties":false}}],"responses":{"200":{"description":"Validation results","schema":{"type":"object","properties":{"numbers":{"type":"array","items":{"type":"object","properties":{"valid":{"type":"boolean","description":"Whether if the given phone number is valid (`true`) or not (`false`)"},"error":{"type":"string","description":"Human-readable error message in case of invalid or failed phone number validation, when applicable"},"phone":{"type":"string","description":"Normalized phone number in E164 format"},"wid":{"type":"string","description":"WhatsApp contact ID"},"input":{"type":"string","description":"Original input text to validate and normalize as phone number"},"kind":{"type":"string","description":"Phone number kind","enum":["fixed_line","mobile","fixed_line_or_mobile","toll_free","premium_rate","shared_cost","voip","personal_number","pager","uan","voicemail","unknown"]},"countryPrefix":{"type":"number","minimum":1,"maximum":9999,"description":"Country calling code prefix. E.g: 1, 2, 44, 55, 33"},"country":{"type":"string","description":"Country ISO code. E.g: US, GB, BR, DE, FR, IT"},"formats":{"type":"object","properties":{"local":{"type":"string"},"national":{"type":"string"},"international":{"type":"string"}}}}}},"summary":{"type":"object","properties":{"valid":{"type":"number","default":0,"description":"Total valid numbers"},"invalid":{"type":"number","default":0,"description":"Total invvalid numbers"}}}}}},"400":{"description":"Bad request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service unavailable","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/validate/number \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"prefix\":1,\"numbers\":[{\"phone\":\"415-555-0142\"},{\"phone\":\"+1 415 555 0142\"}]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\necho '{\"prefix\":1,\"numbers\":[{\"phone\":\"415-555-0142\"},{\"phone\":\"+1 415 555 0142\"}]}' |  \\\n  http POST https://api.wassenger.com/v1/validate/number \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/validate/number';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"prefix\":1,\"numbers\":[{\"phone\":\"415-555-0142\"},{\"phone\":\"+1 415 555 0142\"}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/validate/number',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {prefix: 1, numbers: [{phone: '415-555-0142'}, {phone: '+1 415 555 0142'}]}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/validate/number');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  prefix: 1,\n  numbers: [\n    {\n      phone: '415-555-0142'\n    },\n    {\n      phone: '+1 415 555 0142'\n    }\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/validate/number', [\n  'body' => '{\"prefix\":1,\"numbers\":[{\"phone\":\"415-555-0142\"},{\"phone\":\"+1 415 555 0142\"}]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'prefix' => 1,\n  'numbers' => [\n    [\n        'phone' => '415-555-0142'\n    ],\n    [\n        'phone' => '+1 415 555 0142'\n    ]\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/validate/number');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/validate/number\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'prefix' => 1,\n    'numbers' => [\n        [\n                'phone' => '415-555-0142'\n        ],\n        [\n                'phone' => '+1 415 555 0142'\n        ]\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nimport requests\n\nurl = \"https://api.wassenger.com/v1/validate/number\"\n\npayload = {\n    \"prefix\": 1,\n    \"numbers\": [{ \"phone\": \"415-555-0142\" }, { \"phone\": \"+1 415 555 0142\" }]\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nconst url = 'https://api.wassenger.com/v1/validate/number';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"prefix\":1,\"numbers\":[{\"phone\":\"415-555-0142\"},{\"phone\":\"+1 415 555 0142\"}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/validate/number',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"prefix\":1,\"numbers\":[{\"phone\":\"415-555-0142\"},{\"phone\":\"+1 415 555 0142\"}]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/validate/number\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"prefix\\\":1,\\\"numbers\\\":[{\\\"phone\\\":\\\"415-555-0142\\\"},{\\\"phone\\\":\\\"+1 415 555 0142\\\"}]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/validate/number\"\n\n\tpayload := strings.NewReader(\"{\\\"prefix\\\":1,\\\"numbers\\\":[{\\\"phone\\\":\\\"415-555-0142\\\"},{\\\"phone\\\":\\\"+1 415 555 0142\\\"}]}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nvar client = new RestClient(\"https://api.wassenger.com/v1/validate/number\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"prefix\\\":1,\\\"numbers\\\":[{\\\"phone\\\":\\\"415-555-0142\\\"},{\\\"phone\\\":\\\"+1 415 555 0142\\\"}]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/validate/number\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"prefix\\\":1,\\\"numbers\\\":[{\\\"phone\\\":\\\"415-555-0142\\\"},{\\\"phone\\\":\\\"+1 415 555 0142\\\"}]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/validate/number\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"prefix\\\":1,\\\"numbers\\\":[{\\\"phone\\\":\\\"415-555-0142\\\"},{\\\"phone\\\":\\\"+1 415 555 0142\\\"}]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"prefix\\\":1,\\\"numbers\\\":[{\\\"phone\\\":\\\"415-555-0142\\\"},{\\\"phone\\\":\\\"+1 415 555 0142\\\"}]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/validate/number\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/validate/number\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"prefix\\\":1,\\\"numbers\\\":[{\\\"phone\\\":\\\"415-555-0142\\\"},{\\\"phone\\\":\\\"+1 415 555 0142\\\"}]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/validate/number' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"prefix\":1,\"numbers\":[{\"phone\":\"415-555-0142\"},{\"phone\":\"+1 415 555 0142\"}]}'"},{"lang":"ObjC","source":"// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"prefix\": @1,\n                              @\"numbers\": @[ @{ @\"phone\": @\"415-555-0142\" }, @{ @\"phone\": @\"+1 415 555 0142\" } ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/validate/number\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"prefix\": 1,\n  \"numbers\": [[\"phone\": \"415-555-0142\"], [\"phone\": \"+1 415 555 0142\"]]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/validate/number\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/team":{"parameters":[],"get":{"summary":"Get users","description":"Retrieve team mebers available in your account. Team members may have access to one or multiple WhatsApp devices in your account. Team members are only available in Chat enabled subscription plans.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fteam)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getTeamUsers","tags":["Team Members"],"produces":["application/json"],"parameters":[{"in":"query","name":"ids","type":"array","description":"Optionally filter users by ID","maxItems":30,"collectionFormat":"csv","items":{"type":"string","minLength":24,"maxLength":24,"pattern":"^[0-9A-Fa-f]{24}$"}},{"in":"query","name":"status","type":"array","default":"any","description":"Optionally filter by user status","maxItems":10,"collectionFormat":"csv","items":{"type":"string","enum":["any","removed","pending","inactive","active"]}},{"in":"query","name":"role","type":"array","default":"any","description":"Optionally filter by user role","maxItems":5,"collectionFormat":"csv","items":{"type":"string","enum":["any","admin","supervisor","agent"]}},{"in":"query","name":"search","type":"string","maxLength":100,"minLength":2,"description":"Search users by text"},{"in":"query","name":"device","type":"string","maxLength":24,"minLength":24,"description":"Optionally filter users that have access to a specific WhatsApp number device ID","pattern":"^[0-9A-Fa-f]{24}$"},{"in":"query","name":"exceptIds","type":"array","maxItems":50,"collectionFormat":"csv","items":{"type":"string","minLength":24,"maxLength":24,"pattern":"^[0-9A-Fa-f]{24}$"},"description":"Optionally retrieve users except the ones with the given user IDs, comma-separated"},{"in":"query","name":"onlineBefore","type":"string","format":"date-time","maxLength":27,"minLength":24,"description":"Filter users by last online seen date before a specific ISO 8601 date and time. E.g: `2024-01-15T12:30:00Z`"},{"in":"query","name":"onlineAfter","type":"string","format":"date-time","maxLength":27,"minLength":24,"description":"Filter users by last online seen date after a specific ISO 8601 date and time. E.g: `2024-02-30T10:30:00Z`"},{"in":"query","name":"loginBefore","type":"string","format":"date-time","maxLength":27,"minLength":24,"description":"Filter users by last login date before a specific ISO 8601 date and time. E.g: `2024-01-30T10:30:00Z`"},{"in":"query","name":"loginAfter","type":"string","format":"date-time","maxLength":27,"minLength":24,"description":"Filter users by last login date after a specific ISO 8601 date and time. E.g: `2024-02-30T10:30:00Z`"},{"in":"query","name":"page","type":"number","format":"integer","default":0,"minimum":0,"maximum":100,"description":"Set entries pagination number"},{"in":"query","name":"size","type":"number","format":"integer","default":50,"minimum":1,"maximum":300,"description":"Set maximum entries size limit"}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"List of team members available in your account","schema":{"type":"array","items":{"$ref":"#/definitions/user"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Retrieves all team members available in your account\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/team \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Retrieves all team members available in your account\nhttp GET https://api.wassenger.com/v1/team \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Retrieves all team members available in your account\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/team';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Retrieves all team members available in your account\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/team',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Retrieves all team members available in your account\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/team');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Retrieves all team members available in your account\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/team', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Retrieves all team members available in your account\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/team');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Retrieves all team members available in your account\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/team\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Retrieves all team members available in your account\nimport requests\n\nurl = \"https://api.wassenger.com/v1/team\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Retrieves all team members available in your account\nconst url = 'https://api.wassenger.com/v1/team';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Retrieves all team members available in your account\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/team',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Retrieves all team members available in your account\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/team\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Retrieves all team members available in your account\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/team\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Retrieves all team members available in your account\nvar client = new RestClient(\"https://api.wassenger.com/v1/team\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Retrieves all team members available in your account\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/team\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Retrieves all team members available in your account\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/team\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Retrieves all team members available in your account\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/team\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Retrieves all team members available in your account\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/team\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Retrieves all team members available in your account\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/team' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Retrieves all team members available in your account\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/team\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Retrieves all team members available in your account\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/team\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Update user","description":"Update user information, role and metadata by user ID (24 characters hexadecimal).\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fteam&method=PATCH&body=%7B%0A%20%20%22id%22%3A%20%225b9d0b9a4b0fbf0001c5d1f2%22%2C%0A%20%20%22displayName%22%3A%20%22John%20Doe%20Jr%22%2C%0A%20%20%22password%22%3A%20%22s3cr3t!%22%2C%0A%20%20%22color%22%3A%20%22yellow%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateTeamUser","tags":["Team Members"],"produces":["application/json"],"consumes":["application/json"],"security":[{"apiKey":[]}],"parameters":[{"in":"body","name":"user","description":"Update user","schema":{"type":"object","properties":{"id":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"User unique ID (24 hexadecimal length). This field is required."},"displayName":{"type":"string","minLength":2,"maxLength":30,"description":"Set a new display name for the user. Skip the field to do not change email."},"email":{"type":"string","format":"email","minLength":5,"maxLength":100,"description":"Set a new email for the user. Skip the field to do not change email."},"password":{"type":"string","minLength":5,"maxLength":50,"description":"Set a new password for the user. Skip the field to do not change password."},"role":{"type":"string","enum":["admin","supervisor","agent"],"description":"Set a new role for the user. Skip the field to do not change the role."},"color":{"type":"string","enum":["blue","azure","indigo","purple","pink","red","orange","yellow","lime","green","teal","cyan","gray","gray-dark"],"description":"Set a new color for the user. Skip the field to do not change the color."}},"required":["id"],"additionalProperties":false}}],"responses":{"200":{"description":"User updated","schema":{"$ref":"#/definitions/user"}},"400":{"description":"Missing required user data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unsupported operation - Plan upgrade required","schema":{"$ref":"#/definitions/error"}},"404":{"description":"User not found or no longer active","schema":{"$ref":"#/definitions/error"}},"409":{"description":"User already exists with the same email","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation not available - try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Update user by ID\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/team \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"id\":\"5b9d0b9a4b0fbf0001c5d1f2\",\"displayName\":\"John Doe Jr\",\"password\":\"s3cr3t!\",\"color\":\"yellow\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Update user by ID\necho '{\"id\":\"5b9d0b9a4b0fbf0001c5d1f2\",\"displayName\":\"John Doe Jr\",\"password\":\"s3cr3t!\",\"color\":\"yellow\"}' |  \\\n  http PATCH https://api.wassenger.com/v1/team \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Update user by ID\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/team';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"id\":\"5b9d0b9a4b0fbf0001c5d1f2\",\"displayName\":\"John Doe Jr\",\"password\":\"s3cr3t!\",\"color\":\"yellow\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Update user by ID\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/team',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    id: '5b9d0b9a4b0fbf0001c5d1f2',\n    displayName: 'John Doe Jr',\n    password: 's3cr3t!',\n    color: 'yellow'\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Update user by ID\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/team');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  id: '5b9d0b9a4b0fbf0001c5d1f2',\n  displayName: 'John Doe Jr',\n  password: 's3cr3t!',\n  color: 'yellow'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Update user by ID\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/team', [\n  'body' => '{\"id\":\"5b9d0b9a4b0fbf0001c5d1f2\",\"displayName\":\"John Doe Jr\",\"password\":\"s3cr3t!\",\"color\":\"yellow\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Update user by ID\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'id' => '5b9d0b9a4b0fbf0001c5d1f2',\n  'displayName' => 'John Doe Jr',\n  'password' => 's3cr3t!',\n  'color' => 'yellow'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/team');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Update user by ID\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/team\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'id' => '5b9d0b9a4b0fbf0001c5d1f2',\n    'displayName' => 'John Doe Jr',\n    'password' => 's3cr3t!',\n    'color' => 'yellow'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Update user by ID\nimport requests\n\nurl = \"https://api.wassenger.com/v1/team\"\n\npayload = {\n    \"id\": \"5b9d0b9a4b0fbf0001c5d1f2\",\n    \"displayName\": \"John Doe Jr\",\n    \"password\": \"s3cr3t!\",\n    \"color\": \"yellow\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update user by ID\nconst url = 'https://api.wassenger.com/v1/team';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"id\":\"5b9d0b9a4b0fbf0001c5d1f2\",\"displayName\":\"John Doe Jr\",\"password\":\"s3cr3t!\",\"color\":\"yellow\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update user by ID\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/team',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"id\":\"5b9d0b9a4b0fbf0001c5d1f2\",\"displayName\":\"John Doe Jr\",\"password\":\"s3cr3t!\",\"color\":\"yellow\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Update user by ID\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/team\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"id\\\":\\\"5b9d0b9a4b0fbf0001c5d1f2\\\",\\\"displayName\\\":\\\"John Doe Jr\\\",\\\"password\\\":\\\"s3cr3t!\\\",\\\"color\\\":\\\"yellow\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Update user by ID\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/team\"\n\n\tpayload := strings.NewReader(\"{\\\"id\\\":\\\"5b9d0b9a4b0fbf0001c5d1f2\\\",\\\"displayName\\\":\\\"John Doe Jr\\\",\\\"password\\\":\\\"s3cr3t!\\\",\\\"color\\\":\\\"yellow\\\"}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Update user by ID\nvar client = new RestClient(\"https://api.wassenger.com/v1/team\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"id\\\":\\\"5b9d0b9a4b0fbf0001c5d1f2\\\",\\\"displayName\\\":\\\"John Doe Jr\\\",\\\"password\\\":\\\"s3cr3t!\\\",\\\"color\\\":\\\"yellow\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Update user by ID\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/team\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"id\\\":\\\"5b9d0b9a4b0fbf0001c5d1f2\\\",\\\"displayName\\\":\\\"John Doe Jr\\\",\\\"password\\\":\\\"s3cr3t!\\\",\\\"color\\\":\\\"yellow\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Update user by ID\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/team\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"id\\\":\\\"5b9d0b9a4b0fbf0001c5d1f2\\\",\\\"displayName\\\":\\\"John Doe Jr\\\",\\\"password\\\":\\\"s3cr3t!\\\",\\\"color\\\":\\\"yellow\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Update user by ID\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"id\\\":\\\"5b9d0b9a4b0fbf0001c5d1f2\\\",\\\"displayName\\\":\\\"John Doe Jr\\\",\\\"password\\\":\\\"s3cr3t!\\\",\\\"color\\\":\\\"yellow\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/team\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Update user by ID\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/team\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"id\\\":\\\"5b9d0b9a4b0fbf0001c5d1f2\\\",\\\"displayName\\\":\\\"John Doe Jr\\\",\\\"password\\\":\\\"s3cr3t!\\\",\\\"color\\\":\\\"yellow\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Update user by ID\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/team' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"id\":\"5b9d0b9a4b0fbf0001c5d1f2\",\"displayName\":\"John Doe Jr\",\"password\":\"s3cr3t!\",\"color\":\"yellow\"}'"},{"lang":"ObjC","source":"// Update user by ID\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"id\": @\"5b9d0b9a4b0fbf0001c5d1f2\",\n                              @\"displayName\": @\"John Doe Jr\",\n                              @\"password\": @\"s3cr3t!\",\n                              @\"color\": @\"yellow\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/team\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Update user by ID\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"id\": \"5b9d0b9a4b0fbf0001c5d1f2\",\n  \"displayName\": \"John Doe Jr\",\n  \"password\": \"s3cr3t!\",\n  \"color\": \"yellow\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/team\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Delete users","description":"Delete one or multiple team users by email or user ID (24 hexadecimal characters).\nYou can optionally unassign, re-assign or resolve chats assigned to the deleted users.\n\n**Note**: by default only users who are not included to an active WhatsApp number team can be deleted. If you want to force the users deletion, set the JSON field `force = true`, otherwise a `Conflict - 409` error may be returned.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fteam&method=DELETE&body=%7B%0A%20%20%22force%22%3A%20false%2C%0A%20%20%22users%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22email%22%3A%20%22agent%40company.com%22%2C%0A%20%20%20%20%20%20%22action%22%3A%20%22unassign%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22id%22%3A%20%220f900cd2e963c5ffe39af01%22%2C%0A%20%20%20%20%20%20%22action%22%3A%20%22resolve%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22email%22%3A%20%22alex%40company.com%22%2C%0A%20%20%20%20%20%20%22action%22%3A%20%22reassign%22%2C%0A%20%20%20%20%20%20%22assign%22%3A%20%22USER%20ID%20TO%20REASSIGN%20CHATS%20TO%22%0A%20%20%20%20%7D%0A%20%20%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deleteUsers","tags":["Team Members"],"produces":["application/json"],"consumes":["application/json"],"security":[{"apiKey":[]}],"parameters":[{"in":"body","name":"users","description":"Delete one or multiple users by email and ID, optionally unassigning, resolving or reassigning their chats to another user","schema":{"type":"object","properties":{"force":{"type":"boolean","description":"Force agents deletion from the system even if they have access to one or multiple active WhatsApp numbers. When `force` = `false`, the API will return a `409 Conflict` error when trying to delete agents that still have access to at least one WhatsApp number.","default":false},"users":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string","format":"email","minLength":5,"maxLength":100,"description":"Remove agent by its email. If this field is not defined, `id` must be defined."},"id":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Remove agent by its ID. If this field is not defined, `email` must be defined."},"action":{"type":"string","enum":["unassign","reassign","resolve"],"description":"Action to be applied to all chats assigned to the agent to be removed. Defaults to `unassign` all chats.","default":"unassign"},"assign":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Required if `action` = `reassign`. Defines the target agent ID (24 hexadecimal characters) to reassign all chats that were assigned to the agent to be removed."},"remove":{"type":"boolean","description":"Use `true` in order to completely remove the agent from the system, even if it has access to other WhatsApp numbers.","default":false}},"additionalProperties":false},"minItems":1,"maxItems":10,"description":"List of agents by ID or email to be deleted from the system. At least one `id` or `email` field is required."}},"additionalProperties":false}}],"responses":{"204":{"description":"Users deleted successfully"},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unsupported operation - Platform plan upgrade required","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"User cannot be deleted due to access permission conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation not available - try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Delete one or multiple users by email and ID, optionally unassigning, resolving and reassigning their chats to another user\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/team \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"force\":false,\"users\":[{\"email\":\"agent@company.com\",\"action\":\"unassign\"},{\"id\":\"0f900cd2e963c5ffe39af01\",\"action\":\"resolve\"},{\"email\":\"alex@company.com\",\"action\":\"reassign\",\"assign\":\"USER ID TO REASSIGN CHATS TO\"}]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Delete one or multiple users by email and ID, optionally unassigning, resolving and reassigning their chats to another user\necho '{\"force\":false,\"users\":[{\"email\":\"agent@company.com\",\"action\":\"unassign\"},{\"id\":\"0f900cd2e963c5ffe39af01\",\"action\":\"resolve\"},{\"email\":\"alex@company.com\",\"action\":\"reassign\",\"assign\":\"USER ID TO REASSIGN CHATS TO\"}]}' |  \\\n  http DELETE https://api.wassenger.com/v1/team \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Delete one or multiple users by email and ID, optionally unassigning, resolving and reassigning their chats to another user\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/team';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"force\":false,\"users\":[{\"email\":\"agent@company.com\",\"action\":\"unassign\"},{\"id\":\"0f900cd2e963c5ffe39af01\",\"action\":\"resolve\"},{\"email\":\"alex@company.com\",\"action\":\"reassign\",\"assign\":\"USER ID TO REASSIGN CHATS TO\"}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Delete one or multiple users by email and ID, optionally unassigning, resolving and reassigning their chats to another user\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/team',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    force: false,\n    users: [\n      {email: 'agent@company.com', action: 'unassign'},\n      {id: '0f900cd2e963c5ffe39af01', action: 'resolve'},\n      {\n        email: 'alex@company.com',\n        action: 'reassign',\n        assign: 'USER ID TO REASSIGN CHATS TO'\n      }\n    ]\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Delete one or multiple users by email and ID, optionally unassigning, resolving and reassigning their chats to another user\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/team');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  force: false,\n  users: [\n    {\n      email: 'agent@company.com',\n      action: 'unassign'\n    },\n    {\n      id: '0f900cd2e963c5ffe39af01',\n      action: 'resolve'\n    },\n    {\n      email: 'alex@company.com',\n      action: 'reassign',\n      assign: 'USER ID TO REASSIGN CHATS TO'\n    }\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Delete one or multiple users by email and ID, optionally unassigning, resolving and reassigning their chats to another user\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/team', [\n  'body' => '{\"force\":false,\"users\":[{\"email\":\"agent@company.com\",\"action\":\"unassign\"},{\"id\":\"0f900cd2e963c5ffe39af01\",\"action\":\"resolve\"},{\"email\":\"alex@company.com\",\"action\":\"reassign\",\"assign\":\"USER ID TO REASSIGN CHATS TO\"}]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Delete one or multiple users by email and ID, optionally unassigning, resolving and reassigning their chats to another user\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'force' => null,\n  'users' => [\n    [\n        'email' => 'agent@company.com',\n        'action' => 'unassign'\n    ],\n    [\n        'id' => '0f900cd2e963c5ffe39af01',\n        'action' => 'resolve'\n    ],\n    [\n        'email' => 'alex@company.com',\n        'action' => 'reassign',\n        'assign' => 'USER ID TO REASSIGN CHATS TO'\n    ]\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/team');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Delete one or multiple users by email and ID, optionally unassigning, resolving and reassigning their chats to another user\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/team\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'force' => null,\n    'users' => [\n        [\n                'email' => 'agent@company.com',\n                'action' => 'unassign'\n        ],\n        [\n                'id' => '0f900cd2e963c5ffe39af01',\n                'action' => 'resolve'\n        ],\n        [\n                'email' => 'alex@company.com',\n                'action' => 'reassign',\n                'assign' => 'USER ID TO REASSIGN CHATS TO'\n        ]\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Delete one or multiple users by email and ID, optionally unassigning, resolving and reassigning their chats to another user\nimport requests\n\nurl = \"https://api.wassenger.com/v1/team\"\n\npayload = {\n    \"force\": False,\n    \"users\": [\n        {\n            \"email\": \"agent@company.com\",\n            \"action\": \"unassign\"\n        },\n        {\n            \"id\": \"0f900cd2e963c5ffe39af01\",\n            \"action\": \"resolve\"\n        },\n        {\n            \"email\": \"alex@company.com\",\n            \"action\": \"reassign\",\n            \"assign\": \"USER ID TO REASSIGN CHATS TO\"\n        }\n    ]\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete one or multiple users by email and ID, optionally unassigning, resolving and reassigning their chats to another user\nconst url = 'https://api.wassenger.com/v1/team';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"force\":false,\"users\":[{\"email\":\"agent@company.com\",\"action\":\"unassign\"},{\"id\":\"0f900cd2e963c5ffe39af01\",\"action\":\"resolve\"},{\"email\":\"alex@company.com\",\"action\":\"reassign\",\"assign\":\"USER ID TO REASSIGN CHATS TO\"}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete one or multiple users by email and ID, optionally unassigning, resolving and reassigning their chats to another user\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/team',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"force\":false,\"users\":[{\"email\":\"agent@company.com\",\"action\":\"unassign\"},{\"id\":\"0f900cd2e963c5ffe39af01\",\"action\":\"resolve\"},{\"email\":\"alex@company.com\",\"action\":\"reassign\",\"assign\":\"USER ID TO REASSIGN CHATS TO\"}]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Delete one or multiple users by email and ID, optionally unassigning, resolving and reassigning their chats to another user\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/team\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"force\\\":false,\\\"users\\\":[{\\\"email\\\":\\\"agent@company.com\\\",\\\"action\\\":\\\"unassign\\\"},{\\\"id\\\":\\\"0f900cd2e963c5ffe39af01\\\",\\\"action\\\":\\\"resolve\\\"},{\\\"email\\\":\\\"alex@company.com\\\",\\\"action\\\":\\\"reassign\\\",\\\"assign\\\":\\\"USER ID TO REASSIGN CHATS TO\\\"}]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Delete one or multiple users by email and ID, optionally unassigning, resolving and reassigning their chats to another user\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/team\"\n\n\tpayload := strings.NewReader(\"{\\\"force\\\":false,\\\"users\\\":[{\\\"email\\\":\\\"agent@company.com\\\",\\\"action\\\":\\\"unassign\\\"},{\\\"id\\\":\\\"0f900cd2e963c5ffe39af01\\\",\\\"action\\\":\\\"resolve\\\"},{\\\"email\\\":\\\"alex@company.com\\\",\\\"action\\\":\\\"reassign\\\",\\\"assign\\\":\\\"USER ID TO REASSIGN CHATS TO\\\"}]}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Delete one or multiple users by email and ID, optionally unassigning, resolving and reassigning their chats to another user\nvar client = new RestClient(\"https://api.wassenger.com/v1/team\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"force\\\":false,\\\"users\\\":[{\\\"email\\\":\\\"agent@company.com\\\",\\\"action\\\":\\\"unassign\\\"},{\\\"id\\\":\\\"0f900cd2e963c5ffe39af01\\\",\\\"action\\\":\\\"resolve\\\"},{\\\"email\\\":\\\"alex@company.com\\\",\\\"action\\\":\\\"reassign\\\",\\\"assign\\\":\\\"USER ID TO REASSIGN CHATS TO\\\"}]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Delete one or multiple users by email and ID, optionally unassigning, resolving and reassigning their chats to another user\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/team\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"force\\\":false,\\\"users\\\":[{\\\"email\\\":\\\"agent@company.com\\\",\\\"action\\\":\\\"unassign\\\"},{\\\"id\\\":\\\"0f900cd2e963c5ffe39af01\\\",\\\"action\\\":\\\"resolve\\\"},{\\\"email\\\":\\\"alex@company.com\\\",\\\"action\\\":\\\"reassign\\\",\\\"assign\\\":\\\"USER ID TO REASSIGN CHATS TO\\\"}]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Delete one or multiple users by email and ID, optionally unassigning, resolving and reassigning their chats to another user\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/team\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"force\\\":false,\\\"users\\\":[{\\\"email\\\":\\\"agent@company.com\\\",\\\"action\\\":\\\"unassign\\\"},{\\\"id\\\":\\\"0f900cd2e963c5ffe39af01\\\",\\\"action\\\":\\\"resolve\\\"},{\\\"email\\\":\\\"alex@company.com\\\",\\\"action\\\":\\\"reassign\\\",\\\"assign\\\":\\\"USER ID TO REASSIGN CHATS TO\\\"}]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Delete one or multiple users by email and ID, optionally unassigning, resolving and reassigning their chats to another user\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"force\\\":false,\\\"users\\\":[{\\\"email\\\":\\\"agent@company.com\\\",\\\"action\\\":\\\"unassign\\\"},{\\\"id\\\":\\\"0f900cd2e963c5ffe39af01\\\",\\\"action\\\":\\\"resolve\\\"},{\\\"email\\\":\\\"alex@company.com\\\",\\\"action\\\":\\\"reassign\\\",\\\"assign\\\":\\\"USER ID TO REASSIGN CHATS TO\\\"}]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/team\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Delete one or multiple users by email and ID, optionally unassigning, resolving and reassigning their chats to another user\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/team\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"force\\\":false,\\\"users\\\":[{\\\"email\\\":\\\"agent@company.com\\\",\\\"action\\\":\\\"unassign\\\"},{\\\"id\\\":\\\"0f900cd2e963c5ffe39af01\\\",\\\"action\\\":\\\"resolve\\\"},{\\\"email\\\":\\\"alex@company.com\\\",\\\"action\\\":\\\"reassign\\\",\\\"assign\\\":\\\"USER ID TO REASSIGN CHATS TO\\\"}]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Delete one or multiple users by email and ID, optionally unassigning, resolving and reassigning their chats to another user\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/team' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"force\":false,\"users\":[{\"email\":\"agent@company.com\",\"action\":\"unassign\"},{\"id\":\"0f900cd2e963c5ffe39af01\",\"action\":\"resolve\"},{\"email\":\"alex@company.com\",\"action\":\"reassign\",\"assign\":\"USER ID TO REASSIGN CHATS TO\"}]}'"},{"lang":"ObjC","source":"// Delete one or multiple users by email and ID, optionally unassigning, resolving and reassigning their chats to another user\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"force\": @NO,\n                              @\"users\": @[ @{ @\"email\": @\"agent@company.com\", @\"action\": @\"unassign\" }, @{ @\"id\": @\"0f900cd2e963c5ffe39af01\", @\"action\": @\"resolve\" }, @{ @\"email\": @\"alex@company.com\", @\"action\": @\"reassign\", @\"assign\": @\"USER ID TO REASSIGN CHATS TO\" } ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/team\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Delete one or multiple users by email and ID, optionally unassigning, resolving and reassigning their chats to another user\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"force\": false,\n  \"users\": [\n    [\n      \"email\": \"agent@company.com\",\n      \"action\": \"unassign\"\n    ],\n    [\n      \"id\": \"0f900cd2e963c5ffe39af01\",\n      \"action\": \"resolve\"\n    ],\n    [\n      \"email\": \"alex@company.com\",\n      \"action\": \"reassign\",\n      \"assign\": \"USER ID TO REASSIGN CHATS TO\"\n    ]\n  ]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/team\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/pipelines":{"parameters":[],"get":{"summary":"Get pipelines","description":"Retrieve the sales pipelines of the account.\n\n\n\nOnly the active pipelines are returned by default. Use `archived=true` for the archived ones, or `archived=all` for both: every pipeline carries an `archived` flag and, when it is archived, the `archivedAt` date it was archived on.\n\n\n\nEvery pipeline also carries its own `deals` counters, each a `{count, amount}` pair: `open` right now, `won` / `lost` over the whole life of the pipeline, and `won30d` / `lost30d` over the last 30 days. The lifetime pair is what an archived pipeline is read by, since a funnel retired more than a month ago has an empty 30-day window. Restricted agents only count their own deals.\n\n\n\n`deals.mixedCurrency` carries one flag per figure. It is true when the deals behind that amount are not all in the same currency: `deal.currency` is seeded from the pipeline currency but stored and overridable per deal, and no exchange rate is applied anywhere, so a flagged amount is a sum of different units and should not be printed as a single figure. A deal that states no currency of its own is not a second currency.\n\n\n\n`deals.currencies` mirrors it with the unit each figure IS in, and is `null` exactly when the matching flag is true. This is not the same answer as the pipeline's own `currency`: a pipeline priced in EUR whose closed deals were all stored in USD mixes nothing, and pricing its totals in the pipeline currency would print dollars with a euro sign.\n\n\n\n`deals.scope` says whose deals were counted: `account` for the whole funnel, `agent` when the reader is a restricted agent and every figure has been narrowed to them. It is the same declaration the summary endpoint makes, and a screen printing these figures as facts about the funnel needs it to know when they are facts about the reader instead.\n\n\n\nThe number of active pipelines an account may hold is its plan allowance (never more than 10), while archived ones are unlimited, so the archived list is paginated: a page that comes back full may have another behind it (`page=1`, `page=2`, ...). Reads that include the archived ones return the active ones first, so a page ceiling can only ever cut into the archived tail.\n\n\n\n**Note**: this API resource is available in the Platform Professional subscription and above.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fpipelines)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getPipelines","security":[{"apiKey":[]}],"tags":["Pipeline"],"parameters":[{"in":"query","name":"device","type":"string","required":false,"description":"Optional device ID: only return pipelines fed by this device"},{"in":"query","name":"archived","type":"string","required":false,"enum":["true","false","all"],"description":"Return the archived pipelines instead of the active ones (`true`), or both (`all`). Defaults to the active ones"},{"in":"query","name":"size","type":"number","required":false,"description":"Pipelines per page, capped at 50. Defaults to 10 for the active ones and 50 when the read includes the archived ones"},{"in":"query","name":"page","type":"number","required":false,"description":"Page number, zero based. Defaults to 0"}],"responses":{"200":{"description":"List of pipelines","schema":{"type":"array","items":{"$ref":"#/definitions/pipeline"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get the account sales pipelines\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/pipelines \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get the account sales pipelines\nhttp GET https://api.wassenger.com/v1/pipelines \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get the account sales pipelines\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/pipelines';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get the account sales pipelines\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/pipelines',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get the account sales pipelines\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/pipelines');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get the account sales pipelines\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/pipelines', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get the account sales pipelines\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/pipelines');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get the account sales pipelines\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/pipelines\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get the account sales pipelines\nimport requests\n\nurl = \"https://api.wassenger.com/v1/pipelines\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get the account sales pipelines\nconst url = 'https://api.wassenger.com/v1/pipelines';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get the account sales pipelines\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/pipelines',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get the account sales pipelines\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/pipelines\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get the account sales pipelines\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/pipelines\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get the account sales pipelines\nvar client = new RestClient(\"https://api.wassenger.com/v1/pipelines\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get the account sales pipelines\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/pipelines\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get the account sales pipelines\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/pipelines\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get the account sales pipelines\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/pipelines\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get the account sales pipelines\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/pipelines\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get the account sales pipelines\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/pipelines' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get the account sales pipelines\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/pipelines\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get the account sales pipelines\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/pipelines\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"post":{"summary":"Create pipeline","description":"Create a new sales pipeline in the account.\n\n\n\nA pipeline requires at least one open, one won and one lost stage. Stage order is the array order, and the won and lost stages must come after all the open ones: a deal advances to the next open stage by position, so a terminal stage in the middle would be skipped over. When no stages are provided, a default set is seeded.\n\n\n\n**Note**: this API resource is available in the Platform Professional subscription and above.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fpipelines&method=POST&body=%7B%0A%20%20%22name%22%3A%20%22Sales%22%2C%0A%20%20%22color%22%3A%20%22blue%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"createPipeline","security":[{"apiKey":[]}],"tags":["Pipeline"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"pipeline","description":"Create a new pipeline","schema":{"type":"object","properties":{"name":{"type":"string","minLength":2,"maxLength":30,"description":"Pipeline name"},"description":{"type":"string","minLength":0,"maxLength":300,"description":"Pipeline description. Optional"},"color":{"type":"string","minLength":1,"maxLength":30,"description":"Pipeline color name used for quick identification"},"icon":{"type":"string","enum":["funnel-dollar","filter","chart-line","handshake","money-bill-wave","bullseye","flag-checkered","coins","chart-pie","briefcase"],"description":"Pipeline icon identifier. Defaults to `funnel-dollar`"},"devices":{"type":"array","items":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Device ID fed into this pipeline"},"maxItems":50,"description":"Devices that feed this pipeline. Empty means all the account devices"},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code for deal amounts. Defaults to the account currency"},"entry":{"type":"object","properties":{"mode":{"type":"string","enum":["manual","filter","all"],"description":"How chats enter this pipeline: manual, filter or all. Persisted value is preserved when omitted"},"filters":{"type":"object","properties":{"labels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":20,"description":"Chat labels that make a chat enter the pipeline"},"type":{"type":"array","items":{"type":"string","enum":["chat","group","channel","broadcast"]},"maxItems":4,"description":"Chat types that make a chat enter the pipeline"}},"additionalProperties":false,"description":"Entry filters, only used when mode is filter"}},"additionalProperties":false,"description":"Entry rule configuration"},"stages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40,"description":"Stable stage identifier. Assigned by the server when omitted"},"name":{"type":"string","minLength":1,"maxLength":30,"description":"Stage name"},"color":{"type":"string","minLength":1,"maxLength":30,"description":"Stage color name used for quick identification"},"position":{"type":"integer","minimum":0,"maximum":99,"description":"Stage order position. Derived from the array order when omitted"},"kind":{"type":"string","enum":["open","won","lost"],"description":"Stage kind: open, won or lost. Persisted value is preserved when omitted on update"},"slaDays":{"type":"integer","minimum":1,"maximum":365,"description":"Maximum days a deal may stay in this stage before being flagged as stalled"},"labelMap":{"type":"string","minLength":1,"maxLength":40,"description":"Chat label name mapped to this stage"},"actions":{"type":"object","properties":{"assignAgent":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Agent to assign when a deal enters this stage"},"assignDepartment":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Department to assign when a deal enters this stage"},"addLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":10,"description":"Labels to add when a deal enters this stage"},"removeLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":10,"description":"Labels to remove when a deal enters this stage"}},"additionalProperties":false,"description":"Automatic actions fired when a deal enters this stage"}},"required":["name"],"additionalProperties":false},"minItems":3,"maxItems":20,"description":"Pipeline stages, in order. At least one open, one won and one lost stage are required, and the won and lost stages must come after all the open ones. Defaults are seeded when omitted"},"lostReasons":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":20,"description":"Preset lost reasons offered when a deal is lost"},"settings":{"type":"object","properties":{"closeChatOnWon":{"type":"boolean","description":"Resolve the chat when the deal is won"},"closeChatOnLost":{"type":"boolean","description":"Resolve the chat when the deal is lost"},"ai":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Enable AI analysis for deals in this pipeline"},"coolOffMinutes":{"type":"integer","minimum":5,"maximum":1440,"description":"Minutes without new messages before a conversation is analyzed"}},"additionalProperties":false,"description":"AI analysis settings"}},"additionalProperties":false,"description":"Pipeline behaviour settings"}},"required":["name"],"additionalProperties":false}}],"responses":{"200":{"description":"Pipeline created","schema":{"$ref":"#/definitions/pipeline"}},"400":{"description":"Invalid pipeline configuration","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unsupported operation - plan upgrade required","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Pipeline already exists with the same name","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Maximum allowed pipelines reached","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Create a sales pipeline\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/pipelines \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"name\":\"Sales\",\"color\":\"blue\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Create a sales pipeline\necho '{\"name\":\"Sales\",\"color\":\"blue\"}' |  \\\n  http POST https://api.wassenger.com/v1/pipelines \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Create a sales pipeline\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/pipelines';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"Sales\",\"color\":\"blue\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Create a sales pipeline\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/pipelines',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {name: 'Sales', color: 'blue'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Create a sales pipeline\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/pipelines');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  name: 'Sales',\n  color: 'blue'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Create a sales pipeline\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/pipelines', [\n  'body' => '{\"name\":\"Sales\",\"color\":\"blue\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Create a sales pipeline\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'name' => 'Sales',\n  'color' => 'blue'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/pipelines');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Create a sales pipeline\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/pipelines\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'name' => 'Sales',\n    'color' => 'blue'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Create a sales pipeline\nimport requests\n\nurl = \"https://api.wassenger.com/v1/pipelines\"\n\npayload = {\n    \"name\": \"Sales\",\n    \"color\": \"blue\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create a sales pipeline\nconst url = 'https://api.wassenger.com/v1/pipelines';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"Sales\",\"color\":\"blue\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create a sales pipeline\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/pipelines',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"name\":\"Sales\",\"color\":\"blue\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Create a sales pipeline\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/pipelines\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"name\\\":\\\"Sales\\\",\\\"color\\\":\\\"blue\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Create a sales pipeline\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/pipelines\"\n\n\tpayload := strings.NewReader(\"{\\\"name\\\":\\\"Sales\\\",\\\"color\\\":\\\"blue\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Create a sales pipeline\nvar client = new RestClient(\"https://api.wassenger.com/v1/pipelines\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"name\\\":\\\"Sales\\\",\\\"color\\\":\\\"blue\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Create a sales pipeline\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/pipelines\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"name\\\":\\\"Sales\\\",\\\"color\\\":\\\"blue\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Create a sales pipeline\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/pipelines\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"name\\\":\\\"Sales\\\",\\\"color\\\":\\\"blue\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Create a sales pipeline\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"name\\\":\\\"Sales\\\",\\\"color\\\":\\\"blue\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/pipelines\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Create a sales pipeline\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/pipelines\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"name\\\":\\\"Sales\\\",\\\"color\\\":\\\"blue\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Create a sales pipeline\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/pipelines' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"name\":\"Sales\",\"color\":\"blue\"}'"},{"lang":"ObjC","source":"// Create a sales pipeline\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"name\": @\"Sales\",\n                              @\"color\": @\"blue\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/pipelines\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Create a sales pipeline\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"name\": \"Sales\",\n  \"color\": \"blue\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/pipelines\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/numbers/validate":{"parameters":[],"post":{"summary":"Validate numbers","description":"Helpful endpoint to validate and normalize a list of phone numbers, optionally putting a country calling code (`prefix`) in front of the numbers written without +.\n\n\n\n\n\nThe validation is only perform at digits format level, it does not validate if a given phone number does exist on WhatsApp.\n\n\n\n\n\nFor WhatsApp number existence validation, please see the [Numbers/Exists](#operation/verifyNumber) API endpoint.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fnumbers%2Fvalidate&method=POST&body=%7B%0A%20%20%22prefix%22%3A%201%2C%0A%20%20%22numbers%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22phone%22%3A%20%22415-555-0142%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22phone%22%3A%20%22%2B1%20415%20555%200142%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22phone%22%3A%20%22(212)%20555-0198%22%0A%20%20%20%20%7D%0A%20%20%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"validateNumbers","tags":["Numbers"],"produces":["application/json","application/x-www-form-urlencoded"],"consumes":["application/json"],"security":[{"apiKey":[]}],"parameters":[{"in":"body","name":"numbers","description":"List of phone numbers to validate and normalize","schema":{"type":"object","properties":{"country":{"type":"string","minLength":2,"maxLength":2,"description":"Optional country code of the numbers on the list. E.g: US, GB, IT, FR, DE. It does not change how the numbers are read: to read the ones written without + as numbers of a country, send its calling code as `prefix`."},"prefix":{"type":"number","format":"float","minimum":1,"maximum":9999,"description":"Optional country calling code as numeric value, put in front of every number on the list that does not start with +. E.g: 1, 2, 33, 44, 36..."},"numbers":{"type":"array","items":{"type":"object","properties":{"phone":{"type":"string","minLength":5,"maxLength":20,"description":"Phone number to parse and validate. It might be any type of string value with different formatting. The validator will parse and normalize the number for you. E.g: +1-415-555-0142, +1 (415) 555-0142, +14155550142, or (415) 555-0142 with prefix 1"},"country":{"type":"string","minLength":2,"maxLength":2,"description":"Optional country code of this number. E.g: US, GB, IT, FR, DE. It does not change how the number is read: to read it as a number of a country when written without +, send its calling code as `prefix`."},"prefix":{"type":"number","format":"float","minimum":1,"maximum":9999,"description":"Optional country calling code as numeric value, put in front of this number unless it starts with +. E.g: 1, 2, 33, 44, 36..."}},"required":["phone"],"additionalProperties":false},"minItems":1,"maxItems":1000,"description":"List of phone numbers to validate and normalize. At least one item should be provided."}},"required":["numbers"],"additionalProperties":false}}],"responses":{"200":{"description":"Validation results","schema":{"type":"object","properties":{"numbers":{"type":"array","items":{"type":"object","properties":{"valid":{"type":"boolean","description":"Whether if the given phone number is valid (`true`) or not (`false`)"},"error":{"type":"string","description":"Human-readable error message in case of invalid or failed phone number validation, when applicable"},"phone":{"type":"string","description":"Normalized phone number in E164 format"},"wid":{"type":"string","description":"WhatsApp contact ID"},"input":{"type":"string","description":"Original input text to validate and normalize as phone number"},"kind":{"type":"string","description":"Phone number kind","enum":["fixed_line","mobile","fixed_line_or_mobile","toll_free","premium_rate","shared_cost","voip","personal_number","pager","uan","voicemail","unknown"]},"countryPrefix":{"type":"number","minimum":1,"maximum":9999,"description":"Country calling code prefix. E.g: 1, 2, 44, 55, 33"},"country":{"type":"string","description":"Country ISO code. E.g: US, GB, BR, DE, FR, IT"},"formats":{"type":"object","properties":{"local":{"type":"string"},"national":{"type":"string"},"international":{"type":"string"}}}}}},"summary":{"type":"object","properties":{"valid":{"type":"number","default":0,"description":"Total valid numbers"},"invalid":{"type":"number","default":0,"description":"Total invvalid numbers"}}}}}},"400":{"description":"Bad request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service unavailable","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/numbers/validate \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"prefix\":1,\"numbers\":[{\"phone\":\"415-555-0142\"},{\"phone\":\"+1 415 555 0142\"},{\"phone\":\"(212) 555-0198\"}]}'\n\n\n// Validates and normalizes a list of phone numbers with explicit country prefix\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/numbers/validate \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"numbers\":[{\"phone\":\"+1 415-555-0142\"},{\"phone\":\"+1 (212) 555-0198\"},{\"phone\":\"+1 646 555 0176\"}]}'\n\n\n// Validates and normalizes a list of phone numbers with international prefix\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/numbers/validate \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"prefix\":1,\"numbers\":[{\"phone\":\"415-555-0142\"},{\"phone\":\"212 (555) 0198\"},{\"phone\":\"6465550176\"}]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\necho '{\"prefix\":1,\"numbers\":[{\"phone\":\"415-555-0142\"},{\"phone\":\"+1 415 555 0142\"},{\"phone\":\"(212) 555-0198\"}]}' |  \\\n  http POST https://api.wassenger.com/v1/numbers/validate \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Validates and normalizes a list of phone numbers with explicit country prefix\necho '{\"numbers\":[{\"phone\":\"+1 415-555-0142\"},{\"phone\":\"+1 (212) 555-0198\"},{\"phone\":\"+1 646 555 0176\"}]}' |  \\\n  http POST https://api.wassenger.com/v1/numbers/validate \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Validates and normalizes a list of phone numbers with international prefix\necho '{\"prefix\":1,\"numbers\":[{\"phone\":\"415-555-0142\"},{\"phone\":\"212 (555) 0198\"},{\"phone\":\"6465550176\"}]}' |  \\\n  http POST https://api.wassenger.com/v1/numbers/validate \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/numbers/validate';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"prefix\":1,\"numbers\":[{\"phone\":\"415-555-0142\"},{\"phone\":\"+1 415 555 0142\"},{\"phone\":\"(212) 555-0198\"}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Validates and normalizes a list of phone numbers with explicit country prefix\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/numbers/validate';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"numbers\":[{\"phone\":\"+1 415-555-0142\"},{\"phone\":\"+1 (212) 555-0198\"},{\"phone\":\"+1 646 555 0176\"}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Validates and normalizes a list of phone numbers with international prefix\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/numbers/validate';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"prefix\":1,\"numbers\":[{\"phone\":\"415-555-0142\"},{\"phone\":\"212 (555) 0198\"},{\"phone\":\"6465550176\"}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/numbers/validate',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    prefix: 1,\n    numbers: [{phone: '415-555-0142'}, {phone: '+1 415 555 0142'}, {phone: '(212) 555-0198'}]\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Validates and normalizes a list of phone numbers with explicit country prefix\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/numbers/validate',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    numbers: [\n      {phone: '+1 415-555-0142'},\n      {phone: '+1 (212) 555-0198'},\n      {phone: '+1 646 555 0176'}\n    ]\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Validates and normalizes a list of phone numbers with international prefix\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/numbers/validate',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    prefix: 1,\n    numbers: [{phone: '415-555-0142'}, {phone: '212 (555) 0198'}, {phone: '6465550176'}]\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/numbers/validate');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  prefix: 1,\n  numbers: [\n    {\n      phone: '415-555-0142'\n    },\n    {\n      phone: '+1 415 555 0142'\n    },\n    {\n      phone: '(212) 555-0198'\n    }\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Validates and normalizes a list of phone numbers with explicit country prefix\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/numbers/validate');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  numbers: [\n    {\n      phone: '+1 415-555-0142'\n    },\n    {\n      phone: '+1 (212) 555-0198'\n    },\n    {\n      phone: '+1 646 555 0176'\n    }\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Validates and normalizes a list of phone numbers with international prefix\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/numbers/validate');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  prefix: 1,\n  numbers: [\n    {\n      phone: '415-555-0142'\n    },\n    {\n      phone: '212 (555) 0198'\n    },\n    {\n      phone: '6465550176'\n    }\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/numbers/validate', [\n  'body' => '{\"prefix\":1,\"numbers\":[{\"phone\":\"415-555-0142\"},{\"phone\":\"+1 415 555 0142\"},{\"phone\":\"(212) 555-0198\"}]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Validates and normalizes a list of phone numbers with explicit country prefix\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/numbers/validate', [\n  'body' => '{\"numbers\":[{\"phone\":\"+1 415-555-0142\"},{\"phone\":\"+1 (212) 555-0198\"},{\"phone\":\"+1 646 555 0176\"}]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Validates and normalizes a list of phone numbers with international prefix\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/numbers/validate', [\n  'body' => '{\"prefix\":1,\"numbers\":[{\"phone\":\"415-555-0142\"},{\"phone\":\"212 (555) 0198\"},{\"phone\":\"6465550176\"}]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'prefix' => 1,\n  'numbers' => [\n    [\n        'phone' => '415-555-0142'\n    ],\n    [\n        'phone' => '+1 415 555 0142'\n    ],\n    [\n        'phone' => '(212) 555-0198'\n    ]\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/numbers/validate');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Validates and normalizes a list of phone numbers with explicit country prefix\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'numbers' => [\n    [\n        'phone' => '+1 415-555-0142'\n    ],\n    [\n        'phone' => '+1 (212) 555-0198'\n    ],\n    [\n        'phone' => '+1 646 555 0176'\n    ]\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/numbers/validate');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Validates and normalizes a list of phone numbers with international prefix\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'prefix' => 1,\n  'numbers' => [\n    [\n        'phone' => '415-555-0142'\n    ],\n    [\n        'phone' => '212 (555) 0198'\n    ],\n    [\n        'phone' => '6465550176'\n    ]\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/numbers/validate');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/numbers/validate\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'prefix' => 1,\n    'numbers' => [\n        [\n                'phone' => '415-555-0142'\n        ],\n        [\n                'phone' => '+1 415 555 0142'\n        ],\n        [\n                'phone' => '(212) 555-0198'\n        ]\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Validates and normalizes a list of phone numbers with explicit country prefix\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/numbers/validate\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'numbers' => [\n        [\n                'phone' => '+1 415-555-0142'\n        ],\n        [\n                'phone' => '+1 (212) 555-0198'\n        ],\n        [\n                'phone' => '+1 646 555 0176'\n        ]\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Validates and normalizes a list of phone numbers with international prefix\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/numbers/validate\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'prefix' => 1,\n    'numbers' => [\n        [\n                'phone' => '415-555-0142'\n        ],\n        [\n                'phone' => '212 (555) 0198'\n        ],\n        [\n                'phone' => '6465550176'\n        ]\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nimport requests\n\nurl = \"https://api.wassenger.com/v1/numbers/validate\"\n\npayload = {\n    \"prefix\": 1,\n    \"numbers\": [{ \"phone\": \"415-555-0142\" }, { \"phone\": \"+1 415 555 0142\" }, { \"phone\": \"(212) 555-0198\" }]\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Validates and normalizes a list of phone numbers with explicit country prefix\nimport requests\n\nurl = \"https://api.wassenger.com/v1/numbers/validate\"\n\npayload = { \"numbers\": [{ \"phone\": \"+1 415-555-0142\" }, { \"phone\": \"+1 (212) 555-0198\" }, { \"phone\": \"+1 646 555 0176\" }] }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Validates and normalizes a list of phone numbers with international prefix\nimport requests\n\nurl = \"https://api.wassenger.com/v1/numbers/validate\"\n\npayload = {\n    \"prefix\": 1,\n    \"numbers\": [{ \"phone\": \"415-555-0142\" }, { \"phone\": \"212 (555) 0198\" }, { \"phone\": \"6465550176\" }]\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nconst url = 'https://api.wassenger.com/v1/numbers/validate';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"prefix\":1,\"numbers\":[{\"phone\":\"415-555-0142\"},{\"phone\":\"+1 415 555 0142\"},{\"phone\":\"(212) 555-0198\"}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Validates and normalizes a list of phone numbers with explicit country prefix\nconst url = 'https://api.wassenger.com/v1/numbers/validate';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"numbers\":[{\"phone\":\"+1 415-555-0142\"},{\"phone\":\"+1 (212) 555-0198\"},{\"phone\":\"+1 646 555 0176\"}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Validates and normalizes a list of phone numbers with international prefix\nconst url = 'https://api.wassenger.com/v1/numbers/validate';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"prefix\":1,\"numbers\":[{\"phone\":\"415-555-0142\"},{\"phone\":\"212 (555) 0198\"},{\"phone\":\"6465550176\"}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/numbers/validate',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"prefix\":1,\"numbers\":[{\"phone\":\"415-555-0142\"},{\"phone\":\"+1 415 555 0142\"},{\"phone\":\"(212) 555-0198\"}]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Validates and normalizes a list of phone numbers with explicit country prefix\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/numbers/validate',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"numbers\":[{\"phone\":\"+1 415-555-0142\"},{\"phone\":\"+1 (212) 555-0198\"},{\"phone\":\"+1 646 555 0176\"}]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Validates and normalizes a list of phone numbers with international prefix\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/numbers/validate',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"prefix\":1,\"numbers\":[{\"phone\":\"415-555-0142\"},{\"phone\":\"212 (555) 0198\"},{\"phone\":\"6465550176\"}]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/numbers/validate\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"prefix\\\":1,\\\"numbers\\\":[{\\\"phone\\\":\\\"415-555-0142\\\"},{\\\"phone\\\":\\\"+1 415 555 0142\\\"},{\\\"phone\\\":\\\"(212) 555-0198\\\"}]}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Validates and normalizes a list of phone numbers with explicit country prefix\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/numbers/validate\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"numbers\\\":[{\\\"phone\\\":\\\"+1 415-555-0142\\\"},{\\\"phone\\\":\\\"+1 (212) 555-0198\\\"},{\\\"phone\\\":\\\"+1 646 555 0176\\\"}]}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Validates and normalizes a list of phone numbers with international prefix\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/numbers/validate\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"prefix\\\":1,\\\"numbers\\\":[{\\\"phone\\\":\\\"415-555-0142\\\"},{\\\"phone\\\":\\\"212 (555) 0198\\\"},{\\\"phone\\\":\\\"6465550176\\\"}]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/numbers/validate\"\n\n\tpayload := strings.NewReader(\"{\\\"prefix\\\":1,\\\"numbers\\\":[{\\\"phone\\\":\\\"415-555-0142\\\"},{\\\"phone\\\":\\\"+1 415 555 0142\\\"},{\\\"phone\\\":\\\"(212) 555-0198\\\"}]}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Validates and normalizes a list of phone numbers with explicit country prefix\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/numbers/validate\"\n\n\tpayload := strings.NewReader(\"{\\\"numbers\\\":[{\\\"phone\\\":\\\"+1 415-555-0142\\\"},{\\\"phone\\\":\\\"+1 (212) 555-0198\\\"},{\\\"phone\\\":\\\"+1 646 555 0176\\\"}]}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Validates and normalizes a list of phone numbers with international prefix\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/numbers/validate\"\n\n\tpayload := strings.NewReader(\"{\\\"prefix\\\":1,\\\"numbers\\\":[{\\\"phone\\\":\\\"415-555-0142\\\"},{\\\"phone\\\":\\\"212 (555) 0198\\\"},{\\\"phone\\\":\\\"6465550176\\\"}]}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nvar client = new RestClient(\"https://api.wassenger.com/v1/numbers/validate\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"prefix\\\":1,\\\"numbers\\\":[{\\\"phone\\\":\\\"415-555-0142\\\"},{\\\"phone\\\":\\\"+1 415 555 0142\\\"},{\\\"phone\\\":\\\"(212) 555-0198\\\"}]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Validates and normalizes a list of phone numbers with explicit country prefix\nvar client = new RestClient(\"https://api.wassenger.com/v1/numbers/validate\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"numbers\\\":[{\\\"phone\\\":\\\"+1 415-555-0142\\\"},{\\\"phone\\\":\\\"+1 (212) 555-0198\\\"},{\\\"phone\\\":\\\"+1 646 555 0176\\\"}]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Validates and normalizes a list of phone numbers with international prefix\nvar client = new RestClient(\"https://api.wassenger.com/v1/numbers/validate\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"prefix\\\":1,\\\"numbers\\\":[{\\\"phone\\\":\\\"415-555-0142\\\"},{\\\"phone\\\":\\\"212 (555) 0198\\\"},{\\\"phone\\\":\\\"6465550176\\\"}]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/numbers/validate\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"prefix\\\":1,\\\"numbers\\\":[{\\\"phone\\\":\\\"415-555-0142\\\"},{\\\"phone\\\":\\\"+1 415 555 0142\\\"},{\\\"phone\\\":\\\"(212) 555-0198\\\"}]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Validates and normalizes a list of phone numbers with explicit country prefix\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/numbers/validate\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"numbers\\\":[{\\\"phone\\\":\\\"+1 415-555-0142\\\"},{\\\"phone\\\":\\\"+1 (212) 555-0198\\\"},{\\\"phone\\\":\\\"+1 646 555 0176\\\"}]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Validates and normalizes a list of phone numbers with international prefix\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/numbers/validate\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"prefix\\\":1,\\\"numbers\\\":[{\\\"phone\\\":\\\"415-555-0142\\\"},{\\\"phone\\\":\\\"212 (555) 0198\\\"},{\\\"phone\\\":\\\"6465550176\\\"}]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/numbers/validate\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"prefix\\\":1,\\\"numbers\\\":[{\\\"phone\\\":\\\"415-555-0142\\\"},{\\\"phone\\\":\\\"+1 415 555 0142\\\"},{\\\"phone\\\":\\\"(212) 555-0198\\\"}]}\")\n  .asString();\n\n\n// Validates and normalizes a list of phone numbers with explicit country prefix\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/numbers/validate\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"numbers\\\":[{\\\"phone\\\":\\\"+1 415-555-0142\\\"},{\\\"phone\\\":\\\"+1 (212) 555-0198\\\"},{\\\"phone\\\":\\\"+1 646 555 0176\\\"}]}\")\n  .asString();\n\n\n// Validates and normalizes a list of phone numbers with international prefix\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/numbers/validate\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"prefix\\\":1,\\\"numbers\\\":[{\\\"phone\\\":\\\"415-555-0142\\\"},{\\\"phone\\\":\\\"212 (555) 0198\\\"},{\\\"phone\\\":\\\"6465550176\\\"}]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"prefix\\\":1,\\\"numbers\\\":[{\\\"phone\\\":\\\"415-555-0142\\\"},{\\\"phone\\\":\\\"+1 415 555 0142\\\"},{\\\"phone\\\":\\\"(212) 555-0198\\\"}]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/numbers/validate\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Validates and normalizes a list of phone numbers with explicit country prefix\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"numbers\\\":[{\\\"phone\\\":\\\"+1 415-555-0142\\\"},{\\\"phone\\\":\\\"+1 (212) 555-0198\\\"},{\\\"phone\\\":\\\"+1 646 555 0176\\\"}]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/numbers/validate\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Validates and normalizes a list of phone numbers with international prefix\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"prefix\\\":1,\\\"numbers\\\":[{\\\"phone\\\":\\\"415-555-0142\\\"},{\\\"phone\\\":\\\"212 (555) 0198\\\"},{\\\"phone\\\":\\\"6465550176\\\"}]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/numbers/validate\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/numbers/validate\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"prefix\\\":1,\\\"numbers\\\":[{\\\"phone\\\":\\\"415-555-0142\\\"},{\\\"phone\\\":\\\"+1 415 555 0142\\\"},{\\\"phone\\\":\\\"(212) 555-0198\\\"}]}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Validates and normalizes a list of phone numbers with explicit country prefix\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/numbers/validate\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"numbers\\\":[{\\\"phone\\\":\\\"+1 415-555-0142\\\"},{\\\"phone\\\":\\\"+1 (212) 555-0198\\\"},{\\\"phone\\\":\\\"+1 646 555 0176\\\"}]}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Validates and normalizes a list of phone numbers with international prefix\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/numbers/validate\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"prefix\\\":1,\\\"numbers\\\":[{\\\"phone\\\":\\\"415-555-0142\\\"},{\\\"phone\\\":\\\"212 (555) 0198\\\"},{\\\"phone\\\":\\\"6465550176\\\"}]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/numbers/validate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"prefix\":1,\"numbers\":[{\"phone\":\"415-555-0142\"},{\"phone\":\"+1 415 555 0142\"},{\"phone\":\"(212) 555-0198\"}]}'\n\n\n# Validates and normalizes a list of phone numbers with explicit country prefix\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/numbers/validate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"numbers\":[{\"phone\":\"+1 415-555-0142\"},{\"phone\":\"+1 (212) 555-0198\"},{\"phone\":\"+1 646 555 0176\"}]}'\n\n\n# Validates and normalizes a list of phone numbers with international prefix\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/numbers/validate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"prefix\":1,\"numbers\":[{\"phone\":\"415-555-0142\"},{\"phone\":\"212 (555) 0198\"},{\"phone\":\"6465550176\"}]}'"},{"lang":"ObjC","source":"// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"prefix\": @1,\n                              @\"numbers\": @[ @{ @\"phone\": @\"415-555-0142\" }, @{ @\"phone\": @\"+1 415 555 0142\" }, @{ @\"phone\": @\"(212) 555-0198\" } ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/numbers/validate\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Validates and normalizes a list of phone numbers with explicit country prefix\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"numbers\": @[ @{ @\"phone\": @\"+1 415-555-0142\" }, @{ @\"phone\": @\"+1 (212) 555-0198\" }, @{ @\"phone\": @\"+1 646 555 0176\" } ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/numbers/validate\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Validates and normalizes a list of phone numbers with international prefix\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"prefix\": @1,\n                              @\"numbers\": @[ @{ @\"phone\": @\"415-555-0142\" }, @{ @\"phone\": @\"212 (555) 0198\" }, @{ @\"phone\": @\"6465550176\" } ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/numbers/validate\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Validates and normalizes a list of phone numbers, reading the ones without + as US numbers\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"prefix\": 1,\n  \"numbers\": [[\"phone\": \"415-555-0142\"], [\"phone\": \"+1 415 555 0142\"], [\"phone\": \"(212) 555-0198\"]]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/numbers/validate\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Validates and normalizes a list of phone numbers with explicit country prefix\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"numbers\": [[\"phone\": \"+1 415-555-0142\"], [\"phone\": \"+1 (212) 555-0198\"], [\"phone\": \"+1 646 555 0176\"]]] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/numbers/validate\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Validates and normalizes a list of phone numbers with international prefix\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"prefix\": 1,\n  \"numbers\": [[\"phone\": \"415-555-0142\"], [\"phone\": \"212 (555) 0198\"], [\"phone\": \"6465550176\"]]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/numbers/validate\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/numbers/exists":{"parameters":[],"post":{"summary":"Number exists","description":"Verify if a given phone number exists in WhatsApp and is able to receive messages.\n\n\n\nThe number format must be in E164 format, e.g: `+44692831121` or `+182932001912`\n\n\n\nYou can check one number at a time. In order to check multiple numbers, you may send multiple HTTPS requests to the API.\n\n\n\n\n\nDepending on your plan subscription, you may be able to check from 2,000 to 50,000 phone numbers per month.\n\n\n\n\n\nResults are cached. If the number was found on WhatsApp in the last 7 days, the answer comes from cache and does not count towards your monthly quota.\n\n\n\n\n\nOtherwise the number is checked in WhatsApp again, which counts towards your monthly quota. Sending `refresh: true` in the request body does the same: it skips the cache. Even a check in WhatsApp can return a result up to a day old.\n\n\n\n\n\nA check in WhatsApp needs your WhatsApp number session to be online and synced, otherwise the API will return a `503 - Not Available` error.\n\n\n\n\n\n**Important note**: avoid checking many numbers in a short period of time, as this may cause issues or even a ban of your WhatsApp number. We recommend no more than 30 number checks per minute, or 1 checks every 2 seconds.\n\n\n\n\n\nFor phone number format validation with no WhatsApp existence check, please see the [Numbers/Validate](#operation/validateNumbers) API endpoint.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fverify%2Fnumber&method=POST&body=%7B%0A%20%20%22phone%22%3A%20%22%2B1234567890%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"verifyNumber","tags":["Verify"],"produces":["application/json","application/x-www-form-urlencoded"],"consumes":["application/json"],"security":[{"apiKey":[]}],"parameters":[{"in":"body","name":"phone","description":"Check if a phone number exists in WhatsApp","schema":{"type":"object","properties":{"phone":{"type":"string","minLength":8,"maxLength":16},"refresh":{"type":"boolean","description":"Set to `true` to skip the cache and check the number in WhatsApp again. Without it, a number found on WhatsApp in the last 7 days is answered from cache. A check in WhatsApp counts towards your monthly quota, and can still return a result up to a day old.","default":false}},"required":["phone"],"additionalProperties":false}}],"responses":{"200":{"description":"Number exists","schema":{"type":"object","properties":{"phone":{"type":"string","description":"Normalized phone number in E164 format linked to WhatsApp"},"wid":{"type":"string","description":"WhatsApp contact ID"},"exists":{"type":"boolean","default":true,"description":"Value will be `true` if the given phone number exists within the WhatsApp network, otherwise `false`."},"isBusiness":{"type":"boolean","default":false,"description":"If the given number exists and is a WhatsApp Business number it will be `true`, otherwise `false`."},"link":{"type":"string","description":"WhatsApp open chat direct URL"},"businessInfo":{"type":"object","description":"If the number is a Business account, the WhatsApp Business information will be available here","properties":{"name":{"type":"string","description":"Business name"},"isApi":{"type":"boolean","default":false,"description":"If the business is an API account it will be `true`, otherwise `false`."},"isSmb":{"type":"boolean","default":true,"description":"If the business is a Small and Medium Business it will be `true`, otherwise `false`."},"level":{"type":"string","description":"Business verification level"},"privacyMode":{"type":"string","description":"Business privacy mode (optional)"}}},"country":{"type":"object","description":"Phone number country information","properties":{"code":{"type":"string","description":"Country 2-letter ISO code where the number is registered. Example: `GB`, `US`, `DE`, `IN`"},"name":{"type":"string","description":"Country name"},"officialName":{"type":"string","description":"Country official name"},"phonePrefix":{"type":"string","description":"Country phone international prefix"},"flag":{"type":"string","description":"Country flag emoji"},"domain":{"type":"string","description":"Country official domain name"},"currency":{"type":"string","description":"Country official currency as 3-letter ISO code. Example: `USD`, `EUR`, `GBP`"},"currencyName":{"type":"string","description":"Country official currency name"},"languages":{"type":"array","items":{"type":"string","description":"Country official 2-letter language code. Example: `en`, `es`, `de`, `hi`"}},"locales":{"type":"array","items":{"type":"string","description":"Country official locale code. Example: `en-US`, `es-ES`, `de-DE`, `hi-IN`"}},"timezones":{"type":"array","items":{"type":"string","description":"Country official timezone. Example: `America/New_York`, `Europe/Berlin`, `Asia/Kolkata`"}}}}}}},"400":{"description":"Bad request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Phone number does not exists in WhatsApp","schema":{"type":"object","properties":{"exists":{"type":"boolean","default":false}}}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Maximum number checks per month excedded","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Server error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"WhatsApp session not online or Service not available","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Validate if phone number exists in WhatsApp\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/verify/number \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"phone\":\"+1234567890\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Validate if phone number exists in WhatsApp\necho '{\"phone\":\"+1234567890\"}' |  \\\n  http POST https://api.wassenger.com/v1/verify/number \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Validate if phone number exists in WhatsApp\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/verify/number';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phone\":\"+1234567890\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Validate if phone number exists in WhatsApp\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/verify/number',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {phone: '+1234567890'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Validate if phone number exists in WhatsApp\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/verify/number');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  phone: '+1234567890'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Validate if phone number exists in WhatsApp\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/verify/number', [\n  'body' => '{\"phone\":\"+1234567890\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Validate if phone number exists in WhatsApp\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'phone' => '+1234567890'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/verify/number');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Validate if phone number exists in WhatsApp\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/verify/number\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'phone' => '+1234567890'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Validate if phone number exists in WhatsApp\nimport requests\n\nurl = \"https://api.wassenger.com/v1/verify/number\"\n\npayload = { \"phone\": \"+1234567890\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Validate if phone number exists in WhatsApp\nconst url = 'https://api.wassenger.com/v1/verify/number';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phone\":\"+1234567890\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Validate if phone number exists in WhatsApp\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/verify/number',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"phone\":\"+1234567890\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Validate if phone number exists in WhatsApp\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/verify/number\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"phone\\\":\\\"+1234567890\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Validate if phone number exists in WhatsApp\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/verify/number\"\n\n\tpayload := strings.NewReader(\"{\\\"phone\\\":\\\"+1234567890\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Validate if phone number exists in WhatsApp\nvar client = new RestClient(\"https://api.wassenger.com/v1/verify/number\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"phone\\\":\\\"+1234567890\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Validate if phone number exists in WhatsApp\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/verify/number\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"phone\\\":\\\"+1234567890\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Validate if phone number exists in WhatsApp\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/verify/number\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"phone\\\":\\\"+1234567890\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Validate if phone number exists in WhatsApp\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"phone\\\":\\\"+1234567890\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/verify/number\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Validate if phone number exists in WhatsApp\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/verify/number\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"phone\\\":\\\"+1234567890\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Validate if phone number exists in WhatsApp\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/verify/number' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"phone\":\"+1234567890\"}'"},{"lang":"ObjC","source":"// Validate if phone number exists in WhatsApp\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"phone\": @\"+1234567890\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/verify/number\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Validate if phone number exists in WhatsApp\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"phone\": \"+1234567890\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/verify/number\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/messages":{"parameters":[],"get":{"summary":"Search messages","description":"Search outbound messages, optionally filtered by customer search params. See allowed search params below.\n\n\n\n**Important**:\n\nThis endpoint only returns outbound (sent, queued or failed) messages, it does not search across outbound and inbound (received) messages.\n\n\n\nFor that purpose, use the [Chat Messages](#operation/getDeviceMessages) endpoint instead, which requires a Platform plan subscription in the specific WhatsApp device.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fmessages&params=%5B%7B%22key%22%3A%22size%22%2C%22value%22%3A50%7D%2C%7B%22key%22%3A%22page%22%2C%22value%22%3A0%7D%2C%7B%22key%22%3A%22status%22%2C%22value%22%3A%22queued%22%7D%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"searchMessages","security":[{"apiKey":[]}],"tags":["Messages"],"produces":["application/json"],"parameters":[{"in":"query","name":"search","type":"string","minLength":1,"maxLength":150,"description":"Search messages by text content, phone number, group or message IDs"},{"in":"query","name":"status","type":"array","collectionFormat":"csv","items":{"type":"string","enum":["any","valid","invalid","removed","expired","failed","queued","processing","processed"]}},{"in":"query","name":"deliveryStatus","type":"array","collectionFormat":"csv","items":{"type":"string","enum":["sent","failed","queued","read","played","revoked","delivered","cancelled","processing","readed"]}},{"in":"query","name":"webhookStatus","type":"array","collectionFormat":"csv","items":{"type":"string","enum":["invalid","removed","failed","cancelled","expired","pending","ignored","notified"]}},{"in":"query","name":"include","type":"array","collectionFormat":"csv","description":"Expand subentity documents per message","items":{"type":"string","enum":["device","webhooks","logs","features"]}},{"name":"ids","in":"query","type":"array","collectionFormat":"csv","items":{"type":"string","maxLength":24,"minLength":24,"pattern":"^[0-9A-Fa-f]{24}$"}},{"name":"agents","in":"query","type":"array","collectionFormat":"csv","description":"Filter messages sent by the specific agents IDs","items":{"type":"string","maxLength":24,"minLength":24,"pattern":"^[0-9A-Fa-f]{24}$"}},{"in":"query","name":"source","description":"Message creation origin. Possible options are via web chat interface or API","type":"string","enum":["chat","api"]},{"in":"query","name":"target","type":"string","enum":["user","group","channel"],"description":"Chat kind of the message target"},{"name":"type","in":"query","description":"Search messages by type","type":"array","collectionFormat":"csv","items":{"type":"string","enum":["text","location","image","audio","video","document","contact"]},"maxItems":10},{"name":"waIds","in":"query","description":"Search messages by WhatsApp ID (20 or 22 characters). Multiple IDs allowed separated by comma","type":"array","maxItems":50,"collectionFormat":"csv","items":{"type":"string","maxLength":22,"minLength":20}},{"name":"devices","in":"query","type":"array","collectionFormat":"csv","maxItems":100,"items":{"type":"string","maxLength":24,"minLength":24,"pattern":"^[0-9A-Fa-f]{24}$"}},{"name":"device","in":"query","type":"string","description":"Search messages by origin device ID or device phone number","minLength":9,"maxLength":24},{"name":"reference","in":"query","type":"array","collectionFormat":"csv","items":{"type":"string","minLength":2,"maxLength":100}},{"name":"priority","in":"query","type":"array","collectionFormat":"csv","items":{"type":"string","enum":["low","normal","high","urgent"]}},{"name":"phone","in":"query","type":"string","minLength":6,"maxLength":17,"pattern":"^\\+?[0-9]{5,16}$","description":"Filter messages by target phone number in E.164 international format. Adding the `+` prefix is optional, however if you add it, please ensure it is URL-safe encoded as `%20`."},{"name":"chat","in":"query","type":"string","minLength":6,"maxLength":141,"description":"Filter messages by target chat WhatsApp ID (WID). Required to filter by a contact who hides their phone number, since those messages carry no `phone` value. E.g: `PE.1045742271480925@bsuid`, `1234567890@c.us`"},{"name":"group","in":"query","type":"string","minLength":2,"maxLength":50,"description":"Filter messages by target group WhatsApp ID. E.g: 1234567890-5729392582@g.us, 1203630123456789001@g.us"},{"name":"channel","in":"query","type":"string","minLength":10,"maxLength":50,"description":"Filter messages by target channel WhatsApp ID, with or without its @newsletter suffix. E.g: 123000098765421000@newsletter"},{"name":"after","description":"Deliver at after the given date","in":"query","type":"string","format":"date-time"},{"name":"before","description":"Deliver at before the given date","in":"query","type":"string","format":"date-time"},{"name":"createdAfter","description":"Messages created after the given date","in":"query","type":"string","format":"date-time"},{"name":"createdBefore","description":"Messages created before the given date","in":"query","type":"string","format":"date-time"},{"in":"query","name":"sort","type":"string","description":"Sort order, by creation or delivery date. The default lists the newest messages first.","default":"createdAt:desc","enum":["deliverAt:asc","deliverAt:desc","createdAt:asc","createdAt:desc"]},{"in":"query","name":"page","description":"Results page number (starting from 0)","type":"number","format":"integer","default":0,"minimum":0,"maximum":500},{"in":"query","name":"size","description":"Results size","type":"number","format":"integer","default":20,"minimum":1,"maximum":100}],"responses":{"200":{"description":"Messages","schema":{"type":"array","items":{"$ref":"#/definitions/message"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get latest queued messages\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/messages?size=50&page=0&status=queued' \\\n  --header 'Token: <api token goes here>'\n\n\n// Get failed messages\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/messages?size=50&status=failed' \\\n  --header 'Token: <api token goes here>'\n\n\n// Get messages sent to a phone number\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/messages?size=30&status=processed&phone=%2B123456789' \\\n  --header 'Token: <api token goes here>'\n\n\n// Get messages by ID with any status\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/messages?size=10&status=any&search=5c4c839c7425ae1e09943513' \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get latest queued messages\nhttp GET 'https://api.wassenger.com/v1/messages?size=50&page=0&status=queued' \\\n  Token:'<api token goes here>'\n\n\n// Get failed messages\nhttp GET 'https://api.wassenger.com/v1/messages?size=50&status=failed' \\\n  Token:'<api token goes here>'\n\n\n// Get messages sent to a phone number\nhttp GET 'https://api.wassenger.com/v1/messages?size=30&status=processed&phone=%2B123456789' \\\n  Token:'<api token goes here>'\n\n\n// Get messages by ID with any status\nhttp GET 'https://api.wassenger.com/v1/messages?size=10&status=any&search=5c4c839c7425ae1e09943513' \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get latest queued messages\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/messages?size=50&page=0&status=queued';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get failed messages\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/messages?size=50&status=failed';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get messages sent to a phone number\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/messages?size=30&status=processed&phone=%2B123456789';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get messages by ID with any status\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/messages?size=10&status=any&search=5c4c839c7425ae1e09943513';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get latest queued messages\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/messages',\n  params: {size: '50', page: '0', status: 'queued'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get failed messages\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/messages',\n  params: {size: '50', status: 'failed'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get messages sent to a phone number\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/messages',\n  params: {size: '30', status: 'processed', phone: '+123456789'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get messages by ID with any status\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/messages',\n  params: {size: '10', status: 'any', search: '5c4c839c7425ae1e09943513'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get latest queued messages\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/messages');\n\nreq.query({\n  size: '50',\n  page: '0',\n  status: 'queued'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get failed messages\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/messages');\n\nreq.query({\n  size: '50',\n  status: 'failed'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get messages sent to a phone number\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/messages');\n\nreq.query({\n  size: '30',\n  status: 'processed',\n  phone: '+123456789'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get messages by ID with any status\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/messages');\n\nreq.query({\n  size: '10',\n  status: 'any',\n  search: '5c4c839c7425ae1e09943513'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get latest queued messages\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/messages?size=50&page=0&status=queued', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get failed messages\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/messages?size=50&status=failed', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get messages sent to a phone number\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/messages?size=30&status=processed&phone=%2B123456789', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get messages by ID with any status\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/messages?size=10&status=any&search=5c4c839c7425ae1e09943513', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get latest queued messages\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/messages');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'size' => '50',\n  'page' => '0',\n  'status' => 'queued'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get failed messages\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/messages');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'size' => '50',\n  'status' => 'failed'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get messages sent to a phone number\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/messages');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'size' => '30',\n  'status' => 'processed',\n  'phone' => '+123456789'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get messages by ID with any status\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/messages');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'size' => '10',\n  'status' => 'any',\n  'search' => '5c4c839c7425ae1e09943513'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get latest queued messages\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/messages?size=50&page=0&status=queued\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get failed messages\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/messages?size=50&status=failed\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get messages sent to a phone number\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/messages?size=30&status=processed&phone=%2B123456789\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get messages by ID with any status\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/messages?size=10&status=any&search=5c4c839c7425ae1e09943513\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get latest queued messages\nimport requests\n\nurl = \"https://api.wassenger.com/v1/messages\"\n\nquerystring = {\"size\":\"50\",\"page\":\"0\",\"status\":\"queued\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Get failed messages\nimport requests\n\nurl = \"https://api.wassenger.com/v1/messages\"\n\nquerystring = {\"size\":\"50\",\"status\":\"failed\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Get messages sent to a phone number\nimport requests\n\nurl = \"https://api.wassenger.com/v1/messages\"\n\nquerystring = {\"size\":\"30\",\"status\":\"processed\",\"phone\":\"+123456789\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Get messages by ID with any status\nimport requests\n\nurl = \"https://api.wassenger.com/v1/messages\"\n\nquerystring = {\"size\":\"10\",\"status\":\"any\",\"search\":\"5c4c839c7425ae1e09943513\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get latest queued messages\nconst url = 'https://api.wassenger.com/v1/messages?size=50&page=0&status=queued';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get failed messages\nconst url = 'https://api.wassenger.com/v1/messages?size=50&status=failed';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get messages sent to a phone number\nconst url = 'https://api.wassenger.com/v1/messages?size=30&status=processed&phone=%2B123456789';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get messages by ID with any status\nconst url = 'https://api.wassenger.com/v1/messages?size=10&status=any&search=5c4c839c7425ae1e09943513';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get latest queued messages\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/messages?size=50&page=0&status=queued',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get failed messages\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/messages?size=50&status=failed',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get messages sent to a phone number\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/messages?size=30&status=processed&phone=%2B123456789',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get messages by ID with any status\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/messages?size=10&status=any&search=5c4c839c7425ae1e09943513',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get latest queued messages\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/messages?size=50&page=0&status=queued\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get failed messages\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/messages?size=50&status=failed\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get messages sent to a phone number\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/messages?size=30&status=processed&phone=%2B123456789\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get messages by ID with any status\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/messages?size=10&status=any&search=5c4c839c7425ae1e09943513\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get latest queued messages\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/messages?size=50&page=0&status=queued\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get failed messages\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/messages?size=50&status=failed\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get messages sent to a phone number\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/messages?size=30&status=processed&phone=%2B123456789\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get messages by ID with any status\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/messages?size=10&status=any&search=5c4c839c7425ae1e09943513\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get latest queued messages\nvar client = new RestClient(\"https://api.wassenger.com/v1/messages?size=50&page=0&status=queued\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Get failed messages\nvar client = new RestClient(\"https://api.wassenger.com/v1/messages?size=50&status=failed\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Get messages sent to a phone number\nvar client = new RestClient(\"https://api.wassenger.com/v1/messages?size=30&status=processed&phone=%2B123456789\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Get messages by ID with any status\nvar client = new RestClient(\"https://api.wassenger.com/v1/messages?size=10&status=any&search=5c4c839c7425ae1e09943513\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get latest queued messages\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/messages?size=50&page=0&status=queued\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get failed messages\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/messages?size=50&status=failed\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get messages sent to a phone number\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/messages?size=30&status=processed&phone=%2B123456789\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get messages by ID with any status\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/messages?size=10&status=any&search=5c4c839c7425ae1e09943513\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get latest queued messages\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/messages?size=50&page=0&status=queued\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Get failed messages\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/messages?size=50&status=failed\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Get messages sent to a phone number\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/messages?size=30&status=processed&phone=%2B123456789\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Get messages by ID with any status\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/messages?size=10&status=any&search=5c4c839c7425ae1e09943513\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get latest queued messages\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/messages?size=50&page=0&status=queued\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get failed messages\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/messages?size=50&status=failed\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get messages sent to a phone number\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/messages?size=30&status=processed&phone=%2B123456789\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get messages by ID with any status\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/messages?size=10&status=any&search=5c4c839c7425ae1e09943513\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get latest queued messages\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/messages?size=50&page=0&status=queued\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get failed messages\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/messages?size=50&status=failed\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get messages sent to a phone number\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/messages?size=30&status=processed&phone=%2B123456789\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get messages by ID with any status\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/messages?size=10&status=any&search=5c4c839c7425ae1e09943513\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get latest queued messages\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/messages?size=50&page=0&status=queued' -Method GET -Headers $headers\n\n\n# Get failed messages\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/messages?size=50&status=failed' -Method GET -Headers $headers\n\n\n# Get messages sent to a phone number\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/messages?size=30&status=processed&phone=%2B123456789' -Method GET -Headers $headers\n\n\n# Get messages by ID with any status\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/messages?size=10&status=any&search=5c4c839c7425ae1e09943513' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get latest queued messages\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/messages?size=50&page=0&status=queued\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get failed messages\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/messages?size=50&status=failed\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get messages sent to a phone number\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/messages?size=30&status=processed&phone=%2B123456789\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get messages by ID with any status\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/messages?size=10&status=any&search=5c4c839c7425ae1e09943513\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get latest queued messages\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/messages?size=50&page=0&status=queued\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get failed messages\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/messages?size=50&status=failed\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get messages sent to a phone number\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/messages?size=30&status=processed&phone=%2B123456789\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get messages by ID with any status\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/messages?size=10&status=any&search=5c4c839c7425ae1e09943513\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"post":{"summary":"Send message","description":"Send text, media or rich messages to any WhatsApp phone number or group chat through the connected WhatsApp number in your account.\n\n\n\nPlan-specific messaging features available per number's subscription plan:\n\n\n\n- **User messages** - All plans supported\n\n- **Multimedia messages** - Send image, video, audio, GIFs and documents\n\n- **Scheduled messages** - All plans except Gateway Professional\n\n- **Group messages** - All plans supported - Except WABA API numbers\n\n- **Channel messages** - All plans supported except Gateway Professional - Except WABA API numbers\n\n\n\n\n\n### How to use template variables in messages?\n\n\n\nYou can use the template variable syntax in order to display dynamic information in your messages based on a set of pre-defined variables.\n\nThe template variable syntax can used in any text message with double braces `{{` for opening and `}}` for closing the expression:\n\n`Dear {{ contact.name | customer }}, thanks for contacting us! We will answer your query shortly.`\n\n\n\n[Learn more about support template variables and examples here](/help/template)\n\n\n\n### I have multiple numbers connected: how to send messages through a specific number?\n\n\n\nIf you have multiple numbers connected to your account, you need to specify the `device` field in the JSON body with the target WhatsApp number device ID (24 characters hexadecimal value) you want to send the messages through.\n\nIf the `device` field is not specified, messages will be sent through the first connected WhatsApp number in your account.\n\n\n\n[Here is an example on how to send a message through a specific WhatsApp number](/help/api-tester?example=device-routing)\n\n\n\n### Notes about messages delivery\n\n\n\n- Queued messages are not delivered, by default, in strict order (FIFO) but are rather processed as a priority queue\n\n- For strict ordering message delivery, you can set the `order` field to `true` in the JSON body to enforce strict order for queued messages\n\n- Messages are delivered asynchronously (queue mode) in Gateway plans, and in real-time (live mode) in Platform plans. You can customize the delivery mode by setting the `enqueue` field to `always`, `never` or `opportunistic` (default) in the JSON body\n\n\n\nYou may check the [pricing table](/pricing) for more information about supported API features and limitations per plan.\n\n\n\n### Tutorials\n\n\n\n- 💬 [Send messages to phone numbers](/help/send-text-messages)\n\n- 💬 [Send messages to group chats](/help/send-group)\n\n- 💬 [Send dynamic buttons message](/help/send-buttons)\n\n- 💬 [Send dynamic list message](/help/send-list)\n\n- 📁 [Send multimedia messages (images, videos, documents, files or audios)](/help/send-media)\n\n- 💬 [Include emojis in text messages](/help/send-emojis)\n\n- 💬 [Send location messages](/help/send-location)\n\n- 💬 [Send contacts](/help/send-contacts)\n\n- 💬 [Send URL links in text messages](/help/send-links)\n\n- 💬 [Send auto-expiring messages](/help/send-expiration)\n\n- 💬 [Send messages in real-time without queueing](/help/send-live)\n\n- 💬 [Send messages through a specific WhatsApp number/device](/help/send-routing)\n\n- 💬 [Send messages in behalf of a chat agent](/help/send-as-agent)\n\n- 💬 [Send messages replying to a specific message](/help/send-reply)\n\n- 📝 [How to use template variables](/help/template)\n\n- 📝 [How to format text with styling in messages](/help/text-format)\n\n\n\n### Live API testing with examples\n\n\n\n[Go to the API live tester with dozens of examples](/help/api-tester)\n\n\n\n- 💬 [Send message to phone number](/help/api-tester?example=simple)\n\n- 💬 [Send message to group](/help/api-tester?example=group)\n\n- 💬 [Send image message](/help/api-tester?example=send-media)\n\n- 💬 [Send video message](/help/api-tester?example=send-video)\n\n- 💬 [Send audio message](/help/api-tester?example=send-audio)\n\n- 💬 [Send document PDF media message](/help/api-tester?example=send-document)\n\n- 📁 [Upload file from URL](/help/api-tester?example=upload)\n\n- 💬 [Send media file from uploaded file](/help/api-tester?example=send-media-file)\n\n- 💬 [Send scheduled message](/help/api-tester?example=scheduled)\n\n- 💬 [Send location message using physical address](/help/api-tester?example=address)\n\n- 💬 [Send poll to a user](/help/api-tester?example=send-poll)\n\n- 💬 [Send poll to a group](/help/api-tester?example=send-poll-group)\n\n- 💬 [Send votes on an existing user poll](/help/api-tester?example=send-votes)\n\n- 💬 [Send votes on an existing group poll](/help/api-tester?example=send-votes-group)\n\n- 💬 [Remove votes on an existing user poll](/help/api-tester?example=remove-votes)\n\n- 💬 [Send message with emojis](/help/api-tester?example=emojis)\n\n- 💬 [Send message with template variables](/help/api-tester?example=template)\n\n- 💬 [Send message with formatted text](/help/api-tester?example=format)\n\n- 💬 [Send message with URL links](/help/api-tester?example=links)\n\n- 💬 [Send contacts](/help/api-tester?example=contact)\n\n- 💬 [Reply to another message](/help/api-tester?example=reply)\n\n- 💬 [Forward message to another chat](/help/api-tester?example=forward)\n\n- 💬 [Reply to a buttons or list message](/help/api-tester?example=reply-select) 🆕\n\n- 💬 [Send scheduled message at a specific date](/help/api-tester?example=scheduled)\n\n- 💬 [Send auto-expiring messages at a specific date](/help/api-tester?example=send-expiration)\n\n- 💬 [Send message through a specific WhatsApp number](/help/api-tester?example=device-routing)\n\n- 💬 [Send message in real-time with no queueing](/help/api-tester?example=send-live)\n\n- 💬 [Send product catalog message](/help/api-tester?example=catalog)\n\n- 💬 [Send message reaction](/help/api-tester?example=reaction)\n\n- 💬 [Remove message reaction](/help/api-tester?example=reaction-remove)\n\n- 💬 [Send message with a maximum delivery retries](/help/api-tester?example=send-retries)\n\n- 💬 [Send message in strict order](/help/api-tester?example=send-order)\n\n- 💬 [Send message on behalf of an agent](/help/api-tester?example=agent)\n\n- 💬 [Send message and assign the chat to an agent](/help/api-tester?example=agent-assign)\n\n- 💬 [Send message and unassign the chat from an agent](/help/api-tester?example=agent-unassign)\n\n- 💬 [Send message and resolve chat automatically](/help/api-tester?example=agent-resolve)\n\n- 💬 [Send message and add labels to chat](/help/api-tester?example=send-labels)\n\n- 💬 [Send message and remove labels from chat](/help/api-tester?example=send-labels-remove)\n\n- 💬 [Send message and add metadata to the chat's contact](/help/api-tester?example=send-metadata)\n\n- 💬 [Send message and remove metadata from the chat's contact](/help/api-tester?example=send-metadata-remove)\n\n- 💬 [Send message with special text format](/help/api-tester?example=format)\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fmessages&method=POST&body=%7B%0A%20%20%22phone%22%3A%20%22%2B1234567890%22%2C%0A%20%20%22message%22%3A%20%22Hello%20world!%20This%20is%20a%20test%20message.%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"createMessage","tags":["Messages"],"produces":["application/json","application/x-www-form-urlencoded"],"consumes":["application/json"],"security":[{"apiKey":[]}],"parameters":[{"in":"body","name":"message","description":"Message payload body","schema":{"type":"object","properties":{"message":{"type":"string","minLength":0,"maxLength":15000,"description":"Text to be sent. WhatsApp rich text syntax allowed. [Read more about the syntax here](https://bit.ly/whatsapp-format-text). In group chats you can also mention participants using the following syntax: `@1234567890` where `1234567890` is the [E.164](https://en.wikipedia.org/wiki/E.164) phone number of the participant user."},"phone":{"type":"string","minLength":6,"description":"**Required field** if `group` and `channel` are empty. Phone number with international prefix using the [E164 format](https://en.wikipedia.org/wiki/E.164) to send the message. Example: `+1234567890`"},"group":{"type":"string","minLength":8,"maxLength":40,"description":"**Required field** if `phone` and `channel` are empty. Target group chat WhatsApp ID (WID) where the message should be delivered. You can retrieve the available group ID in your WhatsApp from the [Number dashboard](/number/groups). Example group ID: `123456789000000000@g.us`"},"channel":{"type":"string","minLength":18,"maxLength":30,"description":"**Required field** if `phone` and `group` are empty. Target channel WhatsApp ID (WID) where the message should be delivered. You can retrieve the available channel IDs in your WhatsApp from the [Number dashboard](/number/groups). Example channel ID: `123000098765421000@newsletter`"},"chat":{"type":"string","minLength":6,"maxLength":141,"description":"Target chat WhatsApp ID (WID) to send the message to. **If `phone`, `group` and `channel` fields are empty, this field will be required**. Example chat WIDs are: `1234567890@c.us` = for user chats, `123456789000000000@g.us` for group chats, `1234567890000000@newsletter` for channels, `1234567890000000@lid` for private user chats and `PE.1045742271480925@bsuid` for contacts who hide their phone number."},"number":{"type":"string","minLength":6,"maxLength":18,"description":"Source WhatsApp phone number connected in your account to be used for message delivery. Only required if you have multiple WhatsApp numbers connected. Alternatively, you can specicy the `device` ID field instead. Use this field to route messages through multiple WhatsApp numbers available in your account. If you have only one WhatsApp number connected, this field is optional. Required if you have multiple WhatsApp numbers connected. Example phone number value in [E164 format](https://en.wikipedia.org/wiki/E.164): `+1234567890`"},"device":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Target WhatsApp device ID to be used for the message delivery. Alternatively, you can use the `from` field to target your WhatsApp device by phone number instead of ID. If not present, the first connected number will be used by default. You can use this field to route messages across multiple numbers connected in your account. Obtain the device ID from the [Web Dashboard](/number/info)"},"agent":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Optional Agent ID to send the message on behalf of. The chat will not be assigned to the agent unless explicitly defined [via message actions](#supported-actions). The agent must have access permissions to the device. You can retrieve the agents ID [from here](#operation/getDeviceAgents)"},"template":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":512,"description":"Template name. Must match the pre-approved template name exactly. Use the [Get templates](#operation/getTemplates) endpoint to retrieve the list of approved templates."},"language":{"type":"string","pattern":"^[a-z]{2}(_[A-Z]{2})?$","description":"Optional. Language code of the template (e.g., en_US, es_ES). If not specified, the default language of the first template will be used.","example":"en_US"},"header":{"type":"object","properties":{"text":{"type":"object","properties":{"name":{"type":"string","pattern":"^[a-zA-Z0-9_]{1,32}$","maxLength":32,"description":"The variable placeholder named or positional value to match: use `0` to `9`  for positional variables and `name` syntax for named variables"},"value":{"type":"string","maxLength":1024,"description":"The text string to replace the variable placeholder `{{0}}` or `{{name}}`"}},"required":["name","value"],"additionalProperties":false},"media":{"type":"object","properties":{"type":{"type":"string","enum":["image","video","document"],"description":"Media type to be sent: image, video or document. If not specified, the type will be inferred from the file type."},"file":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","maxLength":24,"minLength":24,"description":"Uploaded File ID 24-length hexadecimal (preferred). The file must be previously uploaded by using the [Upload file API endpoint](#tag/Files/operation/uploadFile) and obtaning the unique file ID (24 length hexadecimal value)"},"url":{"type":"string","maxLength":2048,"description":"Public URL of the file to be sent. This method is slower, prone to errors and not recommended"},"caption":{"type":"string","maxLength":1024,"description":"Caption for the media (not supported on all types)"},"filename":{"type":"string","description":"Filename for documents. Ignored for other media types"}},"additionalProperties":false},"location":{"type":"object","properties":{"latitude":{"type":"number","format":"float","minimum":-90,"maximum":90},"longitude":{"type":"number","format":"float","minimum":-180,"maximum":180},"name":{"type":"string"},"address":{"type":"string"}},"required":["latitude","longitude"],"additionalProperties":false}},"additionalProperties":false,"description":"Header component can be either text, media (image, video, document) or location type."},"body":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"name":{"type":"string","pattern":"^[a-zA-Z0-9_]{1,32}$","maxLength":32,"description":"The variable placeholder named or positional value to match: use `0` to `9`  for positional variables and `name` syntax for named variables"},"value":{"type":"string","maxLength":1024,"description":"The text string to replace the variable placeholder `{{0}}` or `{{name}}`"}},"required":["name","value"],"additionalProperties":false},{"type":"object","properties":{"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 Currency Code (e.g. USD, EUR, GBP, IDR, BRL)"},"amount":{"type":"integer","description":"Amount in minor units multiplied by 1000 (e.g. 10990 for $10.99)"},"presentation":{"type":"string","description":"Default text if localization fails (e.g. \"$10.99\")"}},"required":["currency","amount","presentation"],"additionalProperties":false},{"type":"object","properties":{"date":{"type":"string","format":"date-time","description":"ISO 8601 date string (e.g. \"2025-12-05T14:45:00.000Z\"). Required if \"timestamp\" is not provided."},"timestamp":{"type":"integer","minimum":0,"description":"Unix epoch timestamp in seconds. Required if \"date\" is not provided."},"timezone":{"type":"string","description":"Optional IANA time zone name (e.g. \"America/New_York\" or \"Asia/Hong_Kong\"). If not specified, your account timezone will be used."},"calendar":{"type":"string","enum":["gregorian","solar_hijri"],"description":"Optional calendar system, either \"gregorian\" or \"solar_hijri\". Defaults to \"gregorian\" if not specified."}},"additionalProperties":false}]},"maxItems":15},"button":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["quick_reply","url","copy_code","mpm","flow"],"description":"Button type, defines the button action to be performed when the user taps the button"},"position":{"type":"integer","minimum":0,"maximum":9,"description":"Position order of the button start from 0 to 9. Optional if `type` is not `quick_reply`"},"url":{"type":"string","maxLength":2048,"description":"Required if `type` is url (the URL suffix)"},"name":{"type":"string","maxLength":32,"description":"Placeholder variable name to replace in the button URL template when `type` is `url`. Use `1` for positional variables, or `name` for named variables"},"value":{"type":"string","maxLength":512,"description":"Placeholder variable value to replace in the template, e.g: `{{1}}` or `{{name}}`. Only required if the button content template variables when `type` is `url`"},"coupon":{"type":"string","maxLength":15,"description":"Required if `type` is `copy_code`"},"action":{"type":"object","properties":{"flow":{"type":"string"},"data":{"type":"object","properties":{"flow_token":{"type":"string","maxLength":200},"flow_action_data":{"type":"object","properties":{},"additionalProperties":false}}},"thumbnail":{"type":"string"},"sections":{"type":"array","items":{}}},"additionalProperties":false,"description":"Required if `type` is `flow` or `mpm`"},"payload":{"type":"string","maxLength":128,"description":"Required if `type` is `quick_reply`"}},"additionalProperties":false,"description":"Template button component, can be of type: quick_reply, url, copy_code, mpm, flow"},"minItems":0,"maxItems":10},"timeoffer":{"type":"object","properties":{"date":{"type":"string","format":"date-time","description":"ISO 8601 formatted date string indicating when the offer expires. E.g: `2025-12-31T23:59:59.000Z`"},"timestamp":{"type":"integer","minimum":1793958160639,"description":"Unix epoch timestamp in seconds indicating when the offer expires. E.g: `1735689600`"},"timezone":{"type":"string","description":"Optional IANA time zone name (e.g. \"America/New_York\" or \"Asia/Hong_Kong\"). If not specified, your account timezone will be used."}},"required":["date"],"additionalProperties":false},"flow":{"type":"object","properties":{"token":{"type":"string","maxLength":200,"description":"Optional session token Meta returns with the answers. Defaults to one that identifies this message."},"data":{"type":"object","properties":{},"additionalProperties":false,"description":"Optional initial data for the first screen of the form, as declared in its Flow JSON."}},"additionalProperties":false,"description":"For templates with a WhatsApp Form (FLOW) button: the form token and prefill data."},"components":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["header"]},"parameters":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text","image","video","document","location","product"]},"text":{"type":"string"},"image":{"type":"object","properties":{"id":{"type":"string"},"link":{"type":"string"},"caption":{"type":"string"}},"additionalProperties":false},"video":{"type":"object","properties":{"id":{"type":"string"},"link":{"type":"string"},"caption":{"type":"string"}},"additionalProperties":false},"document":{"type":"object","properties":{"id":{"type":"string"},"link":{"type":"string"},"caption":{"type":"string"},"filename":{"type":"string"}},"additionalProperties":false},"location":{"type":"object","properties":{"latitude":{"type":"number","format":"float"},"longitude":{"type":"number","format":"float"},"name":{"type":"string"},"address":{"type":"string"}},"required":["latitude","longitude"],"additionalProperties":false},"product":{"type":"object","properties":{"product_retailer_id":{"type":"string"},"catalog_id":{"type":"string"}},"additionalProperties":false}},"required":["type"],"additionalProperties":false},"maxItems":1}},"required":["type","parameters"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["body"]},"parameters":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text","currency","date_time"]},"text":{"type":"string"},"parameter_name":{"type":"string"},"currency":{"type":"object","properties":{"fallback_value":{"type":"string"},"code":{"type":"string","minLength":3,"maxLength":3},"amount_1000":{"type":"integer"}},"required":["fallback_value","code","amount_1000"],"additionalProperties":false},"date_time":{"type":"object","properties":{"fallback_value":{"type":"string"},"day_of_week":{"type":"integer"},"year":{"type":"integer"},"month":{"type":"integer"},"day_of_month":{"type":"integer"},"hour":{"type":"integer"},"minute":{"type":"integer"},"calendar":{"type":"string"}},"required":["fallback_value"],"additionalProperties":false}},"required":["type"],"additionalProperties":false}}},"required":["type","parameters"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["button"]},"sub_type":{"type":"string","enum":["quick_reply","url","copy_code","CATALOG","MPM","flow"]},"index":{"type":"integer","minimum":0,"maximum":9},"parameters":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["payload","text","coupon_code","action"]},"payload":{"type":"string"},"text":{"type":"string"},"coupon_code":{"type":"string"},"action":{"type":"object","properties":{"flow_token":{"type":"string","maxLength":200},"flow_action_data":{"type":"object","properties":{},"additionalProperties":false},"thumbnail_product_retailer_id":{"type":"string"},"sections":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"product_items":{"type":"array","items":{"type":"object","properties":{"product_retailer_id":{"type":"string"}},"required":["product_retailer_id"],"additionalProperties":false}}},"additionalProperties":false}}},"additionalProperties":false}},"required":["type"],"additionalProperties":false},"maxItems":1}},"required":["type","sub_type","index","parameters"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["limited_time_offer"]},"parameters":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["limited_time_offer"]},"limited_time_offer":{"type":"object","properties":{"expiration_time_ms":{"type":"integer"}},"required":["expiration_time_ms"],"additionalProperties":false}},"required":["type","limited_time_offer"],"additionalProperties":false},"maxItems":1}},"required":["type","parameters"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["carousel"]},"cards":{"type":"array","items":{"type":"object","properties":{"card_index":{"type":"integer","minimum":0},"components":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["header"]},"parameters":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text","image","video","document","location","product"]},"text":{"type":"string"},"image":{"type":"object","properties":{"id":{"type":"string"},"link":{"type":"string"},"caption":{"type":"string"}},"additionalProperties":false},"video":{"type":"object","properties":{"id":{"type":"string"},"link":{"type":"string"},"caption":{"type":"string"}},"additionalProperties":false},"document":{"type":"object","properties":{"id":{"type":"string"},"link":{"type":"string"},"caption":{"type":"string"},"filename":{"type":"string"}},"additionalProperties":false},"location":{"type":"object","properties":{"latitude":{"type":"number","format":"float"},"longitude":{"type":"number","format":"float"},"name":{"type":"string"},"address":{"type":"string"}},"required":["latitude","longitude"],"additionalProperties":false},"product":{"type":"object","properties":{"product_retailer_id":{"type":"string"},"catalog_id":{"type":"string"}},"additionalProperties":false}},"required":["type"],"additionalProperties":false},"maxItems":1}},"required":["type","parameters"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["body"]},"parameters":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text","currency","date_time"]},"text":{"type":"string"},"parameter_name":{"type":"string"},"currency":{"type":"object","properties":{"fallback_value":{"type":"string"},"code":{"type":"string","minLength":3,"maxLength":3},"amount_1000":{"type":"integer"}},"required":["fallback_value","code","amount_1000"],"additionalProperties":false},"date_time":{"type":"object","properties":{"fallback_value":{"type":"string"},"day_of_week":{"type":"integer"},"year":{"type":"integer"},"month":{"type":"integer"},"day_of_month":{"type":"integer"},"hour":{"type":"integer"},"minute":{"type":"integer"},"calendar":{"type":"string"}},"required":["fallback_value"],"additionalProperties":false}},"required":["type"],"additionalProperties":false}}},"required":["type","parameters"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["button"]},"sub_type":{"type":"string","enum":["quick_reply","url","copy_code","CATALOG","MPM","flow"]},"index":{"type":"integer","minimum":0,"maximum":9},"parameters":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["payload","text","coupon_code","action"]},"payload":{"type":"string"},"text":{"type":"string"},"coupon_code":{"type":"string"},"action":{"type":"object","properties":{"flow_token":{"type":"string","maxLength":200},"flow_action_data":{"type":"object","properties":{},"additionalProperties":false},"thumbnail_product_retailer_id":{"type":"string"},"sections":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"product_items":{"type":"array","items":{"type":"object","properties":{"product_retailer_id":{"type":"string"}},"required":["product_retailer_id"],"additionalProperties":false}}},"additionalProperties":false}}},"additionalProperties":false}},"required":["type"],"additionalProperties":false},"maxItems":1}},"required":["type","sub_type","index","parameters"],"additionalProperties":false}]}}},"required":["card_index","components"],"additionalProperties":false},"minItems":1,"maxItems":10}},"required":["type","cards"],"additionalProperties":false}]},"minItems":1,"description":"Only required if fields `template.header`, `template.body`, `template.button` and `template.timeoffer` are empty.\nThis field accepts the same template components payload data schema as WhatsApp Business API for compatibility purposes. Use it for convenience in case you already have template components in the WABA compatible schema. [Learn more about template components](https://developers.facebook.com/documentation/business-messaging/whatsapp/templates/overview#parameter-formats)"}},"additionalProperties":false,"description":"Send a WhatsApp Template Message. Only applicable to WABA API numbers. Template messages must be pre-approved by WhatsApp. [Learn more here](/help/waba-templates)"},"deliverAt":{"type":"string","format":"date-time","description":"Custom date time in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format of when to deliver the message."},"schedule":{"type":"object","properties":{"delay":{"type":"number","format":"float","minimum":1,"maximum":63072000,"description":"Schedule message delivery after the given seconds. E.g: 300"},"delayTo":{"type":"string","pattern":"^([0-9]{1,8})([y|M|w|d|h|m|s]{1})$","minLength":2,"maxLength":5,"description":"Schedule message delivery using time duration syntax. Example valid values are: 1h, 15m, 12h, 1d. Read more about the duration syntax [here](https://momentjs.com/docs/#/durations/)."},"date":{"type":"string","format":"date-time","description":"Schedule message delivery after a custom [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format date time. E.g: 2019-01-23T23:22:59.776Z"}},"additionalProperties":false,"description":"Optional message schedule, one of the following fields must be present: `delay`, `delayTo` or `date`"},"typing":{"type":"integer","minimum":2,"maximum":30,"description":"Optional. Seconds to simulate the user is typing or recording status (only in audio messages) in the target chat before message delivery. The minimum typing status is 2 seconds, up to 30 seconds. If not specified, the system will automatically simuate it based on a random duration no longer than 3 seconds."},"contact":{"type":"object","properties":{"phone":{"type":"string","minLength":6,"maxLength":16,"description":"Contact international phone number in E164 format. Example: +1234567890"},"name":{"type":"string","minLength":1,"maxLength":40,"description":"Contact name alias or full name. Example: Michael Jordan"}},"required":["phone","name"],"additionalProperties":false,"description":"Send a single contact card"},"contacts":{"type":"array","items":{"type":"object","properties":{"phone":{"type":"string","minLength":6,"maxLength":16,"description":"Contact international phone number in E164 format. Example: +1234567890"},"name":{"type":"string","minLength":1,"maxLength":40,"description":"Contact name alias or full name. Example: Michael Jordan"}},"required":["phone","name"],"additionalProperties":false,"description":"Send a single contact card"},"minItems":1,"maxItems":10,"description":"Send multiple contact cards. Each contact entry is based on an E164 international phone number and contact name. Contact name can have spaces representing a person full name. You can send up to 10 contacts in a single message."},"quote":{"type":"string","minLength":18,"maxLength":200,"description":"Message ID to quote when sending the new message. The message ID can be a WhatsApp native ID (18, 20, 22 or 32 hexadecimal characters length, or a WABA ID) or a platform-specific outbound message ID (24 hexadecimal characters length). As per WhatsApp restriction, you can only quote messages within the same conversation. In case the quoted message ID is not found or no longer available within the chat, the new message will be always delivered without the quote annotation."},"selectId":{"type":"string","maxLength":50,"description":"Reply to buttons or list messages by selecting one of the available elements by its unique ID. \n**Important**: requires the `quote` field to be present referring to the original buttons or list message ID to be replied to."},"forward":{"type":"object","properties":{"message":{"type":"string","minLength":18,"maxLength":32,"description":"Message ID to forward. The message ID can be a WhatsApp native ID (18, 20, 22 or 32 hexadecimal characters length) or a platform-specific outbound message ID (24 hexadecimal characters length). As per WhatsApp restriction, you can only quote messages within the same conversation. In case the quoted message ID is not found or no longer available within the chat, the new message will be always delivered without the quote annotation."},"chat":{"type":"string","minLength":8,"maxLength":32,"description":"Source chat ID where the message to forward belongs to. The chat ID can be an E164 international phone number or a group chat ID. In case you cannot provide the chat ID or chat phone number, the system will try to discover the chat ID automatically. If the chat ID cannot be discovered, the API will return an `400` error. E.g: `+1234567890`, `123456789000000000@g.us`"}},"additionalProperties":false,"description":"Forward a message by source chat and message ID."},"media":{"type":"object","properties":{"file":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Uploaded file ID to send as media message content. The file must be previously uploaded by using the [Upload file API endpoint](#tag/Files/operation/uploadFile) and obtaning the unique file ID (24 length alphanumeric value)\n\n**Important**: you cannot put the file content here. Alternatively, you can send a media file using the `media.url` field specifying a publicly accessible file URL (see the `url` field below)."},"format":{"type":"string","enum":["gif","ptt","native"],"description":"Optional file display format when applicable for GIFs (videos) and Voice recording (audios)","default":"native"},"message":{"type":"string","minLength":0,"maxLength":15000,"description":"Optional media file text caption to use when deliverying the message - Only applicable to image and video media files, otherwise ignored. In case there is no message body field defined in the actual message to be delivered."},"viewOnce":{"type":"boolean","description":"Optional, only applicable to images and videos. If you set `viewMode` as `true`, the media content will disappear on WhatsApp after the recipient has opened it and exited the media viewer. Once they exit the media viewer, the media will no longer be visible in that chat and they can't view it again. View once photos and videos won't be saved to the recipient's Photos or Gallery, and they can't forward them."},"url":{"type":"string","minLength":10,"maxLength":1024,"description":"Internet reachable public URL to download the file content. If the URL returns an error, is not reachable from the Internet, or the file type is not valid, the API will return a `400 Bad Request` error."},"filename":{"type":"string","minLength":3,"maxLength":200,"description":"Optional file name. If not defined, it is taken from the file URL or form content, if available. Otherwise a random file name will be generated."},"reference":{"type":"string","minLength":2,"maxLength":150,"description":"Optional file reference user-defined identifier. This might be useful to identify files across systems, for instance, a CRM or storage system."},"permission":{"type":"string","enum":["public","readonly","private"],"description":"Optional file access permission. Defaults to `public`: all team members can access, download and send the file. If set to `private` only the file owner can access, download and send the file."},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":50},"minItems":1,"maxItems":10,"description":"Optional file tags, up to 10 tags per file. Each tag cannot have more than 50 characters."},"expiration":{"type":"string","minLength":2,"maxLength":5,"enum":["10m","30m","1h","6h","12h","1d","2d","3d","5d","6d","7d","15d","30d","60d","90d","120d","180d","360d","1y","2y"],"description":"File storage expiration time limit, after which the file will be deleted from the system. Defaults to 15 days.","default":"30d"}},"additionalProperties":false,"description":"Send media content as image (jpeg, png, webp), video (mp4), audio (mp3, ogg), document (pdf, docx, xlsx, csv, pptx) or binary file (zip, rar, 7z)."},"poll":{"type":"object","properties":{"name":{"type":"string","maxLength":255,"description":"Poll name or title."},"options":{"type":"array","items":{"type":"string","minLength":1,"maxLength":100,"description":"Poll option text. Up to 100 characters."},"minItems":2,"maxItems":12,"description":"Poll options to vote. Each option must have a text value. Up to 12 options are allowed."},"multiple":{"type":"boolean","description":"Allow multiple votes per user. Defaults to many votes per user.","default":true}},"additionalProperties":false},"vote":{"type":"object","properties":{"poll":{"type":"string","pattern":"[a-fA-F0-9]","minLength":18,"maxLength":32,"description":"Poll message ID to vote. The message ID can be a WhatsApp native ID (18, 20, 22 or 32 hexadecimal characters length) or platform-native message ID (24 hexadecimal characters length)."},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"number","format":"float","minimum":0,"maximum":11,"description":"Poll option ID to vote, from 0 to 11."},"value":{"type":"string","minLength":1,"maxLength":100,"description":"Poll option text value to vote."}},"additionalProperties":false},"minItems":0,"maxItems":12,"description":"Poll options to vote, or use an empty array to remove all votes. Each option must have an ID or value text. You can send multiple options to vote. Already voted options will be overwritten by the options defined."}},"additionalProperties":false,"description":"Send one or multiple votes on a existing poll by message ID. To remove all votes, send an empty array: `[]`."},"event":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"Event name or title. Up to 100 characters."},"description":{"type":"string","maxLength":2048,"description":"Optional event description message. Up to 2048 characters."},"date":{"type":"string","format":"date-time","description":"Event date and time in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. E.g: `2024-08-15T12:30:00:000Z`"},"location":{"type":"string","maxLength":255,"description":"Optional event location name. Up to 255 characters."},"latitude":{"type":"number","format":"float","minimum":-90,"maximum":90,"description":"Optional event location latitude. Must be a valid number between -90 and 90."},"longitude":{"type":"number","format":"float","minimum":-180,"maximum":180,"description":"Optional event location longitude. Must be a valid number between -180 and 180."},"call":{"type":"string","enum":["voice","video","none"],"description":"Optionally use or generate a WhatsApp meeting call to join the event. Default to no call. Available options are: `voice` or `video` call."},"code":{"type":"string","pattern":"[a-zA-Z0-9]/","minLength":21,"maxLength":22,"description":"Optional call link code to join the event. The code must be a valid alphanumeric string of 21 or 22 characters length. The code will be appended to the WhatsApp call link URL. E.g: `https://call.whatsapp.com/voice/$CODE`"}},"required":["date"],"additionalProperties":false,"description":"Send WhatsApp event message with a name, description, location, date and optional call link."},"attend":{"type":"object","properties":{"event":{"type":"string","pattern":"[a-fA-f0-9]","minLength":18,"maxLength":32,"description":"Event message ID to respond to. The message ID can be a WhatsApp native ID (18, 20, 22 or 32 hexadecimal characters length) or platform-native message ID (24 hexadecimal characters length)."},"confirm":{"type":"boolean","description":"Confirm the event attendance. Defaults to `true`. Use `false` to reject attending."}},"additionalProperties":false},"reference":{"type":"string","minLength":1,"maxLength":150,"description":"Optional user-defined message reference for easy traceability with existent systems. For instance, you can define as reference the ID of the customer in your CRM. The `reference` value will be provided in every webhook event."},"live":{"type":"boolean","description":"Send message in live mode without enqueuing it (also known as real-time). If `true`, this is equivalent to using `enqueue`=`never`. Note pnly Platform plan support live message delivery mode, otherwise the message will be queued or fail.","default":false},"enqueue":{"type":"string","enum":["never","always","opportunistic"],"description":"Defines the message delivery behavior. By default, messages are queued and processed asynchronously in background. For Platform plans, you can force message delivery in real time without queueing it and getting a synchronous response with the actual message delivery status (delivered, failed, not found, error).\n\n\nSupported queue modes:\n\n- **always** - Always enqueue the message to be processed in background by the queue system based on message priority and delivery date. **Default** mode in Gateway plans. Both Gateway and Platform plans support this mode.\n\n- **never** - Never enqueue the message and try to deliver it in real-time through the target WhatsApp number. In case the number session is not online or connection is not operative, it will return an error. API consumer should handle the error gracefully and retry the message delivery if needed. Gateway plans does not support this mode.\n\n- **opportunistic**: Try to deliver the message in real-time if the device is online and can accept messages. If message cannot deliver due to an error or full queue, message will be transparently enqueued and processed asynchronously later. **Default** mode in Platform plans. Gateway plans does not support this mode."},"previewUrl":{"type":"boolean","description":"Enable or disable URL image/title preview in the target message by using OpenGraph protocol. Enabled by default."},"location":{"type":"object","properties":{"request":{"type":"boolean","description":"If set to `true`, the message will be sent as a location request message, prompting the user to share their current location. If set to `false` or not defined, the message will be sent as a standard location message with the provided address or coordinates."},"address":{"type":"string","minLength":3,"maxLength":100,"description":"Location human-friendly address value. Cannot be used together with coordinates. The system will geocode the address in order to accurately locate it via coordinates."},"name":{"type":"string","maxLength":100,"description":"Optional location name if address is not defined. If empty, coordinates geo reverse will be used in order to infer the location name."},"coordinates":{"type":"array","items":{"type":"number","format":"double","minimum":-180,"maximum":180},"minItems":2,"maxItems":2,"description":"Location coordinates in latitude and longitude format. Cannot be used together with address. Use `name` field if you wish to provide a custom location description, otherwise the system will georeverse the location name."}},"additionalProperties":false},"product":{"type":"string","pattern":"[0-9]{14,18}","minLength":16,"maxLength":18,"description":"Send a product catalog message by product ID. This feature only available in WhatsApp Business numbers with an existing catalog available."},"order":{"type":"boolean","description":"Use this if you want to ensure all messages are sent to the target chat in strict order. If enabled, the system will ensure the message is delivered in the same order as it was sent. This feature is useful for chatbot automations and message sequences. This feature is not compatible with `live=true` nor `enqueue=never` options.","default":false},"reaction":{"type":"string","minLength":1,"maxLength":10,"description":"Send reaction emoji to an existing message. To remove a reaction, use `-` as reaction value. Requires `reactionMessage` field to be present with the WhatsApp message ID to react to. Single emoji character is supported. Available emojis can be obtained here: [getemoji.com](https://getemojis.com)"},"reactionMessage":{"type":"string","pattern":"[a-fA-F0-9]{18,32}|[A-Za-z0-9+/_\\-.=]{32,200}","maxLength":200,"description":"WhatsApp message unique ID to react or unreact (hexadecimal 18, 20, 22 or 32 characters length or WABA ID) E.g: `3EB029A0219B0037CA10`. Requires `reaction` field to be present."},"retries":{"type":"number","format":"float","minimum":0,"maximum":1000,"description":"Maximum message delivery retries.","default":25},"retryWait":{"type":"number","format":"float","minimum":0,"maximum":86400,"description":"Optional user defined wait time for every message retry attempt in seconds. Use 0 to disable it. If not defined, the default system exponential backoff will be used."},"expiration":{"type":"object","properties":{"seconds":{"type":"number","format":"float","minimum":5,"maximum":8035200,"description":"Make the message expire if delivery was not possible after the given seconds. E.g: 300"},"duration":{"type":"string","pattern":"^([0-9]{1,8})([y|M|w|d|h|m|s]{1})$","minLength":2,"maxLength":5,"description":"Make the message expires after a given time duration syntax. Example valid values are: 1h, 15m, 12h, 1d. Read more about the duration syntax [here](https://momentjs.com/docs/#/durations/)."},"date":{"type":"string","format":"date-time","description":"Make the message expire to specific date-hour by using a datetime [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601). E.g: 2019-01-23T23:22:59.776Z"}},"additionalProperties":false,"description":"Define a message time-to-live (ttl) expiration time. Use this if you want to automatically do not send a message if the delivery was not possible after a while. E.g: 1h"},"actions":{"type":"array","items":{"type":"object","properties":{"action":{"type":"string","maxLength":50,"enum":["chat:assign","chat:unassign","chat:resolve","chat:unresolve","chat:read","chat:unread","labels:add","labels:set","labels:remove","metadata:add","metadata:set","metadata:remove"],"description":"Action command. See above the supported commands and params"},"params":{"type":"object","properties":{},"description":"Optional param to use per action. See the documentation above for further details about supported params per specific action command."}},"required":["action"],"additionalProperties":false},"maxItems":10,"description":"Optional list of actions to perform after the message delivery.\n\n\n\nActions scope are limited to the chat/contact receiving the message.\n\n\n\nIf the message delivery fails, actions will be ignored.\n\n\n\n**Note**: this feature is only applicable to devices with multi-agent chat support.\n\n\n\n### Supported actions\n\n\n\n* **Action**: `chat:assign`\n* **Description**: Assign chat to an agent.\n* **Params**:\n  - **agent**: `string` (optional) - Required if `department` is not defined. Agent ID to assign the chat to after message delivery. You can retrieve the agents ID [from here](#operation/getDeviceAgents)\n  - **department**: `string` (optional) - Required if `agent` is not defined. Department ID to assign the chat to after message delivery. It can be together with `agent` field to assign a chat to both an agent and department. You can retrieve the department ID [from here](#operation/getDepartments)\n  - **assigner**: `string` (optional) - Optinoal. Agent ID who assigns the chat to the other agent\n----\n* **Action**: `chat:unassign`\n* **Description**: Unassign chat from existing agent\n* **Params**:\n  - **assigner**: `string` (optional) - Agent ID who assigns the chat to the other agent. You can retrieve the agents ID [from here](#operation/getDeviceAgents)\n----\n* **Action**: `chat:resolve`\n* **Description**: Resolve chat if not already resolved. Cannot be used along with `chat:unresolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `chat:unresolve`\n* **Description**: Unresolve chat if already resolved. Cannot be used along with `chat:resolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `chat:read`\n* **Description**: Mark the chat internally as read in the web chat interface after the message is delivered. Cannot be used along with `chat:resolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `chat:unread`\n* **Description**: Mark the chat internally as unread in the web chat interface after the message is delivered. Cannot be used along with `chat:resolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `labels:add`\n* **Description**: Add label(s) to the chat after the message is delivered\n* **Params**:\n  - **labels**: `array` (optional) - Label tags to add to the chat while keeping the existing ones. You can obtain a list of existing labels [querying this endpoint](#operation/getLabels)\n----\n* **Action**: `labels:remove`\n* **Description**: Remove label(s) from the chat, when already present, after the message is delivered\n* **Params**:\n  - **labels**: `array` (optional) - Label tags to remove from the chat. You can obtain a list of existing labels [querying this endpoint](#operation/getLabels)\n----\n* **Action**: `labels:set`\n* **Description**: Set and override label(s) in the chat after the message is delivered\n* **Params**:\n  - **labels**: `array` (optional) - Label tags to set and override in the chat. You can obtain a list of existing labels [querying this endpoint](#operation/getLabels)\n----\n* **Action**: `metadata:set`\n* **Description**: Set and override metadata key-value entries in the target chat's contact entity after the message is delivered\n* **Params**:\n  - **metadata**: `array` (optional) - Metadata entries with `key` and `value` properties to set and override in the chat's contact\n----\n* **Action**: `metadata:add`\n* **Description**: Add or override by `key` field existing metadata key-value entries in the target chat's contact entity after the message is delivered\n* **Params**:\n  - **metadata**: `array` (optional) - Metadata entries with `key` and `value` properties to append in the chat's contact\n----\n* **Action**: `metadata:remove`\n* **Description**: Remove existing metadata entries by `key` field in the target chat's contact entity after the message is delivered\n* **Params**:\n  - **keys**: `array` (optional) - Metadata entries to remove by `key` in the chat's contact"},"sendReadAck":{"type":"boolean","description":"Report unread chat messages after message delivery, simulating native user behavior.\n\nUse \"true\" in order to report to the target user/group members that received messages were readed by you with blue double-check.\n\nNote: in case you have disabled read confirmation in WhatsApp Settings > Account > Privacy, this configuration will have no effect.","default":false},"retentionPolicy":{"type":"string","enum":["plan_defaults","never","5m","15m","30m","1h","12h","24h","2d","3d","4d","5d","6d","7d","10d"],"description":"Optional message retention policy. By default, the current plan device data retention policy will be used.\n\nRetention policy defines the maximum allowed time in which the message should be stored in the system after it was delivered or failed.\n\nIf you want to enforce the system to do not to store any message after it is being proessed, use \"never\" as policy."},"priority":{"type":"string","enum":["low","normal","high","urgent"],"description":"Message priority. We recommend do not abusing of \"high\" or \"urgent\" priorities unless it is strictly sensitive to deliver the message as soon as possible. Otherwise, use just the default \"normal\" priority.","default":"normal"},"header":{"type":"string","maxLength":60,"description":"Optional message header text, up to 60 characters. Restricted to messages with reply buttons and list messages."},"footer":{"type":"string","maxLength":60,"description":"Optional message footer text, restricted to messages with reply buttons and list messages."},"buttons":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-zA-Z0-9_]*$","maxLength":256,"description":"User defined button unique identifier - only alphanumeric characters allowed. Helpful for chatbot automations. If not defined, a random alphanumeric ID of 6 characters length will be used instead."},"text":{"type":"string","minLength":1,"maxLength":20,"description":"Button text to displayed to the user, up to 20 characters, including emojis."},"kind":{"type":"string","enum":["reply","url","call"],"description":"Button kind, defaults to `reply` (displays text and replies to the message whe selected). Other valid options are: `url` for opening any URL and `call` for calling a phone number (E164 phone number compatible format).","default":"reply"},"value":{"type":"string","minLength":1,"maxLength":300,"description":"Required phone number or URL value for buttons with `kind` = `call` or `url`. Otherwise ignored."}},"additionalProperties":false},"maxItems":10,"description":"Send user-defined reply dynamic buttons, up to 10 button entries per message, with optional message `header` and `footer` text (see fields below).\n\n**This is how button messages will look like on WhatsApp**:\n![](/images/docs/buttons.webp)\n\nUseful for chatbot automations and more user-friendly reply interactions.\n\n**Certain restrictions apply**:\n\n1. Cannot send special buttons with link URL or phone number call actions to group chats, only individual user chats.\n2. Cannot send buttons as the first message that initiates a new conversation with a third-party user.\n3. Instead, use a text message as first message, then following by a second message that can be a buttons message."},"list":{"type":"object","properties":{"description":{"type":"string","maxLength":1024,"description":"**Required**: list message box level description message"},"button":{"type":"string","minLength":1,"maxLength":20,"description":"**Required**: button text to open the list displayed to the user, up to 20 characters, including emojis."},"title":{"type":"string","maxLength":60,"description":"**Optional**: list message box level title message"},"footer":{"type":"string","maxLength":60,"description":"**Optional**: list message box level footer message"},"sections":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string","maxLength":24,"description":"**Required** if the message has more than one section, otherwise **Optional**: section items title"},"rows":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string","maxLength":24,"description":"**Required**: row title"},"id":{"type":"string","maxLength":50,"description":"**Optional**: row entry ID, useful for user seleccion response handling. If not defined, a randomly generated hexadecimal ID will be used."},"description":{"type":"string","maxLength":72,"description":"**Optional**: row entry description to display to the user."}},"additionalProperties":false},"minItems":1,"maxItems":10}},"additionalProperties":false},"minItems":1,"maxItems":10,"description":"**Required**: list section composed of a title and a list of rows per section. Up to 10 sections with each section having up to 10 rows per message."}},"additionalProperties":false,"description":"Send user-defined dynamic selection lists, up to 10 sections, each section having up to 10 rows, per message.\n\nOptionally you can define a message `title`, `footer` and `description` message list (see fields below for more information).\n\nUseful for chatbot automations and more user-friendly reply interactions.\n\n**Certain restrictions apply**:\n\n1. You cannot send a list as the first message that initiates a new conversation with a third-party user.\n2. Instead, use a text message as first message, then following by a second message that can be a list message."},"flowMessage":{"type":"object","properties":{"flowId":{"type":"string","description":"WhatsApp Flow ID to send."},"flowCta":{"type":"string","minLength":1,"maxLength":30,"description":"Call-to-action button label, up to 30 characters."},"screen":{"type":"string","description":"Entry screen ID to open. Required for `navigate` flows (static flows)."},"action":{"type":"string","enum":["navigate","data_exchange"],"description":"Flow action. Static flows use `navigate`.","default":"navigate"},"data":{"type":"object","properties":{},"additionalProperties":false,"description":"Optional initial data passed to the entry screen."},"flowToken":{"type":"string","description":"Optional idempotency/session token. Auto-generated if omitted."},"mode":{"type":"string","enum":["published","draft"],"description":"Send a published or draft flow.","default":"published"}},"required":["flowId","flowCta"],"additionalProperties":false,"description":"Send a WhatsApp Flow as a native interactive message. The message text is taken from the `message` field, with optional `header`/`footer`."}},"additionalProperties":false}},{"name":"Idempotency-Key","in":"header","required":false,"type":"string","minimum":6,"maximum":36,"description":"Optional header. The idempotency key is a unique value generated by the API client which the server uses to recognize subsequent retries of the same request. How you create unique keys is up to you, but we suggest using [V4 UUIDs](https://en.wikipedia.org/wiki/Universally_unique_identifier), or another random string with enough entropy to avoid collisions. If a message with the same idempotency key already exists, the server will reply with a `409 Conflict` status, referencing the existing message ID in the JSON response error at `meta.message` field."}],"responses":{"201":{"description":"Message created","schema":{"$ref":"#/definitions/message"},"headers":{"Device-ID":{"type":"string","description":"Device ID used for message delivery"},"Device-Phone":{"type":"string","description":"Device phone number used for message delivery"},"Queue-Status":{"type":"string","enum":["pause","active","reject","freeze"],"description":"Current device messages queue status"},"Queue-Limit":{"type":"number","format":"integer","description":"Maximum allowed messages queue size in the current device"},"Queue-Size":{"type":"number","format":"integer","description":"Total messages waiting in the device's queue currently"},"Queue-Available":{"type":"number","format":"integer","description":"Available free message slots in the device's queue"}}},"400":{"description":"Bad request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Queue status does not allow to enqueue or deliver new messages","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Phone number does not exists in WhatsApp","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict - Message already exists","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Server error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service unavailable","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Send text message to a phone number\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/messages \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"phone\":\"+1234567890\",\"message\":\"Hello world! This is a test message.\"}'\n\n\n// Send text message with high priority to a group\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/messages \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"group\":\"123456789000000000@g.us\",\"priority\":\"high\",\"message\":\"Hello world! This is a simple test message.\"}'\n\n\n// Send media message to user. Note the file must be updated first, see API endpoint: Files > Upload file\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/messages \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"phone\":\"+1234567890\",\"message\":\"Hello world! This is a test media message.\",\"media\":{\"file\":\"<24 characters length file ID>\"}}'\n\n\n// Send text message that should be delivered now\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/messages \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"phone\":\"+1234567890\",\"message\":\"Hello world! This is a simple test message.\",\"enqueue\":\"never\"}'\n\n\n// Send a scheduled messages with a custom delay. See \"schedule.delayTo\" datetime notation shortcuts: https://i.ibb.co/g3DJLSH/datetime-shortcuts.png\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/messages \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"phone\":\"+1234567890\",\"schedule\":{\"delayTo\":\"1h\"},\"message\":\"Hello world! This is a simple test message.\"}'\n\n\n// Send a scheduled messages at a concrete date with a valid ISO 8601 date\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/messages \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"phone\":\"+1234567890\",\"deliverAt\":\"2019-01-01T11:00:00.410Z\",\"message\":\"Hello world! This is a simple test message.\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Send text message to a phone number\necho '{\"phone\":\"+1234567890\",\"message\":\"Hello world! This is a test message.\"}' |  \\\n  http POST https://api.wassenger.com/v1/messages \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Send text message with high priority to a group\necho '{\"group\":\"123456789000000000@g.us\",\"priority\":\"high\",\"message\":\"Hello world! This is a simple test message.\"}' |  \\\n  http POST https://api.wassenger.com/v1/messages \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Send media message to user. Note the file must be updated first, see API endpoint: Files > Upload file\necho '{\"phone\":\"+1234567890\",\"message\":\"Hello world! This is a test media message.\",\"media\":{\"file\":\"<24 characters length file ID>\"}}' |  \\\n  http POST https://api.wassenger.com/v1/messages \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Send text message that should be delivered now\necho '{\"phone\":\"+1234567890\",\"message\":\"Hello world! This is a simple test message.\",\"enqueue\":\"never\"}' |  \\\n  http POST https://api.wassenger.com/v1/messages \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Send a scheduled messages with a custom delay. See \"schedule.delayTo\" datetime notation shortcuts: https://i.ibb.co/g3DJLSH/datetime-shortcuts.png\necho '{\"phone\":\"+1234567890\",\"schedule\":{\"delayTo\":\"1h\"},\"message\":\"Hello world! This is a simple test message.\"}' |  \\\n  http POST https://api.wassenger.com/v1/messages \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Send a scheduled messages at a concrete date with a valid ISO 8601 date\necho '{\"phone\":\"+1234567890\",\"deliverAt\":\"2019-01-01T11:00:00.410Z\",\"message\":\"Hello world! This is a simple test message.\"}' |  \\\n  http POST https://api.wassenger.com/v1/messages \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Send text message to a phone number\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/messages';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phone\":\"+1234567890\",\"message\":\"Hello world! This is a test message.\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send text message with high priority to a group\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/messages';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"group\":\"123456789000000000@g.us\",\"priority\":\"high\",\"message\":\"Hello world! This is a simple test message.\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send media message to user. Note the file must be updated first, see API endpoint: Files > Upload file\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/messages';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phone\":\"+1234567890\",\"message\":\"Hello world! This is a test media message.\",\"media\":{\"file\":\"<24 characters length file ID>\"}}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send text message that should be delivered now\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/messages';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phone\":\"+1234567890\",\"message\":\"Hello world! This is a simple test message.\",\"enqueue\":\"never\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send a scheduled messages with a custom delay. See \"schedule.delayTo\" datetime notation shortcuts: https://i.ibb.co/g3DJLSH/datetime-shortcuts.png\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/messages';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phone\":\"+1234567890\",\"schedule\":{\"delayTo\":\"1h\"},\"message\":\"Hello world! This is a simple test message.\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send a scheduled messages at a concrete date with a valid ISO 8601 date\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/messages';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phone\":\"+1234567890\",\"deliverAt\":\"2019-01-01T11:00:00.410Z\",\"message\":\"Hello world! This is a simple test message.\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Send text message to a phone number\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/messages',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {phone: '+1234567890', message: 'Hello world! This is a test message.'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send text message with high priority to a group\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/messages',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    group: '123456789000000000@g.us',\n    priority: 'high',\n    message: 'Hello world! This is a simple test message.'\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send media message to user. Note the file must be updated first, see API endpoint: Files > Upload file\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/messages',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    phone: '+1234567890',\n    message: 'Hello world! This is a test media message.',\n    media: {file: '<24 characters length file ID>'}\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send text message that should be delivered now\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/messages',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    phone: '+1234567890',\n    message: 'Hello world! This is a simple test message.',\n    enqueue: 'never'\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send a scheduled messages with a custom delay. See \"schedule.delayTo\" datetime notation shortcuts: https://i.ibb.co/g3DJLSH/datetime-shortcuts.png\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/messages',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    phone: '+1234567890',\n    schedule: {delayTo: '1h'},\n    message: 'Hello world! This is a simple test message.'\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send a scheduled messages at a concrete date with a valid ISO 8601 date\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/messages',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    phone: '+1234567890',\n    deliverAt: '2019-01-01T11:00:00.410Z',\n    message: 'Hello world! This is a simple test message.'\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Send text message to a phone number\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/messages');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  phone: '+1234567890',\n  message: 'Hello world! This is a test message.'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Send text message with high priority to a group\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/messages');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  group: '123456789000000000@g.us',\n  priority: 'high',\n  message: 'Hello world! This is a simple test message.'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Send media message to user. Note the file must be updated first, see API endpoint: Files > Upload file\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/messages');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  phone: '+1234567890',\n  message: 'Hello world! This is a test media message.',\n  media: {\n    file: '<24 characters length file ID>'\n  }\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Send text message that should be delivered now\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/messages');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  phone: '+1234567890',\n  message: 'Hello world! This is a simple test message.',\n  enqueue: 'never'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Send a scheduled messages with a custom delay. See \"schedule.delayTo\" datetime notation shortcuts: https://i.ibb.co/g3DJLSH/datetime-shortcuts.png\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/messages');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  phone: '+1234567890',\n  schedule: {\n    delayTo: '1h'\n  },\n  message: 'Hello world! This is a simple test message.'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Send a scheduled messages at a concrete date with a valid ISO 8601 date\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/messages');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  phone: '+1234567890',\n  deliverAt: '2019-01-01T11:00:00.410Z',\n  message: 'Hello world! This is a simple test message.'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Send text message to a phone number\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/messages', [\n  'body' => '{\"phone\":\"+1234567890\",\"message\":\"Hello world! This is a test message.\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Send text message with high priority to a group\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/messages', [\n  'body' => '{\"group\":\"123456789000000000@g.us\",\"priority\":\"high\",\"message\":\"Hello world! This is a simple test message.\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Send media message to user. Note the file must be updated first, see API endpoint: Files > Upload file\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/messages', [\n  'body' => '{\"phone\":\"+1234567890\",\"message\":\"Hello world! This is a test media message.\",\"media\":{\"file\":\"<24 characters length file ID>\"}}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Send text message that should be delivered now\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/messages', [\n  'body' => '{\"phone\":\"+1234567890\",\"message\":\"Hello world! This is a simple test message.\",\"enqueue\":\"never\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Send a scheduled messages with a custom delay. See \"schedule.delayTo\" datetime notation shortcuts: https://i.ibb.co/g3DJLSH/datetime-shortcuts.png\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/messages', [\n  'body' => '{\"phone\":\"+1234567890\",\"schedule\":{\"delayTo\":\"1h\"},\"message\":\"Hello world! This is a simple test message.\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Send a scheduled messages at a concrete date with a valid ISO 8601 date\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/messages', [\n  'body' => '{\"phone\":\"+1234567890\",\"deliverAt\":\"2019-01-01T11:00:00.410Z\",\"message\":\"Hello world! This is a simple test message.\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Send text message to a phone number\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'phone' => '+1234567890',\n  'message' => 'Hello world! This is a test message.'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/messages');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Send text message with high priority to a group\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'group' => '123456789000000000@g.us',\n  'priority' => 'high',\n  'message' => 'Hello world! This is a simple test message.'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/messages');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Send media message to user. Note the file must be updated first, see API endpoint: Files > Upload file\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'phone' => '+1234567890',\n  'message' => 'Hello world! This is a test media message.',\n  'media' => [\n    'file' => '<24 characters length file ID>'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/messages');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Send text message that should be delivered now\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'phone' => '+1234567890',\n  'message' => 'Hello world! This is a simple test message.',\n  'enqueue' => 'never'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/messages');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Send a scheduled messages with a custom delay. See \"schedule.delayTo\" datetime notation shortcuts: https://i.ibb.co/g3DJLSH/datetime-shortcuts.png\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'phone' => '+1234567890',\n  'schedule' => [\n    'delayTo' => '1h'\n  ],\n  'message' => 'Hello world! This is a simple test message.'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/messages');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Send a scheduled messages at a concrete date with a valid ISO 8601 date\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'phone' => '+1234567890',\n  'deliverAt' => '2019-01-01T11:00:00.410Z',\n  'message' => 'Hello world! This is a simple test message.'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/messages');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Send text message to a phone number\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/messages\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'phone' => '+1234567890',\n    'message' => 'Hello world! This is a test message.'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Send text message with high priority to a group\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/messages\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'group' => '123456789000000000@g.us',\n    'priority' => 'high',\n    'message' => 'Hello world! This is a simple test message.'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Send media message to user. Note the file must be updated first, see API endpoint: Files > Upload file\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/messages\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'phone' => '+1234567890',\n    'message' => 'Hello world! This is a test media message.',\n    'media' => [\n        'file' => '<24 characters length file ID>'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Send text message that should be delivered now\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/messages\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'phone' => '+1234567890',\n    'message' => 'Hello world! This is a simple test message.',\n    'enqueue' => 'never'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Send a scheduled messages with a custom delay. See \"schedule.delayTo\" datetime notation shortcuts: https://i.ibb.co/g3DJLSH/datetime-shortcuts.png\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/messages\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'phone' => '+1234567890',\n    'schedule' => [\n        'delayTo' => '1h'\n    ],\n    'message' => 'Hello world! This is a simple test message.'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Send a scheduled messages at a concrete date with a valid ISO 8601 date\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/messages\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'phone' => '+1234567890',\n    'deliverAt' => '2019-01-01T11:00:00.410Z',\n    'message' => 'Hello world! This is a simple test message.'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Send text message to a phone number\nimport requests\n\nurl = \"https://api.wassenger.com/v1/messages\"\n\npayload = {\n    \"phone\": \"+1234567890\",\n    \"message\": \"Hello world! This is a test message.\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Send text message with high priority to a group\nimport requests\n\nurl = \"https://api.wassenger.com/v1/messages\"\n\npayload = {\n    \"group\": \"123456789000000000@g.us\",\n    \"priority\": \"high\",\n    \"message\": \"Hello world! This is a simple test message.\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Send media message to user. Note the file must be updated first, see API endpoint: Files > Upload file\nimport requests\n\nurl = \"https://api.wassenger.com/v1/messages\"\n\npayload = {\n    \"phone\": \"+1234567890\",\n    \"message\": \"Hello world! This is a test media message.\",\n    \"media\": { \"file\": \"<24 characters length file ID>\" }\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Send text message that should be delivered now\nimport requests\n\nurl = \"https://api.wassenger.com/v1/messages\"\n\npayload = {\n    \"phone\": \"+1234567890\",\n    \"message\": \"Hello world! This is a simple test message.\",\n    \"enqueue\": \"never\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Send a scheduled messages with a custom delay. See \"schedule.delayTo\" datetime notation shortcuts: https://i.ibb.co/g3DJLSH/datetime-shortcuts.png\nimport requests\n\nurl = \"https://api.wassenger.com/v1/messages\"\n\npayload = {\n    \"phone\": \"+1234567890\",\n    \"schedule\": { \"delayTo\": \"1h\" },\n    \"message\": \"Hello world! This is a simple test message.\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Send a scheduled messages at a concrete date with a valid ISO 8601 date\nimport requests\n\nurl = \"https://api.wassenger.com/v1/messages\"\n\npayload = {\n    \"phone\": \"+1234567890\",\n    \"deliverAt\": \"2019-01-01T11:00:00.410Z\",\n    \"message\": \"Hello world! This is a simple test message.\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Send text message to a phone number\nconst url = 'https://api.wassenger.com/v1/messages';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phone\":\"+1234567890\",\"message\":\"Hello world! This is a test message.\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send text message with high priority to a group\nconst url = 'https://api.wassenger.com/v1/messages';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"group\":\"123456789000000000@g.us\",\"priority\":\"high\",\"message\":\"Hello world! This is a simple test message.\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send media message to user. Note the file must be updated first, see API endpoint: Files > Upload file\nconst url = 'https://api.wassenger.com/v1/messages';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phone\":\"+1234567890\",\"message\":\"Hello world! This is a test media message.\",\"media\":{\"file\":\"<24 characters length file ID>\"}}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send text message that should be delivered now\nconst url = 'https://api.wassenger.com/v1/messages';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phone\":\"+1234567890\",\"message\":\"Hello world! This is a simple test message.\",\"enqueue\":\"never\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send a scheduled messages with a custom delay. See \"schedule.delayTo\" datetime notation shortcuts: https://i.ibb.co/g3DJLSH/datetime-shortcuts.png\nconst url = 'https://api.wassenger.com/v1/messages';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phone\":\"+1234567890\",\"schedule\":{\"delayTo\":\"1h\"},\"message\":\"Hello world! This is a simple test message.\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send a scheduled messages at a concrete date with a valid ISO 8601 date\nconst url = 'https://api.wassenger.com/v1/messages';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phone\":\"+1234567890\",\"deliverAt\":\"2019-01-01T11:00:00.410Z\",\"message\":\"Hello world! This is a simple test message.\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Send text message to a phone number\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/messages',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"phone\":\"+1234567890\",\"message\":\"Hello world! This is a test message.\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Send text message with high priority to a group\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/messages',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"group\":\"123456789000000000@g.us\",\"priority\":\"high\",\"message\":\"Hello world! This is a simple test message.\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Send media message to user. Note the file must be updated first, see API endpoint: Files > Upload file\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/messages',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"phone\":\"+1234567890\",\"message\":\"Hello world! This is a test media message.\",\"media\":{\"file\":\"<24 characters length file ID>\"}}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Send text message that should be delivered now\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/messages',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"phone\":\"+1234567890\",\"message\":\"Hello world! This is a simple test message.\",\"enqueue\":\"never\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Send a scheduled messages with a custom delay. See \"schedule.delayTo\" datetime notation shortcuts: https://i.ibb.co/g3DJLSH/datetime-shortcuts.png\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/messages',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"phone\":\"+1234567890\",\"schedule\":{\"delayTo\":\"1h\"},\"message\":\"Hello world! This is a simple test message.\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Send a scheduled messages at a concrete date with a valid ISO 8601 date\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/messages',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"phone\":\"+1234567890\",\"deliverAt\":\"2019-01-01T11:00:00.410Z\",\"message\":\"Hello world! This is a simple test message.\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Send text message to a phone number\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/messages\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"phone\\\":\\\"+1234567890\\\",\\\"message\\\":\\\"Hello world! This is a test message.\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Send text message with high priority to a group\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/messages\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"group\\\":\\\"123456789000000000@g.us\\\",\\\"priority\\\":\\\"high\\\",\\\"message\\\":\\\"Hello world! This is a simple test message.\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Send media message to user. Note the file must be updated first, see API endpoint: Files > Upload file\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/messages\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"phone\\\":\\\"+1234567890\\\",\\\"message\\\":\\\"Hello world! This is a test media message.\\\",\\\"media\\\":{\\\"file\\\":\\\"<24 characters length file ID>\\\"}}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Send text message that should be delivered now\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/messages\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"phone\\\":\\\"+1234567890\\\",\\\"message\\\":\\\"Hello world! This is a simple test message.\\\",\\\"enqueue\\\":\\\"never\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Send a scheduled messages with a custom delay. See \"schedule.delayTo\" datetime notation shortcuts: https://i.ibb.co/g3DJLSH/datetime-shortcuts.png\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/messages\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"phone\\\":\\\"+1234567890\\\",\\\"schedule\\\":{\\\"delayTo\\\":\\\"1h\\\"},\\\"message\\\":\\\"Hello world! This is a simple test message.\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Send a scheduled messages at a concrete date with a valid ISO 8601 date\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/messages\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"phone\\\":\\\"+1234567890\\\",\\\"deliverAt\\\":\\\"2019-01-01T11:00:00.410Z\\\",\\\"message\\\":\\\"Hello world! This is a simple test message.\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Send text message to a phone number\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/messages\"\n\n\tpayload := strings.NewReader(\"{\\\"phone\\\":\\\"+1234567890\\\",\\\"message\\\":\\\"Hello world! This is a test message.\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Send text message with high priority to a group\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/messages\"\n\n\tpayload := strings.NewReader(\"{\\\"group\\\":\\\"123456789000000000@g.us\\\",\\\"priority\\\":\\\"high\\\",\\\"message\\\":\\\"Hello world! This is a simple test message.\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Send media message to user. Note the file must be updated first, see API endpoint: Files > Upload file\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/messages\"\n\n\tpayload := strings.NewReader(\"{\\\"phone\\\":\\\"+1234567890\\\",\\\"message\\\":\\\"Hello world! This is a test media message.\\\",\\\"media\\\":{\\\"file\\\":\\\"<24 characters length file ID>\\\"}}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Send text message that should be delivered now\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/messages\"\n\n\tpayload := strings.NewReader(\"{\\\"phone\\\":\\\"+1234567890\\\",\\\"message\\\":\\\"Hello world! This is a simple test message.\\\",\\\"enqueue\\\":\\\"never\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Send a scheduled messages with a custom delay. See \"schedule.delayTo\" datetime notation shortcuts: https://i.ibb.co/g3DJLSH/datetime-shortcuts.png\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/messages\"\n\n\tpayload := strings.NewReader(\"{\\\"phone\\\":\\\"+1234567890\\\",\\\"schedule\\\":{\\\"delayTo\\\":\\\"1h\\\"},\\\"message\\\":\\\"Hello world! This is a simple test message.\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Send a scheduled messages at a concrete date with a valid ISO 8601 date\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/messages\"\n\n\tpayload := strings.NewReader(\"{\\\"phone\\\":\\\"+1234567890\\\",\\\"deliverAt\\\":\\\"2019-01-01T11:00:00.410Z\\\",\\\"message\\\":\\\"Hello world! This is a simple test message.\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Send text message to a phone number\nvar client = new RestClient(\"https://api.wassenger.com/v1/messages\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"phone\\\":\\\"+1234567890\\\",\\\"message\\\":\\\"Hello world! This is a test message.\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Send text message with high priority to a group\nvar client = new RestClient(\"https://api.wassenger.com/v1/messages\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"group\\\":\\\"123456789000000000@g.us\\\",\\\"priority\\\":\\\"high\\\",\\\"message\\\":\\\"Hello world! This is a simple test message.\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Send media message to user. Note the file must be updated first, see API endpoint: Files > Upload file\nvar client = new RestClient(\"https://api.wassenger.com/v1/messages\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"phone\\\":\\\"+1234567890\\\",\\\"message\\\":\\\"Hello world! This is a test media message.\\\",\\\"media\\\":{\\\"file\\\":\\\"<24 characters length file ID>\\\"}}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Send text message that should be delivered now\nvar client = new RestClient(\"https://api.wassenger.com/v1/messages\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"phone\\\":\\\"+1234567890\\\",\\\"message\\\":\\\"Hello world! This is a simple test message.\\\",\\\"enqueue\\\":\\\"never\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Send a scheduled messages with a custom delay. See \"schedule.delayTo\" datetime notation shortcuts: https://i.ibb.co/g3DJLSH/datetime-shortcuts.png\nvar client = new RestClient(\"https://api.wassenger.com/v1/messages\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"phone\\\":\\\"+1234567890\\\",\\\"schedule\\\":{\\\"delayTo\\\":\\\"1h\\\"},\\\"message\\\":\\\"Hello world! This is a simple test message.\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Send a scheduled messages at a concrete date with a valid ISO 8601 date\nvar client = new RestClient(\"https://api.wassenger.com/v1/messages\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"phone\\\":\\\"+1234567890\\\",\\\"deliverAt\\\":\\\"2019-01-01T11:00:00.410Z\\\",\\\"message\\\":\\\"Hello world! This is a simple test message.\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Send text message to a phone number\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/messages\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"phone\\\":\\\"+1234567890\\\",\\\"message\\\":\\\"Hello world! This is a test message.\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Send text message with high priority to a group\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/messages\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"group\\\":\\\"123456789000000000@g.us\\\",\\\"priority\\\":\\\"high\\\",\\\"message\\\":\\\"Hello world! This is a simple test message.\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Send media message to user. Note the file must be updated first, see API endpoint: Files > Upload file\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/messages\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"phone\\\":\\\"+1234567890\\\",\\\"message\\\":\\\"Hello world! This is a test media message.\\\",\\\"media\\\":{\\\"file\\\":\\\"<24 characters length file ID>\\\"}}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Send text message that should be delivered now\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/messages\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"phone\\\":\\\"+1234567890\\\",\\\"message\\\":\\\"Hello world! This is a simple test message.\\\",\\\"enqueue\\\":\\\"never\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Send a scheduled messages with a custom delay. See \"schedule.delayTo\" datetime notation shortcuts: https://i.ibb.co/g3DJLSH/datetime-shortcuts.png\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/messages\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"phone\\\":\\\"+1234567890\\\",\\\"schedule\\\":{\\\"delayTo\\\":\\\"1h\\\"},\\\"message\\\":\\\"Hello world! This is a simple test message.\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Send a scheduled messages at a concrete date with a valid ISO 8601 date\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/messages\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"phone\\\":\\\"+1234567890\\\",\\\"deliverAt\\\":\\\"2019-01-01T11:00:00.410Z\\\",\\\"message\\\":\\\"Hello world! This is a simple test message.\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Send text message to a phone number\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/messages\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"phone\\\":\\\"+1234567890\\\",\\\"message\\\":\\\"Hello world! This is a test message.\\\"}\")\n  .asString();\n\n\n// Send text message with high priority to a group\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/messages\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"group\\\":\\\"123456789000000000@g.us\\\",\\\"priority\\\":\\\"high\\\",\\\"message\\\":\\\"Hello world! This is a simple test message.\\\"}\")\n  .asString();\n\n\n// Send media message to user. Note the file must be updated first, see API endpoint: Files > Upload file\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/messages\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"phone\\\":\\\"+1234567890\\\",\\\"message\\\":\\\"Hello world! This is a test media message.\\\",\\\"media\\\":{\\\"file\\\":\\\"<24 characters length file ID>\\\"}}\")\n  .asString();\n\n\n// Send text message that should be delivered now\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/messages\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"phone\\\":\\\"+1234567890\\\",\\\"message\\\":\\\"Hello world! This is a simple test message.\\\",\\\"enqueue\\\":\\\"never\\\"}\")\n  .asString();\n\n\n// Send a scheduled messages with a custom delay. See \"schedule.delayTo\" datetime notation shortcuts: https://i.ibb.co/g3DJLSH/datetime-shortcuts.png\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/messages\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"phone\\\":\\\"+1234567890\\\",\\\"schedule\\\":{\\\"delayTo\\\":\\\"1h\\\"},\\\"message\\\":\\\"Hello world! This is a simple test message.\\\"}\")\n  .asString();\n\n\n// Send a scheduled messages at a concrete date with a valid ISO 8601 date\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/messages\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"phone\\\":\\\"+1234567890\\\",\\\"deliverAt\\\":\\\"2019-01-01T11:00:00.410Z\\\",\\\"message\\\":\\\"Hello world! This is a simple test message.\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Send text message to a phone number\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"phone\\\":\\\"+1234567890\\\",\\\"message\\\":\\\"Hello world! This is a test message.\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/messages\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Send text message with high priority to a group\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"group\\\":\\\"123456789000000000@g.us\\\",\\\"priority\\\":\\\"high\\\",\\\"message\\\":\\\"Hello world! This is a simple test message.\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/messages\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Send media message to user. Note the file must be updated first, see API endpoint: Files > Upload file\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"phone\\\":\\\"+1234567890\\\",\\\"message\\\":\\\"Hello world! This is a test media message.\\\",\\\"media\\\":{\\\"file\\\":\\\"<24 characters length file ID>\\\"}}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/messages\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Send text message that should be delivered now\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"phone\\\":\\\"+1234567890\\\",\\\"message\\\":\\\"Hello world! This is a simple test message.\\\",\\\"enqueue\\\":\\\"never\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/messages\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Send a scheduled messages with a custom delay. See \"schedule.delayTo\" datetime notation shortcuts: https://i.ibb.co/g3DJLSH/datetime-shortcuts.png\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"phone\\\":\\\"+1234567890\\\",\\\"schedule\\\":{\\\"delayTo\\\":\\\"1h\\\"},\\\"message\\\":\\\"Hello world! This is a simple test message.\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/messages\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Send a scheduled messages at a concrete date with a valid ISO 8601 date\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"phone\\\":\\\"+1234567890\\\",\\\"deliverAt\\\":\\\"2019-01-01T11:00:00.410Z\\\",\\\"message\\\":\\\"Hello world! This is a simple test message.\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/messages\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Send text message to a phone number\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/messages\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"phone\\\":\\\"+1234567890\\\",\\\"message\\\":\\\"Hello world! This is a test message.\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Send text message with high priority to a group\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/messages\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"group\\\":\\\"123456789000000000@g.us\\\",\\\"priority\\\":\\\"high\\\",\\\"message\\\":\\\"Hello world! This is a simple test message.\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Send media message to user. Note the file must be updated first, see API endpoint: Files > Upload file\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/messages\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"phone\\\":\\\"+1234567890\\\",\\\"message\\\":\\\"Hello world! This is a test media message.\\\",\\\"media\\\":{\\\"file\\\":\\\"<24 characters length file ID>\\\"}}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Send text message that should be delivered now\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/messages\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"phone\\\":\\\"+1234567890\\\",\\\"message\\\":\\\"Hello world! This is a simple test message.\\\",\\\"enqueue\\\":\\\"never\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Send a scheduled messages with a custom delay. See \"schedule.delayTo\" datetime notation shortcuts: https://i.ibb.co/g3DJLSH/datetime-shortcuts.png\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/messages\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"phone\\\":\\\"+1234567890\\\",\\\"schedule\\\":{\\\"delayTo\\\":\\\"1h\\\"},\\\"message\\\":\\\"Hello world! This is a simple test message.\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Send a scheduled messages at a concrete date with a valid ISO 8601 date\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/messages\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"phone\\\":\\\"+1234567890\\\",\\\"deliverAt\\\":\\\"2019-01-01T11:00:00.410Z\\\",\\\"message\\\":\\\"Hello world! This is a simple test message.\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Send text message to a phone number\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/messages' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"phone\":\"+1234567890\",\"message\":\"Hello world! This is a test message.\"}'\n\n\n# Send text message with high priority to a group\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/messages' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"group\":\"123456789000000000@g.us\",\"priority\":\"high\",\"message\":\"Hello world! This is a simple test message.\"}'\n\n\n# Send media message to user. Note the file must be updated first, see API endpoint: Files > Upload file\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/messages' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"phone\":\"+1234567890\",\"message\":\"Hello world! This is a test media message.\",\"media\":{\"file\":\"<24 characters length file ID>\"}}'\n\n\n# Send text message that should be delivered now\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/messages' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"phone\":\"+1234567890\",\"message\":\"Hello world! This is a simple test message.\",\"enqueue\":\"never\"}'\n\n\n# Send a scheduled messages with a custom delay. See \"schedule.delayTo\" datetime notation shortcuts: https://i.ibb.co/g3DJLSH/datetime-shortcuts.png\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/messages' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"phone\":\"+1234567890\",\"schedule\":{\"delayTo\":\"1h\"},\"message\":\"Hello world! This is a simple test message.\"}'\n\n\n# Send a scheduled messages at a concrete date with a valid ISO 8601 date\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/messages' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"phone\":\"+1234567890\",\"deliverAt\":\"2019-01-01T11:00:00.410Z\",\"message\":\"Hello world! This is a simple test message.\"}'"},{"lang":"ObjC","source":"// Send text message to a phone number\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"phone\": @\"+1234567890\",\n                              @\"message\": @\"Hello world! This is a test message.\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/messages\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Send text message with high priority to a group\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"group\": @\"123456789000000000@g.us\",\n                              @\"priority\": @\"high\",\n                              @\"message\": @\"Hello world! This is a simple test message.\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/messages\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Send media message to user. Note the file must be updated first, see API endpoint: Files > Upload file\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"phone\": @\"+1234567890\",\n                              @\"message\": @\"Hello world! This is a test media message.\",\n                              @\"media\": @{ @\"file\": @\"<24 characters length file ID>\" } };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/messages\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Send text message that should be delivered now\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"phone\": @\"+1234567890\",\n                              @\"message\": @\"Hello world! This is a simple test message.\",\n                              @\"enqueue\": @\"never\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/messages\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Send a scheduled messages with a custom delay. See \"schedule.delayTo\" datetime notation shortcuts: https://i.ibb.co/g3DJLSH/datetime-shortcuts.png\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"phone\": @\"+1234567890\",\n                              @\"schedule\": @{ @\"delayTo\": @\"1h\" },\n                              @\"message\": @\"Hello world! This is a simple test message.\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/messages\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Send a scheduled messages at a concrete date with a valid ISO 8601 date\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"phone\": @\"+1234567890\",\n                              @\"deliverAt\": @\"2019-01-01T11:00:00.410Z\",\n                              @\"message\": @\"Hello world! This is a simple test message.\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/messages\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Send text message to a phone number\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"phone\": \"+1234567890\",\n  \"message\": \"Hello world! This is a test message.\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/messages\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Send text message with high priority to a group\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"group\": \"123456789000000000@g.us\",\n  \"priority\": \"high\",\n  \"message\": \"Hello world! This is a simple test message.\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/messages\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Send media message to user. Note the file must be updated first, see API endpoint: Files > Upload file\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"phone\": \"+1234567890\",\n  \"message\": \"Hello world! This is a test media message.\",\n  \"media\": [\"file\": \"<24 characters length file ID>\"]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/messages\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Send text message that should be delivered now\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"phone\": \"+1234567890\",\n  \"message\": \"Hello world! This is a simple test message.\",\n  \"enqueue\": \"never\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/messages\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Send a scheduled messages with a custom delay. See \"schedule.delayTo\" datetime notation shortcuts: https://i.ibb.co/g3DJLSH/datetime-shortcuts.png\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"phone\": \"+1234567890\",\n  \"schedule\": [\"delayTo\": \"1h\"],\n  \"message\": \"Hello world! This is a simple test message.\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/messages\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Send a scheduled messages at a concrete date with a valid ISO 8601 date\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"phone\": \"+1234567890\",\n  \"deliverAt\": \"2019-01-01T11:00:00.410Z\",\n  \"message\": \"Hello world! This is a simple test message.\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/messages\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/keypass/disconnect":{"parameters":[],"post":{"summary":"Revoke the keypass helper token","description":"Revoke the account-wide keypass token for the authenticated token holder. Downloaded extensions stop working; linked numbers are unaffected. Authorized via the keypassToken scheme (Authorization header).\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fkeypass%2Fdisconnect&method=POST&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"disconnectKeypass","security":[{"keypassToken":[]}],"tags":["Keypass"],"produces":["application/json"],"parameters":[],"responses":{"200":{"description":"Token revoked"},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Invalid or revoked keypass token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Invalid keypass token format","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many keypass attempts","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n"},{"lang":"Node (axios)","source":""},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n"},{"lang":"PHP (curl)","source":""},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n"},{"lang":"Ruby","source":""},{"lang":"Go","source":""},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n"},{"lang":"C","source":""},{"lang":"Powershell","source":""},{"lang":"ObjC","source":""},{"lang":"Swift","source":""}]}},"/keypass/devices":{"parameters":[],"get":{"summary":"List keypass-connectable numbers","description":"List the WhatsApp Web numbers the account-wide keypass token holder can connect, with account and user identity for the extension. Authorized via the keypassToken scheme (Authorization header).\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fkeypass%2Fdevices)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"listKeypassDevices","security":[{"keypassToken":[]}],"tags":["Keypass"],"produces":["application/json"],"parameters":[],"responses":{"200":{"description":"Account, user, and connectable numbers"},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Invalid or revoked keypass token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Invalid keypass token format","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many keypass attempts","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n"},{"lang":"Node (axios)","source":""},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n"},{"lang":"PHP (curl)","source":""},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n"},{"lang":"Ruby","source":""},{"lang":"Go","source":""},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n"},{"lang":"C","source":""},{"lang":"Powershell","source":""},{"lang":"ObjC","source":""},{"lang":"Swift","source":""}]}},"/install/vault":{"parameters":[],"get":{"summary":"Vault","description":"Read the vault of the calling install: its host credentials and the version to write on top of.\n\n\n\nA revoked install reads the copy kept for 24 hours, and `null` once that copy is gone.","operationId":"getInstallVault","security":[{"apiKey":[]}],"tags":["Integrations"],"parameters":[],"responses":{"default":{"description":"Vault","schema":{"type":"object"}}}},"put":{"summary":"Write vault","description":"Replace the vault of the calling install, writing on top of the version last read.\n\n\n\nA different version answers 409 `install:vault_conflict`: read again and write on top of what comes back. The vault takes at most 16 KB.","operationId":"putInstallVault","security":[{"apiKey":[]}],"tags":["Integrations"],"parameters":[{"name":"body","in":"body","required":true,"schema":{"type":"object","required":["version","data"],"properties":{"version":{"type":"integer"},"data":{"type":"object"}}}}],"responses":{"409":{"description":"The vault changed since it was read"},"default":{"description":"Vault","schema":{"type":"object"}}}}},"/install/agents":{"parameters":[],"get":{"summary":"Install agents","description":"List the account owner and the agents who can answer on the numbers of the calling install, with the numbers each one reaches.","operationId":"listInstallAgents","security":[{"apiKey":[]}],"tags":["Integrations"],"parameters":[],"responses":{"default":{"description":"Agents","schema":{"type":"array","items":{"type":"object"}}}}}},"/install":{"parameters":[],"get":{"summary":"Install","description":"Read the CRM install the calling bridge or install token belongs to, with its numbers, scopes, events and webhook signing secrets.\n\n\n\nRequires a bridge key with the `X-Install-Id` header, or an install token. A regular API key has no install and receives a 403.","operationId":"getInstall","security":[{"apiKey":[]}],"tags":["Integrations"],"parameters":[],"responses":{"403":{"description":"The token has no install, the install was revoked, or its token expired"},"default":{"description":"Install","schema":{"type":"object"}}}},"patch":{"summary":"Update install","description":"Update the CRM install of the calling bridge: its external account id, host status, host metadata and activation.\n\n\n\n`hostInfo` merges by key and a key written as an empty string is removed. `status` only takes `active`, and only on a pending install.","operationId":"patchInstall","security":[{"apiKey":[]}],"tags":["Integrations"],"parameters":[{"name":"body","in":"body","required":true,"schema":{"type":"object","properties":{"externalAccountId":{"type":"string"},"hostStatus":{},"hostInfo":{"type":"object"},"status":{"type":"string","enum":["active"]}}}}],"responses":{"400":{"description":"A field the install cannot write"},"409":{"description":"The status change is not allowed, or the external account is taken"},"default":{"description":"Install","schema":{"type":"object"}}}},"delete":{"summary":"Revoke install","description":"Revoke the CRM install of the calling token.\n\n\n\nA bridge sends `{ \"reason\": \"bridge\" }` or `{ \"reason\": \"host_uninstalled\" }` and keeps read access to the install and its vault for 24 hours. An install token sends no body and its access ends at once.","operationId":"revokeInstall","security":[{"apiKey":[]}],"tags":["Integrations"],"parameters":[{"name":"body","in":"body","required":false,"schema":{"type":"object","properties":{"reason":{"type":"string"}}}}],"responses":{"400":{"description":"A reason the token cannot use, or a body where none is allowed"},"default":{"description":"Install","schema":{"type":"object"}}}}},"/files":{"parameters":[],"get":{"summary":"Search files","description":"List files, optionally using multiple search filters.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Ffiles&params=%5B%7B%22key%22%3A%22size%22%2C%22value%22%3A25%7D%2C%7B%22key%22%3A%22page%22%2C%22value%22%3A0%7D%2C%7B%22key%22%3A%22status%22%2C%22value%22%3A%22any%22%7D%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"searchFiles","security":[{"apiKey":[]}],"tags":["Files"],"produces":["application/json"],"parameters":[{"in":"query","name":"page","type":"number","format":"integer","default":0,"minimum":0,"maximum":100},{"in":"query","name":"size","type":"number","format":"integer","default":20,"minimum":1,"maximum":100},{"in":"query","name":"search","description":"Search files by filename, tags or reference","type":"string","maxLength":100},{"name":"after","description":"Deliver at after the given date","in":"query","type":"string","format":"date-time"},{"name":"before","description":"Deliver at before the given date","in":"query","type":"string","format":"date-time"},{"name":"format","in":"query","type":"array","collectionFormat":"csv","maxItems":3,"description":"Filter files by format type. If not present, files with any format will be returned","items":{"type":"string","enum":["gif","ptt","native"]}},{"name":"ids","in":"query","type":"array","collectionFormat":"csv","maxItems":50,"description":"Filter files by IDs","items":{"type":"string","minLength":24,"maxLength":24,"pattern":"^[0-9A-Fa-f]{24}$"}},{"name":"tags","in":"query","type":"array","collectionFormat":"csv","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":50},"description":"Search files by user-defined tags field. Search engine perform a partial term match where `.` or `-` characters cannot be used these are processed as separators, instead for explicit search filter wrap the search term with double quotes, e.g: `\"search term\"`"},{"name":"sha2","in":"query","type":"string","description":"Find a file by its SHA2 checksum value","minLength":64,"maxLength":64,"pattern":"^[0-9a-f]{64}$"},{"name":"reference","in":"query","type":"string","minLength":1,"maxLength":50,"description":"Search files by user-defined reference field. Search engine perform a partial term match where `.` or `-` characters cannot be used these are processed as separators, instead for explicit search filter wrap the search term with double quotes, e.g: `\"search term\"`"},{"in":"query","name":"status","type":"array","collectionFormat":"csv","maxItems":10,"items":{"type":"string","enum":["any","valid","invalid","banned","removed","disabled","expired","active","protected"]}},{"in":"query","name":"device","type":"string","minLength":24,"maxLength":24,"pattern":"^[0-9A-Fa-f]{24}$"},{"in":"query","name":"filename","type":"string","minLength":1,"maxLength":150,"description":"Search files by user-defined filename field. Search engine perform a partial term match where `.` or `-` characters cannot be used since these are processed as separators, instead for explicit search filter wrap the search term with double quotes, e.g: `\"search term\"`"},{"in":"query","name":"filenameSearch","type":"string","minLength":2,"maxLength":150,"description":"Substring search on filename field (case-insensitive). Returns files whose filename contains the given term. Minimum 2 characters required."},{"in":"query","name":"origin","type":"string","enum":["remote","upload","catalog"]},{"in":"query","name":"mime","type":"array","collectionFormat":"csv","maxItems":10,"items":{"type":"string","minLength":1,"maxLength":50}},{"in":"query","name":"kind","type":"array","collectionFormat":"csv","maxItems":10,"items":{"type":"string","enum":["image","video","audio","document","file"]}},{"in":"query","name":"ext","type":"array","collectionFormat":"csv","maxItems":10,"items":{"type":"string","minLength":1,"maxLength":10}},{"in":"query","name":"permission","type":"string","enum":["public","readonly","private"],"description":"File access permission level. `public` files are accessible by anyone in the team, instead `private` files are only accessible by the file creator."},{"in":"query","name":"owner","type":"string","minLength":24,"maxLength":24,"pattern":"^[0-9A-Fa-f]{24}$","description":"File creator user/agent ID (24 characters hexadecimal). Cannot be used together with `ownerDistinct` param."},{"in":"query","name":"ownerDistinct","type":"string","minLength":24,"maxLength":24,"pattern":"^[0-9A-Fa-f]{24}$","description":"File creator distinct of the given user/agent ID (24 characters hexadecimal). Cannot be used together with `owner` param."},{"in":"query","name":"filesize","type":"array","collectionFormat":"csv","minItems":1,"maxItems":2,"description":"Minimum and maximum file size range in bytes. Example: 10000,1000000","items":{"type":"number","maximum":104857600,"minimum":1}}],"responses":{"200":{"description":"Files","schema":{"type":"array","items":{"$ref":"#/definitions/file"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get last created files\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/files?size=25&page=0&status=any' \\\n  --header 'Token: <api token goes here>'\n\n\n// Get last valid files that are images\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/files?size=20&status=valid&kind=image' \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get last created files\nhttp GET 'https://api.wassenger.com/v1/files?size=25&page=0&status=any' \\\n  Token:'<api token goes here>'\n\n\n// Get last valid files that are images\nhttp GET 'https://api.wassenger.com/v1/files?size=20&status=valid&kind=image' \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get last created files\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/files?size=25&page=0&status=any';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get last valid files that are images\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/files?size=20&status=valid&kind=image';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get last created files\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/files',\n  params: {size: '25', page: '0', status: 'any'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get last valid files that are images\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/files',\n  params: {size: '20', status: 'valid', kind: 'image'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get last created files\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/files');\n\nreq.query({\n  size: '25',\n  page: '0',\n  status: 'any'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get last valid files that are images\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/files');\n\nreq.query({\n  size: '20',\n  status: 'valid',\n  kind: 'image'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get last created files\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/files?size=25&page=0&status=any', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get last valid files that are images\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/files?size=20&status=valid&kind=image', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get last created files\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/files');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'size' => '25',\n  'page' => '0',\n  'status' => 'any'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get last valid files that are images\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/files');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'size' => '20',\n  'status' => 'valid',\n  'kind' => 'image'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get last created files\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/files?size=25&page=0&status=any\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get last valid files that are images\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/files?size=20&status=valid&kind=image\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get last created files\nimport requests\n\nurl = \"https://api.wassenger.com/v1/files\"\n\nquerystring = {\"size\":\"25\",\"page\":\"0\",\"status\":\"any\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Get last valid files that are images\nimport requests\n\nurl = \"https://api.wassenger.com/v1/files\"\n\nquerystring = {\"size\":\"20\",\"status\":\"valid\",\"kind\":\"image\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get last created files\nconst url = 'https://api.wassenger.com/v1/files?size=25&page=0&status=any';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get last valid files that are images\nconst url = 'https://api.wassenger.com/v1/files?size=20&status=valid&kind=image';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get last created files\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/files?size=25&page=0&status=any',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get last valid files that are images\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/files?size=20&status=valid&kind=image',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get last created files\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/files?size=25&page=0&status=any\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get last valid files that are images\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/files?size=20&status=valid&kind=image\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get last created files\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/files?size=25&page=0&status=any\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get last valid files that are images\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/files?size=20&status=valid&kind=image\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get last created files\nvar client = new RestClient(\"https://api.wassenger.com/v1/files?size=25&page=0&status=any\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Get last valid files that are images\nvar client = new RestClient(\"https://api.wassenger.com/v1/files?size=20&status=valid&kind=image\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get last created files\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/files?size=25&page=0&status=any\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get last valid files that are images\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/files?size=20&status=valid&kind=image\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get last created files\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/files?size=25&page=0&status=any\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Get last valid files that are images\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/files?size=20&status=valid&kind=image\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get last created files\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/files?size=25&page=0&status=any\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get last valid files that are images\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/files?size=20&status=valid&kind=image\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get last created files\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/files?size=25&page=0&status=any\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get last valid files that are images\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/files?size=20&status=valid&kind=image\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get last created files\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/files?size=25&page=0&status=any' -Method GET -Headers $headers\n\n\n# Get last valid files that are images\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/files?size=20&status=valid&kind=image' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get last created files\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/files?size=25&page=0&status=any\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get last valid files that are images\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/files?size=20&status=valid&kind=image\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get last created files\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/files?size=25&page=0&status=any\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get last valid files that are images\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/files?size=20&status=valid&kind=image\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"post":{"summary":"Upload file","description":"Upload one or multiple files to be stored in the cloud and to be delivered one or multiple times as media messages.\n\n\n\nIn order to send media messages, including images, audios, videos, gifs or documents, the media file content should be uploaded first to the platform.\n\n\n\nThis provides several advandges over uploading the file on message request, such as faster media message delivery, faster API response times, reduce redundant processes by simply uploading the file once, better file validation and normalization at upload time instead of delivery time.\n\n\n\n**Supported file upload methods**:\n\n\n\n- Remote URL using JSON with an `url` field with the publicly accessible file to download.\n\n\n\n- Form data (`multipart/form-data`) using the `file` field.\n\n\n\n- Raw binary data by uploading the file contents as data stream with the proper file MIME type as `Content-Type` header.\n\n\n\nFor more details, please check the additional file upload metadata and code examples for the different use cases.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Ffiles&method=POST&params=%5B%7B%22key%22%3A%22reference%22%2C%22value%22%3A%22optional-reference-id%22%7D%5D&body=%7B%0A%20%20%22url%22%3A%20%22https%3A%2F%2Fpicsum.photos%2Fseed%2Fpicsum%2F500%2F500%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"uploadFile","tags":["Files"],"produces":["application/json"],"consumes":["multipart/form-data","application/json","image/*","video/*","audio/*","application/*"],"security":[{"apiKey":[]}],"parameters":[{"in":"query","name":"reference","description":"Optional file reference identifier metadata. Useful for searching and filtering files.","type":"string","minLength":2,"maxLength":100},{"in":"query","name":"format","description":"File native presentation format. Defaults to native file format inferred based on its MIME type.","type":"string","enum":["gif","ptt","native"]},{"in":"query","name":"filename","description":"Optional file name to identify the file. Default to upload inferred file name.","type":"string","minLength":1,"maxLength":200},{"in":"query","name":"expiration","description":"Optional file expiration time-to-live. Default to 120 days.","type":"string","enum":["10m","30m","1h","6h","12h","1d","2d","3d","5d","6d","7d","15d","30d","60d","90d","120d","180d","360d","1y","2y"]},{"in":"query","name":"permission","type":"string","description":"Optional file access permission. Defaults to `public`: all team members can access, download and send the file. `private` returns files created by the current user.","enum":["public","readonly","private"]},{"in":"query","name":"tags","type":"array","description":"Optional file tags comma-separated.","collectionFormat":"csv","maxItems":10,"items":{"type":"string","minLength":1,"maxLength":50}},{"in":"body","name":"url","description":"Optional remote URL to download file from. URL should be reachable from Internet.","schema":{"type":"object","properties":{"url":{"type":"string","minLength":6,"maxLength":1024,"description":"Public URL from which to download file contents. URL must be Internet reachable and return a valid MIME type file binary content, such as images, videos, documents or audios."},"format":{"type":"string","description":"Optional file native presentation format. Defaults to native file format inferred based on its MIME type. Use `gif` if you want to send a MP4 video as Gif. Use `ptt` if you want to send an audio messages (MP3/OGG) as Push To Talk voice recording audio notes.","enum":["gif","ptt","native"]},"filename":{"type":"string","description":"Optional file name to identify the file. Default to upload inferred file name.","minLength":1,"maxLength":200},"expiration":{"type":"string","description":"Optional file expiration time-to-live. Default to 120 days.","enum":["10m","30m","1h","6h","12h","1d","2d","3d","5d","6d","7d","15d","30d","60d","90d","120d","180d","360d","1y","2y"]},"permission":{"type":"string","description":"Optional file access permission. Defaults to `public`: all team members can access, download and send the file","enum":["public","readonly","private"]},"reference":{"type":"string","description":"Optional file reference identifier metadata. Useful for searching and filtering files.","minLength":2,"maxLength":100},"tags":{"type":"array","description":"Optional file tags comma-separated.","maxItems":10,"items":{"type":"string","minLength":1,"maxLength":50}}}}}],"responses":{"201":{"description":"File(s) created and uploaded","schema":{"$ref":"#/definitions/file"}},"400":{"description":"Bad request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"File already exists","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Server error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service unavailable","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Upload image file from remote URL with custom file reference ID\ncurl --request POST \\\n  --url 'https://api.wassenger.com/v1/files?reference=optional-reference-id' \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"url\":\"https://picsum.photos/seed/picsum/500/500\"}'\n\n\n// Upload image from disk with custom reference ID\ncurl --request POST \\\n  --url 'https://api.wassenger.com/v1/files?reference=optional-reference-id' \\\n  --header 'Content-Type: multipart/form-data' \\\n  --header 'Token: <api token goes here>' \\\n  --form file=@/path/to/image.jpg\n\n\n// Upload a MP4 video\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/files \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"url\":\"https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4\",\"format\":\"native\"}'\n\n\n// Upload a MP4 video to be displayed as GIF\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/files \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"url\":\"https://i.giphy.com/media/feqkVgjJpYtjy/200.mp4\",\"format\":\"gif\"}'\n\n\n// Upload an audio as voice recorded Push To Talk (PTT) WhatsApp audio message format\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/files \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"url\":\"https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg\",\"format\":\"ptt\"}'\n\n\n// Upload an audio file to be sent as non-voice recorded audio format\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/files \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"url\":\"https://upload.wikimedia.org/wikipedia/commons/7/79/Example_of_flats_in_music.ogg\",\"format\":\"native\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Upload image file from remote URL with custom file reference ID\necho '{\"url\":\"https://picsum.photos/seed/picsum/500/500\"}' |  \\\n  http POST 'https://api.wassenger.com/v1/files?reference=optional-reference-id' \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Upload image from disk with custom reference ID\necho '-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"image.jpg\"\r\nContent-Type: image/jpeg\r\n\r\n\r\n-----011000010111000001101001--\r\n' |  \\\n  http POST 'https://api.wassenger.com/v1/files?reference=optional-reference-id' \\\n  Content-Type:multipart/form-data \\\n  Token:'<api token goes here>'\n\n\n// Upload a MP4 video\necho '{\"url\":\"https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4\",\"format\":\"native\"}' |  \\\n  http POST https://api.wassenger.com/v1/files \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Upload a MP4 video to be displayed as GIF\necho '{\"url\":\"https://i.giphy.com/media/feqkVgjJpYtjy/200.mp4\",\"format\":\"gif\"}' |  \\\n  http POST https://api.wassenger.com/v1/files \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Upload an audio as voice recorded Push To Talk (PTT) WhatsApp audio message format\necho '{\"url\":\"https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg\",\"format\":\"ptt\"}' |  \\\n  http POST https://api.wassenger.com/v1/files \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Upload an audio file to be sent as non-voice recorded audio format\necho '{\"url\":\"https://upload.wikimedia.org/wikipedia/commons/7/79/Example_of_flats_in_music.ogg\",\"format\":\"native\"}' |  \\\n  http POST https://api.wassenger.com/v1/files \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Upload image file from remote URL with custom file reference ID\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/files?reference=optional-reference-id';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"url\":\"https://picsum.photos/seed/picsum/500/500\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Upload image from disk with custom reference ID\nconst fs = require('fs');\nconst FormData = require('form-data');\nconst fetch = require('node-fetch');\n\nconst formData = new FormData();\nformData.append('file', fs.createReadStream('/path/to/image.jpg'));\n\nconst url = 'https://api.wassenger.com/v1/files?reference=optional-reference-id';\nconst options = {method: 'POST', headers: {Token: '<api token goes here>'}};\noptions.body = formData;\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Upload a MP4 video\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/files';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"url\":\"https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4\",\"format\":\"native\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Upload a MP4 video to be displayed as GIF\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/files';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"url\":\"https://i.giphy.com/media/feqkVgjJpYtjy/200.mp4\",\"format\":\"gif\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Upload an audio as voice recorded Push To Talk (PTT) WhatsApp audio message format\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/files';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"url\":\"https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg\",\"format\":\"ptt\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Upload an audio file to be sent as non-voice recorded audio format\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/files';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"url\":\"https://upload.wikimedia.org/wikipedia/commons/7/79/Example_of_flats_in_music.ogg\",\"format\":\"native\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Upload image file from remote URL with custom file reference ID\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/files',\n  params: {reference: 'optional-reference-id'},\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {url: 'https://picsum.photos/seed/picsum/500/500'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Upload image from disk with custom reference ID\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/files',\n  params: {reference: 'optional-reference-id'},\n  headers: {'Content-Type': 'multipart/form-data', Token: '<api token goes here>'},\n  data: '-----011000010111000001101001\\r\\nContent-Disposition: form-data; name=\"file\"; filename=\"image.jpg\"\\r\\nContent-Type: image/jpeg\\r\\n\\r\\n\\r\\n-----011000010111000001101001--\\r\\n'\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Upload a MP4 video\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/files',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    url: 'https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4',\n    format: 'native'\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Upload a MP4 video to be displayed as GIF\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/files',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {url: 'https://i.giphy.com/media/feqkVgjJpYtjy/200.mp4', format: 'gif'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Upload an audio as voice recorded Push To Talk (PTT) WhatsApp audio message format\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/files',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    url: 'https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg',\n    format: 'ptt'\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Upload an audio file to be sent as non-voice recorded audio format\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/files',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    url: 'https://upload.wikimedia.org/wikipedia/commons/7/79/Example_of_flats_in_music.ogg',\n    format: 'native'\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Upload image file from remote URL with custom file reference ID\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/files');\n\nreq.query({\n  reference: 'optional-reference-id'\n});\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  url: 'https://picsum.photos/seed/picsum/500/500'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Upload image from disk with custom reference ID\nconst fs = require('fs');\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/files');\n\nreq.query({\n  reference: 'optional-reference-id'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.multipart([\n  {\n    body: fs.createReadStream('/path/to/image.jpg')\n  }\n]);\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Upload a MP4 video\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/files');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  url: 'https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4',\n  format: 'native'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Upload a MP4 video to be displayed as GIF\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/files');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  url: 'https://i.giphy.com/media/feqkVgjJpYtjy/200.mp4',\n  format: 'gif'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Upload an audio as voice recorded Push To Talk (PTT) WhatsApp audio message format\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/files');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  url: 'https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg',\n  format: 'ptt'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Upload an audio file to be sent as non-voice recorded audio format\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/files');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  url: 'https://upload.wikimedia.org/wikipedia/commons/7/79/Example_of_flats_in_music.ogg',\n  format: 'native'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Upload image file from remote URL with custom file reference ID\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/files?reference=optional-reference-id', [\n  'body' => '{\"url\":\"https://picsum.photos/seed/picsum/500/500\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Upload image from disk with custom reference ID\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/files?reference=optional-reference-id', [\n  'multipart' => [\n    [\n        'name' => 'file',\n        'filename' => '/path/to/image.jpg',\n        'contents' => null\n    ]\n  ]\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Upload a MP4 video\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/files', [\n  'body' => '{\"url\":\"https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4\",\"format\":\"native\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Upload a MP4 video to be displayed as GIF\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/files', [\n  'body' => '{\"url\":\"https://i.giphy.com/media/feqkVgjJpYtjy/200.mp4\",\"format\":\"gif\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Upload an audio as voice recorded Push To Talk (PTT) WhatsApp audio message format\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/files', [\n  'body' => '{\"url\":\"https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg\",\"format\":\"ptt\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Upload an audio file to be sent as non-voice recorded audio format\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/files', [\n  'body' => '{\"url\":\"https://upload.wikimedia.org/wikipedia/commons/7/79/Example_of_flats_in_music.ogg\",\"format\":\"native\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Upload image file from remote URL with custom file reference ID\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'url' => 'https://picsum.photos/seed/picsum/500/500'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/files');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setQuery(new http\\QueryString([\n  'reference' => 'optional-reference-id'\n]));\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Upload image from disk with custom reference ID\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->addForm(null, [\n  [\n    'name' => 'file',\n    'type' => null,\n    'file' => '/path/to/image.jpg',\n    'data' => null\n  ]\n]);\n\n$request->setRequestUrl('https://api.wassenger.com/v1/files');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setQuery(new http\\QueryString([\n  'reference' => 'optional-reference-id'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Upload a MP4 video\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'url' => 'https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4',\n  'format' => 'native'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/files');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Upload a MP4 video to be displayed as GIF\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'url' => 'https://i.giphy.com/media/feqkVgjJpYtjy/200.mp4',\n  'format' => 'gif'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/files');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Upload an audio as voice recorded Push To Talk (PTT) WhatsApp audio message format\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'url' => 'https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg',\n  'format' => 'ptt'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/files');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Upload an audio file to be sent as non-voice recorded audio format\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'url' => 'https://upload.wikimedia.org/wikipedia/commons/7/79/Example_of_flats_in_music.ogg',\n  'format' => 'native'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/files');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Upload image file from remote URL with custom file reference ID\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/files?reference=optional-reference-id\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'url' => 'https://picsum.photos/seed/picsum/500/500'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Upload image from disk with custom reference ID\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/files?reference=optional-reference-id\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => \"-----011000010111000001101001\\r\\nContent-Disposition: form-data; name=\\\"file\\\"; filename=\\\"image.jpg\\\"\\r\\nContent-Type: image/jpeg\\r\\n\\r\\n\\r\\n-----011000010111000001101001--\\r\\n\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Upload a MP4 video\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/files\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'url' => 'https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4',\n    'format' => 'native'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Upload a MP4 video to be displayed as GIF\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/files\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'url' => 'https://i.giphy.com/media/feqkVgjJpYtjy/200.mp4',\n    'format' => 'gif'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Upload an audio as voice recorded Push To Talk (PTT) WhatsApp audio message format\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/files\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'url' => 'https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg',\n    'format' => 'ptt'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Upload an audio file to be sent as non-voice recorded audio format\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/files\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'url' => 'https://upload.wikimedia.org/wikipedia/commons/7/79/Example_of_flats_in_music.ogg',\n    'format' => 'native'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Upload image file from remote URL with custom file reference ID\nimport requests\n\nurl = \"https://api.wassenger.com/v1/files\"\n\nquerystring = {\"reference\":\"optional-reference-id\"}\n\npayload = { \"url\": \"https://picsum.photos/seed/picsum/500/500\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Upload image from disk with custom reference ID\nimport requests\n\nurl = \"https://api.wassenger.com/v1/files\"\n\nquerystring = {\"reference\":\"optional-reference-id\"}\n\nfiles = { \"file\": \"open('/path/to/image.jpg', 'rb')\" }\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.post(url, files=files, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Upload a MP4 video\nimport requests\n\nurl = \"https://api.wassenger.com/v1/files\"\n\npayload = {\n    \"url\": \"https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4\",\n    \"format\": \"native\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Upload a MP4 video to be displayed as GIF\nimport requests\n\nurl = \"https://api.wassenger.com/v1/files\"\n\npayload = {\n    \"url\": \"https://i.giphy.com/media/feqkVgjJpYtjy/200.mp4\",\n    \"format\": \"gif\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Upload an audio as voice recorded Push To Talk (PTT) WhatsApp audio message format\nimport requests\n\nurl = \"https://api.wassenger.com/v1/files\"\n\npayload = {\n    \"url\": \"https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg\",\n    \"format\": \"ptt\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Upload an audio file to be sent as non-voice recorded audio format\nimport requests\n\nurl = \"https://api.wassenger.com/v1/files\"\n\npayload = {\n    \"url\": \"https://upload.wikimedia.org/wikipedia/commons/7/79/Example_of_flats_in_music.ogg\",\n    \"format\": \"native\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Upload image file from remote URL with custom file reference ID\nconst url = 'https://api.wassenger.com/v1/files?reference=optional-reference-id';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"url\":\"https://picsum.photos/seed/picsum/500/500\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Upload image from disk with custom reference ID\nconst url = 'https://api.wassenger.com/v1/files?reference=optional-reference-id';\nconst form = new FormData();\nform.append('file', '/path/to/image.jpg');\n\nconst options = {method: 'POST', headers: {Token: '<api token goes here>'}};\n\noptions.body = form;\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Upload a MP4 video\nconst url = 'https://api.wassenger.com/v1/files';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"url\":\"https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4\",\"format\":\"native\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Upload a MP4 video to be displayed as GIF\nconst url = 'https://api.wassenger.com/v1/files';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"url\":\"https://i.giphy.com/media/feqkVgjJpYtjy/200.mp4\",\"format\":\"gif\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Upload an audio as voice recorded Push To Talk (PTT) WhatsApp audio message format\nconst url = 'https://api.wassenger.com/v1/files';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"url\":\"https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg\",\"format\":\"ptt\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Upload an audio file to be sent as non-voice recorded audio format\nconst url = 'https://api.wassenger.com/v1/files';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"url\":\"https://upload.wikimedia.org/wikipedia/commons/7/79/Example_of_flats_in_music.ogg\",\"format\":\"native\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Upload image file from remote URL with custom file reference ID\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/files?reference=optional-reference-id',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"url\":\"https://picsum.photos/seed/picsum/500/500\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Upload image from disk with custom reference ID\nconst form = new FormData();\nform.append('file', '/path/to/image.jpg');\n\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/files?reference=optional-reference-id',\n  method: 'POST',\n  headers: {\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  contentType: false,\n  mimeType: 'multipart/form-data',\n  data: form\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Upload a MP4 video\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/files',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"url\":\"https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4\",\"format\":\"native\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Upload a MP4 video to be displayed as GIF\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/files',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"url\":\"https://i.giphy.com/media/feqkVgjJpYtjy/200.mp4\",\"format\":\"gif\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Upload an audio as voice recorded Push To Talk (PTT) WhatsApp audio message format\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/files',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"url\":\"https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg\",\"format\":\"ptt\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Upload an audio file to be sent as non-voice recorded audio format\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/files',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"url\":\"https://upload.wikimedia.org/wikipedia/commons/7/79/Example_of_flats_in_music.ogg\",\"format\":\"native\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Upload image file from remote URL with custom file reference ID\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/files?reference=optional-reference-id\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/500/500\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Upload image from disk with custom reference ID\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/files?reference=optional-reference-id\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"-----011000010111000001101001\\r\\nContent-Disposition: form-data; name=\\\"file\\\"; filename=\\\"image.jpg\\\"\\r\\nContent-Type: image/jpeg\\r\\n\\r\\n\\r\\n-----011000010111000001101001--\\r\\n\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Upload a MP4 video\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/files\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"url\\\":\\\"https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4\\\",\\\"format\\\":\\\"native\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Upload a MP4 video to be displayed as GIF\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/files\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"url\\\":\\\"https://i.giphy.com/media/feqkVgjJpYtjy/200.mp4\\\",\\\"format\\\":\\\"gif\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Upload an audio as voice recorded Push To Talk (PTT) WhatsApp audio message format\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/files\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"url\\\":\\\"https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg\\\",\\\"format\\\":\\\"ptt\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Upload an audio file to be sent as non-voice recorded audio format\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/files\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"url\\\":\\\"https://upload.wikimedia.org/wikipedia/commons/7/79/Example_of_flats_in_music.ogg\\\",\\\"format\\\":\\\"native\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Upload image file from remote URL with custom file reference ID\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/files?reference=optional-reference-id\"\n\n\tpayload := strings.NewReader(\"{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/500/500\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Upload image from disk with custom reference ID\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/files?reference=optional-reference-id\"\n\n\tpayload := strings.NewReader(\"-----011000010111000001101001\\r\\nContent-Disposition: form-data; name=\\\"file\\\"; filename=\\\"image.jpg\\\"\\r\\nContent-Type: image/jpeg\\r\\n\\r\\n\\r\\n-----011000010111000001101001--\\r\\n\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Upload a MP4 video\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/files\"\n\n\tpayload := strings.NewReader(\"{\\\"url\\\":\\\"https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4\\\",\\\"format\\\":\\\"native\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Upload a MP4 video to be displayed as GIF\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/files\"\n\n\tpayload := strings.NewReader(\"{\\\"url\\\":\\\"https://i.giphy.com/media/feqkVgjJpYtjy/200.mp4\\\",\\\"format\\\":\\\"gif\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Upload an audio as voice recorded Push To Talk (PTT) WhatsApp audio message format\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/files\"\n\n\tpayload := strings.NewReader(\"{\\\"url\\\":\\\"https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg\\\",\\\"format\\\":\\\"ptt\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Upload an audio file to be sent as non-voice recorded audio format\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/files\"\n\n\tpayload := strings.NewReader(\"{\\\"url\\\":\\\"https://upload.wikimedia.org/wikipedia/commons/7/79/Example_of_flats_in_music.ogg\\\",\\\"format\\\":\\\"native\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Upload image file from remote URL with custom file reference ID\nvar client = new RestClient(\"https://api.wassenger.com/v1/files?reference=optional-reference-id\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/500/500\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Upload image from disk with custom reference ID\nvar client = new RestClient(\"https://api.wassenger.com/v1/files?reference=optional-reference-id\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"undefined\", \"-----011000010111000001101001\\r\\nContent-Disposition: form-data; name=\\\"file\\\"; filename=\\\"image.jpg\\\"\\r\\nContent-Type: image/jpeg\\r\\n\\r\\n\\r\\n-----011000010111000001101001--\\r\\n\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Upload a MP4 video\nvar client = new RestClient(\"https://api.wassenger.com/v1/files\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"url\\\":\\\"https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4\\\",\\\"format\\\":\\\"native\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Upload a MP4 video to be displayed as GIF\nvar client = new RestClient(\"https://api.wassenger.com/v1/files\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"url\\\":\\\"https://i.giphy.com/media/feqkVgjJpYtjy/200.mp4\\\",\\\"format\\\":\\\"gif\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Upload an audio as voice recorded Push To Talk (PTT) WhatsApp audio message format\nvar client = new RestClient(\"https://api.wassenger.com/v1/files\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"url\\\":\\\"https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg\\\",\\\"format\\\":\\\"ptt\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Upload an audio file to be sent as non-voice recorded audio format\nvar client = new RestClient(\"https://api.wassenger.com/v1/files\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"url\\\":\\\"https://upload.wikimedia.org/wikipedia/commons/7/79/Example_of_flats_in_music.ogg\\\",\\\"format\\\":\\\"native\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Upload image file from remote URL with custom file reference ID\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/files?reference=optional-reference-id\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/500/500\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Upload image from disk with custom reference ID\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/files?reference=optional-reference-id\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new MultipartFormDataContent\n    {\n        new StringContent(\"\")\n        {\n            Headers =\n            {\n                ContentDisposition = new ContentDispositionHeaderValue(\"form-data\")\n                {\n                    Name = \"file\",\n                    FileName = \"/path/to/image.jpg\",\n                }\n            }\n        },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Upload a MP4 video\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/files\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"url\\\":\\\"https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4\\\",\\\"format\\\":\\\"native\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Upload a MP4 video to be displayed as GIF\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/files\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"url\\\":\\\"https://i.giphy.com/media/feqkVgjJpYtjy/200.mp4\\\",\\\"format\\\":\\\"gif\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Upload an audio as voice recorded Push To Talk (PTT) WhatsApp audio message format\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/files\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"url\\\":\\\"https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg\\\",\\\"format\\\":\\\"ptt\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Upload an audio file to be sent as non-voice recorded audio format\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/files\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"url\\\":\\\"https://upload.wikimedia.org/wikipedia/commons/7/79/Example_of_flats_in_music.ogg\\\",\\\"format\\\":\\\"native\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Upload image file from remote URL with custom file reference ID\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/files?reference=optional-reference-id\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/500/500\\\"}\")\n  .asString();\n\n\n// Upload image from disk with custom reference ID\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/files?reference=optional-reference-id\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"-----011000010111000001101001\\r\\nContent-Disposition: form-data; name=\\\"file\\\"; filename=\\\"image.jpg\\\"\\r\\nContent-Type: image/jpeg\\r\\n\\r\\n\\r\\n-----011000010111000001101001--\\r\\n\")\n  .asString();\n\n\n// Upload a MP4 video\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/files\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"url\\\":\\\"https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4\\\",\\\"format\\\":\\\"native\\\"}\")\n  .asString();\n\n\n// Upload a MP4 video to be displayed as GIF\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/files\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"url\\\":\\\"https://i.giphy.com/media/feqkVgjJpYtjy/200.mp4\\\",\\\"format\\\":\\\"gif\\\"}\")\n  .asString();\n\n\n// Upload an audio as voice recorded Push To Talk (PTT) WhatsApp audio message format\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/files\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"url\\\":\\\"https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg\\\",\\\"format\\\":\\\"ptt\\\"}\")\n  .asString();\n\n\n// Upload an audio file to be sent as non-voice recorded audio format\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/files\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"url\\\":\\\"https://upload.wikimedia.org/wikipedia/commons/7/79/Example_of_flats_in_music.ogg\\\",\\\"format\\\":\\\"native\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Upload image file from remote URL with custom file reference ID\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/500/500\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/files?reference=optional-reference-id\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Upload image from disk with custom reference ID\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"multipart/form-data; boundary=---011000010111000001101001\")\nval body = RequestBody.create(mediaType, \"-----011000010111000001101001\\r\\nContent-Disposition: form-data; name=\\\"file\\\"; filename=\\\"image.jpg\\\"\\r\\nContent-Type: image/jpeg\\r\\n\\r\\n\\r\\n-----011000010111000001101001--\\r\\n\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/files?reference=optional-reference-id\")\n  .post(body)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Upload a MP4 video\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"url\\\":\\\"https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4\\\",\\\"format\\\":\\\"native\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/files\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Upload a MP4 video to be displayed as GIF\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"url\\\":\\\"https://i.giphy.com/media/feqkVgjJpYtjy/200.mp4\\\",\\\"format\\\":\\\"gif\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/files\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Upload an audio as voice recorded Push To Talk (PTT) WhatsApp audio message format\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"url\\\":\\\"https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg\\\",\\\"format\\\":\\\"ptt\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/files\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Upload an audio file to be sent as non-voice recorded audio format\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"url\\\":\\\"https://upload.wikimedia.org/wikipedia/commons/7/79/Example_of_flats_in_music.ogg\\\",\\\"format\\\":\\\"native\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/files\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Upload image file from remote URL with custom file reference ID\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/files?reference=optional-reference-id\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/500/500\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Upload image from disk with custom reference ID\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/files?reference=optional-reference-id\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"-----011000010111000001101001\\r\\nContent-Disposition: form-data; name=\\\"file\\\"; filename=\\\"image.jpg\\\"\\r\\nContent-Type: image/jpeg\\r\\n\\r\\n\\r\\n-----011000010111000001101001--\\r\\n\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Upload a MP4 video\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/files\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"url\\\":\\\"https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4\\\",\\\"format\\\":\\\"native\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Upload a MP4 video to be displayed as GIF\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/files\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"url\\\":\\\"https://i.giphy.com/media/feqkVgjJpYtjy/200.mp4\\\",\\\"format\\\":\\\"gif\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Upload an audio as voice recorded Push To Talk (PTT) WhatsApp audio message format\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/files\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"url\\\":\\\"https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg\\\",\\\"format\\\":\\\"ptt\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Upload an audio file to be sent as non-voice recorded audio format\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/files\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"url\\\":\\\"https://upload.wikimedia.org/wikipedia/commons/7/79/Example_of_flats_in_music.ogg\\\",\\\"format\\\":\\\"native\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Upload image file from remote URL with custom file reference ID\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/files?reference=optional-reference-id' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"url\":\"https://picsum.photos/seed/picsum/500/500\"}'\n\n\n# Upload image from disk with custom reference ID\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/files?reference=optional-reference-id' -Method POST -Headers $headers -ContentType 'multipart/form-data' -Body '-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"image.jpg\"\r\nContent-Type: image/jpeg\r\n\r\n\r\n-----011000010111000001101001--\r\n'\n\n\n# Upload a MP4 video\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/files' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"url\":\"https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4\",\"format\":\"native\"}'\n\n\n# Upload a MP4 video to be displayed as GIF\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/files' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"url\":\"https://i.giphy.com/media/feqkVgjJpYtjy/200.mp4\",\"format\":\"gif\"}'\n\n\n# Upload an audio as voice recorded Push To Talk (PTT) WhatsApp audio message format\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/files' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"url\":\"https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg\",\"format\":\"ptt\"}'\n\n\n# Upload an audio file to be sent as non-voice recorded audio format\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/files' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"url\":\"https://upload.wikimedia.org/wikipedia/commons/7/79/Example_of_flats_in_music.ogg\",\"format\":\"native\"}'"},{"lang":"ObjC","source":"// Upload image file from remote URL with custom file reference ID\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"url\": @\"https://picsum.photos/seed/picsum/500/500\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/files?reference=optional-reference-id\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Upload image from disk with custom reference ID\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\nNSArray *parameters = @[ @{ @\"name\": @\"file\", @\"fileName\": @\"/path/to/image.jpg\" } ];\nNSString *boundary = @\"---011000010111000001101001\";\n\nNSError *error;\nNSMutableString *body = [NSMutableString string];\nfor (NSDictionary *param in parameters) {\n    [body appendFormat:@\"--%@\\r\\n\", boundary];\n    if (param[@\"fileName\"]) {\n        [body appendFormat:@\"Content-Disposition:form-data; name=\\\"%@\\\"; filename=\\\"%@\\\"\\r\\n\", param[@\"name\"], param[@\"fileName\"]];\n        [body appendFormat:@\"Content-Type: %@\\r\\n\\r\\n\", param[@\"contentType\"]];\n        [body appendFormat:@\"%@\", [NSString stringWithContentsOfFile:param[@\"fileName\"] encoding:NSUTF8StringEncoding error:&error]];\n        if (error) {\n            NSLog(@\"%@\", error);\n        }\n    } else {\n        [body appendFormat:@\"Content-Disposition:form-data; name=\\\"%@\\\"\\r\\n\\r\\n\", param[@\"name\"]];\n        [body appendFormat:@\"%@\", param[@\"value\"]];\n    }\n}\n[body appendFormat:@\"\\r\\n--%@--\\r\\n\", boundary];\nNSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/files?reference=optional-reference-id\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Upload a MP4 video\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"url\": @\"https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4\",\n                              @\"format\": @\"native\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/files\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Upload a MP4 video to be displayed as GIF\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"url\": @\"https://i.giphy.com/media/feqkVgjJpYtjy/200.mp4\",\n                              @\"format\": @\"gif\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/files\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Upload an audio as voice recorded Push To Talk (PTT) WhatsApp audio message format\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"url\": @\"https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg\",\n                              @\"format\": @\"ptt\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/files\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Upload an audio file to be sent as non-voice recorded audio format\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"url\": @\"https://upload.wikimedia.org/wikipedia/commons/7/79/Example_of_flats_in_music.ogg\",\n                              @\"format\": @\"native\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/files\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Upload image file from remote URL with custom file reference ID\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"url\": \"https://picsum.photos/seed/picsum/500/500\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/files?reference=optional-reference-id\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Upload image from disk with custom reference ID\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\nlet parameters = [\n  [\n    \"name\": \"file\",\n    \"fileName\": \"/path/to/image.jpg\"\n  ]\n]\n\nlet boundary = \"---011000010111000001101001\"\n\nvar body = \"\"\nvar error: NSError? = nil\nfor param in parameters {\n  let paramName = param[\"name\"]!\n  body += \"--\\(boundary)\\r\\n\"\n  body += \"Content-Disposition:form-data; name=\\\"\\(paramName)\\\"\"\n  if let filename = param[\"fileName\"] {\n    let contentType = param[\"content-type\"]!\n    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)\n    if (error != nil) {\n      print(error as Any)\n    }\n    body += \"; filename=\\\"\\(filename)\\\"\\r\\n\"\n    body += \"Content-Type: \\(contentType)\\r\\n\\r\\n\"\n    body += fileContent\n  } else if let paramValue = param[\"value\"] {\n    body += \"\\r\\n\\r\\n\\(paramValue)\"\n  }\n}\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/files?reference=optional-reference-id\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Upload a MP4 video\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"url\": \"https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4\",\n  \"format\": \"native\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/files\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Upload a MP4 video to be displayed as GIF\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"url\": \"https://i.giphy.com/media/feqkVgjJpYtjy/200.mp4\",\n  \"format\": \"gif\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/files\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Upload an audio as voice recorded Push To Talk (PTT) WhatsApp audio message format\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"url\": \"https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg\",\n  \"format\": \"ptt\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/files\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Upload an audio file to be sent as non-voice recorded audio format\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"url\": \"https://upload.wikimedia.org/wikipedia/commons/7/79/Example_of_flats_in_music.ogg\",\n  \"format\": \"native\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/files\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Delete many files","description":"Deletes multiple files at once, up to 100 files per API request, optionally using different filters, \n\nsuch as upload date, file type, file extension, file size, file name, or files IDs.\n\n\n\n\n\n**Important**: use this endpoint carefully, once deleted, a file cannot be recovered.\n\nYou might be interested deleting individual files by ID using [this endpoint](#tag/Files/operation/deleteFile).\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Ffiles&method=DELETE&body=%7B%0A%20%20%22limit%22%3A%20100%2C%0A%20%20%22kind%22%3A%20%22image%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deleteFiles","security":[{"apiKey":[]}],"tags":["Files"],"produces":["application/json","application/x-www-form-urlencoded"],"consumes":["application/json"],"parameters":[{"in":"body","name":"filters","description":"Delete fiels body params","schema":{"type":"object","properties":{"limit":{"type":"integer","minimum":1,"maximum":500,"description":"Maximum limit of files to delete per API request. Defaults to `100`.","default":100},"ids":{"type":"array","items":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24},"minItems":1,"maxItems":100,"description":"Delete files that matches the given list of file IDs comma-separated (24 hexadecimal characters length)"},"before":{"type":"string","format":"date-time","description":"Delete files uploaded before the given date in ISO 8601 format. E.g: 2022-06-01T15:30:00.000Z"},"after":{"type":"string","format":"date-time","description":"Delete files uploaded after the given date in ISO 8601 format. E.g: 2022-06-01T15:30:00.000Z"},"expires":{"type":"string","format":"date-time","description":"Delete files that **expires before** the given date in ISO 8601 format. E.g: 2022-06-01T15:30:00.000Z"},"filename":{"type":"string","minLength":3,"maxLength":100,"description":"Delete files that matches the given filename, based partial word or full text match. **Note**: use carefully when passing a short generic string"},"ext":{"type":"array","items":{"type":"string","minLength":2,"maxLength":20,"description":"Delete files that has one of the given list of file extensions (e.g: jpg, png, mp4, mp3)"},"maxItems":10,"minItems":1},"mime":{"type":"array","items":{"type":"string","minLength":3,"maxLength":50,"description":"Delete files that has one of the given list of file MIME type (e.g: image/jpeg, image/png, video/mp4, audio/mp3)"},"maxItems":10,"minItems":1},"kind":{"type":"array","items":{"type":"string","maxLength":10,"enum":["image","video","audio","document","file"]},"minItems":1,"maxItems":5,"description":"Delete files that matches one of the given file types"},"owner":{"type":"array","items":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Delete files only uploaded by the given user/agents IDs in your team (only available to account administrators)"},"minItems":1,"maxItems":30},"format":{"type":"string","enum":["gif","ptt","native"],"description":"Delete files by file format","default":"native"},"permission":{"type":"string","enum":["public","readonly","private"],"description":"Delete files per permission mode (only available to account administrators)"},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":50},"minItems":1,"maxItems":10,"description":"Delete files that matches one of the given tags"},"size":{"type":"integer","minimum":1,"maximum":50000000,"description":"Delete files bigger than given size in bytes (1MB = `1000000` bytes)"},"origin":{"type":"string","enum":["remote","upload"],"description":"Delete files that were uploaded from a local file (`upload`) or from remote URL (`remote`)"},"sha2":{"type":"array","items":{"type":"string","pattern":"^[a-fA-F0-9]+$","minLength":64,"maxLength":64},"minItems":1,"maxItems":30,"description":"Delete files that matches the given list of file SHA-2 hashes (64 hexadecimal characters length)"}},"additionalProperties":false}}],"responses":{"200":{"description":"Return a list of deleted files. Files in use by a quick reply, campaign or deal note are not deleted and not listed. The list will be empty if no file deleted.","schema":{"type":"array","items":{"$ref":"#/definitions/file"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Every matched file is in use by a quick reply, campaign or deal note, so none was deleted","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Delete up to 100 image files\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/files \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"limit\":100,\"kind\":\"image\"}'\n\n\n// Delete up 100 files uplodaed in the 30 days month\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/files \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"after\":\"2026-10-07T09:42:45.868Z\",\"before\":\"2026-11-06T09:42:45.868Z\"}'\n\n\n// Delete up to 30 files with custom MIME file\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/files \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"limit\":30,\"mime\":\"video/mp4\"}'\n\n\n// Delete files with the specified IDs\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/files \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"ids\":\"5f734dea0d77567691ff7109,5f734de50d77567691ff7103,5f734def0d77567691ff7101\"}'\n\n\n// Delete files with the specified tags\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/files \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"tags\":\"foo,bar,baz\"}'\n\n\n// Delete files with a custom permission value (only applicable for the account administrator)\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/files \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"permission\":\"public\"}'\n\n\n// Delete files uploaded by one or multiple agents (only applicable for the account administrator)\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/files \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"owner\":\"11134def0d77567691ff7102,1f734def0d77567691ff7101\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Delete up to 100 image files\necho '{\"limit\":100,\"kind\":\"image\"}' |  \\\n  http DELETE https://api.wassenger.com/v1/files \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Delete up 100 files uplodaed in the 30 days month\necho '{\"after\":\"2026-10-07T09:42:45.868Z\",\"before\":\"2026-11-06T09:42:45.868Z\"}' |  \\\n  http DELETE https://api.wassenger.com/v1/files \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Delete up to 30 files with custom MIME file\necho '{\"limit\":30,\"mime\":\"video/mp4\"}' |  \\\n  http DELETE https://api.wassenger.com/v1/files \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Delete files with the specified IDs\necho '{\"ids\":\"5f734dea0d77567691ff7109,5f734de50d77567691ff7103,5f734def0d77567691ff7101\"}' |  \\\n  http DELETE https://api.wassenger.com/v1/files \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Delete files with the specified tags\necho '{\"tags\":\"foo,bar,baz\"}' |  \\\n  http DELETE https://api.wassenger.com/v1/files \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Delete files with a custom permission value (only applicable for the account administrator)\necho '{\"permission\":\"public\"}' |  \\\n  http DELETE https://api.wassenger.com/v1/files \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Delete files uploaded by one or multiple agents (only applicable for the account administrator)\necho '{\"owner\":\"11134def0d77567691ff7102,1f734def0d77567691ff7101\"}' |  \\\n  http DELETE https://api.wassenger.com/v1/files \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Delete up to 100 image files\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/files';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"limit\":100,\"kind\":\"image\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete up 100 files uplodaed in the 30 days month\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/files';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"after\":\"2026-10-07T09:42:45.868Z\",\"before\":\"2026-11-06T09:42:45.868Z\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete up to 30 files with custom MIME file\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/files';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"limit\":30,\"mime\":\"video/mp4\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete files with the specified IDs\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/files';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"ids\":\"5f734dea0d77567691ff7109,5f734de50d77567691ff7103,5f734def0d77567691ff7101\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete files with the specified tags\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/files';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"tags\":\"foo,bar,baz\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete files with a custom permission value (only applicable for the account administrator)\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/files';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"permission\":\"public\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete files uploaded by one or multiple agents (only applicable for the account administrator)\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/files';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"owner\":\"11134def0d77567691ff7102,1f734def0d77567691ff7101\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Delete up to 100 image files\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/files',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {limit: 100, kind: 'image'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete up 100 files uplodaed in the 30 days month\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/files',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {after: '2026-10-07T09:42:45.868Z', before: '2026-11-06T09:42:45.868Z'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete up to 30 files with custom MIME file\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/files',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {limit: 30, mime: 'video/mp4'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete files with the specified IDs\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/files',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    ids: '5f734dea0d77567691ff7109,5f734de50d77567691ff7103,5f734def0d77567691ff7101'\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete files with the specified tags\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/files',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {tags: 'foo,bar,baz'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete files with a custom permission value (only applicable for the account administrator)\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/files',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {permission: 'public'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete files uploaded by one or multiple agents (only applicable for the account administrator)\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/files',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {owner: '11134def0d77567691ff7102,1f734def0d77567691ff7101'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Delete up to 100 image files\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/files');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  limit: 100,\n  kind: 'image'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Delete up 100 files uplodaed in the 30 days month\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/files');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  after: '2026-10-07T09:42:45.868Z',\n  before: '2026-11-06T09:42:45.868Z'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Delete up to 30 files with custom MIME file\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/files');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  limit: 30,\n  mime: 'video/mp4'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Delete files with the specified IDs\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/files');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  ids: '5f734dea0d77567691ff7109,5f734de50d77567691ff7103,5f734def0d77567691ff7101'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Delete files with the specified tags\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/files');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  tags: 'foo,bar,baz'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Delete files with a custom permission value (only applicable for the account administrator)\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/files');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  permission: 'public'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Delete files uploaded by one or multiple agents (only applicable for the account administrator)\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/files');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  owner: '11134def0d77567691ff7102,1f734def0d77567691ff7101'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Delete up to 100 image files\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/files', [\n  'body' => '{\"limit\":100,\"kind\":\"image\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Delete up 100 files uplodaed in the 30 days month\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/files', [\n  'body' => '{\"after\":\"2026-10-07T09:42:45.868Z\",\"before\":\"2026-11-06T09:42:45.868Z\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Delete up to 30 files with custom MIME file\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/files', [\n  'body' => '{\"limit\":30,\"mime\":\"video/mp4\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Delete files with the specified IDs\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/files', [\n  'body' => '{\"ids\":\"5f734dea0d77567691ff7109,5f734de50d77567691ff7103,5f734def0d77567691ff7101\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Delete files with the specified tags\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/files', [\n  'body' => '{\"tags\":\"foo,bar,baz\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Delete files with a custom permission value (only applicable for the account administrator)\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/files', [\n  'body' => '{\"permission\":\"public\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Delete files uploaded by one or multiple agents (only applicable for the account administrator)\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/files', [\n  'body' => '{\"owner\":\"11134def0d77567691ff7102,1f734def0d77567691ff7101\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Delete up to 100 image files\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'limit' => 100,\n  'kind' => 'image'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/files');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Delete up 100 files uplodaed in the 30 days month\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'after' => '2026-10-07T09:42:45.868Z',\n  'before' => '2026-11-06T09:42:45.868Z'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/files');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Delete up to 30 files with custom MIME file\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'limit' => 30,\n  'mime' => 'video/mp4'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/files');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Delete files with the specified IDs\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'ids' => '5f734dea0d77567691ff7109,5f734de50d77567691ff7103,5f734def0d77567691ff7101'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/files');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Delete files with the specified tags\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'tags' => 'foo,bar,baz'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/files');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Delete files with a custom permission value (only applicable for the account administrator)\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'permission' => 'public'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/files');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Delete files uploaded by one or multiple agents (only applicable for the account administrator)\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'owner' => '11134def0d77567691ff7102,1f734def0d77567691ff7101'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/files');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Delete up to 100 image files\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/files\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'limit' => 100,\n    'kind' => 'image'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Delete up 100 files uplodaed in the 30 days month\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/files\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'after' => '2026-10-07T09:42:45.868Z',\n    'before' => '2026-11-06T09:42:45.868Z'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Delete up to 30 files with custom MIME file\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/files\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'limit' => 30,\n    'mime' => 'video/mp4'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Delete files with the specified IDs\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/files\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'ids' => '5f734dea0d77567691ff7109,5f734de50d77567691ff7103,5f734def0d77567691ff7101'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Delete files with the specified tags\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/files\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'tags' => 'foo,bar,baz'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Delete files with a custom permission value (only applicable for the account administrator)\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/files\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'permission' => 'public'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Delete files uploaded by one or multiple agents (only applicable for the account administrator)\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/files\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'owner' => '11134def0d77567691ff7102,1f734def0d77567691ff7101'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Delete up to 100 image files\nimport requests\n\nurl = \"https://api.wassenger.com/v1/files\"\n\npayload = {\n    \"limit\": 100,\n    \"kind\": \"image\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Delete up 100 files uplodaed in the 30 days month\nimport requests\n\nurl = \"https://api.wassenger.com/v1/files\"\n\npayload = {\n    \"after\": \"2026-10-07T09:42:45.868Z\",\n    \"before\": \"2026-11-06T09:42:45.868Z\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Delete up to 30 files with custom MIME file\nimport requests\n\nurl = \"https://api.wassenger.com/v1/files\"\n\npayload = {\n    \"limit\": 30,\n    \"mime\": \"video/mp4\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Delete files with the specified IDs\nimport requests\n\nurl = \"https://api.wassenger.com/v1/files\"\n\npayload = { \"ids\": \"5f734dea0d77567691ff7109,5f734de50d77567691ff7103,5f734def0d77567691ff7101\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Delete files with the specified tags\nimport requests\n\nurl = \"https://api.wassenger.com/v1/files\"\n\npayload = { \"tags\": \"foo,bar,baz\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Delete files with a custom permission value (only applicable for the account administrator)\nimport requests\n\nurl = \"https://api.wassenger.com/v1/files\"\n\npayload = { \"permission\": \"public\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Delete files uploaded by one or multiple agents (only applicable for the account administrator)\nimport requests\n\nurl = \"https://api.wassenger.com/v1/files\"\n\npayload = { \"owner\": \"11134def0d77567691ff7102,1f734def0d77567691ff7101\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete up to 100 image files\nconst url = 'https://api.wassenger.com/v1/files';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"limit\":100,\"kind\":\"image\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete up 100 files uplodaed in the 30 days month\nconst url = 'https://api.wassenger.com/v1/files';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"after\":\"2026-10-07T09:42:45.868Z\",\"before\":\"2026-11-06T09:42:45.868Z\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete up to 30 files with custom MIME file\nconst url = 'https://api.wassenger.com/v1/files';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"limit\":30,\"mime\":\"video/mp4\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete files with the specified IDs\nconst url = 'https://api.wassenger.com/v1/files';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"ids\":\"5f734dea0d77567691ff7109,5f734de50d77567691ff7103,5f734def0d77567691ff7101\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete files with the specified tags\nconst url = 'https://api.wassenger.com/v1/files';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"tags\":\"foo,bar,baz\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete files with a custom permission value (only applicable for the account administrator)\nconst url = 'https://api.wassenger.com/v1/files';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"permission\":\"public\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete files uploaded by one or multiple agents (only applicable for the account administrator)\nconst url = 'https://api.wassenger.com/v1/files';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"owner\":\"11134def0d77567691ff7102,1f734def0d77567691ff7101\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete up to 100 image files\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/files',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"limit\":100,\"kind\":\"image\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Delete up 100 files uplodaed in the 30 days month\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/files',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"after\":\"2026-10-07T09:42:45.868Z\",\"before\":\"2026-11-06T09:42:45.868Z\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Delete up to 30 files with custom MIME file\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/files',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"limit\":30,\"mime\":\"video/mp4\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Delete files with the specified IDs\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/files',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"ids\":\"5f734dea0d77567691ff7109,5f734de50d77567691ff7103,5f734def0d77567691ff7101\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Delete files with the specified tags\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/files',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"tags\":\"foo,bar,baz\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Delete files with a custom permission value (only applicable for the account administrator)\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/files',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"permission\":\"public\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Delete files uploaded by one or multiple agents (only applicable for the account administrator)\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/files',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"owner\":\"11134def0d77567691ff7102,1f734def0d77567691ff7101\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Delete up to 100 image files\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/files\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"limit\\\":100,\\\"kind\\\":\\\"image\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Delete up 100 files uplodaed in the 30 days month\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/files\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"after\\\":\\\"2026-10-07T09:42:45.868Z\\\",\\\"before\\\":\\\"2026-11-06T09:42:45.868Z\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Delete up to 30 files with custom MIME file\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/files\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"limit\\\":30,\\\"mime\\\":\\\"video/mp4\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Delete files with the specified IDs\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/files\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"ids\\\":\\\"5f734dea0d77567691ff7109,5f734de50d77567691ff7103,5f734def0d77567691ff7101\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Delete files with the specified tags\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/files\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"tags\\\":\\\"foo,bar,baz\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Delete files with a custom permission value (only applicable for the account administrator)\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/files\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"permission\\\":\\\"public\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Delete files uploaded by one or multiple agents (only applicable for the account administrator)\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/files\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"owner\\\":\\\"11134def0d77567691ff7102,1f734def0d77567691ff7101\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Delete up to 100 image files\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/files\"\n\n\tpayload := strings.NewReader(\"{\\\"limit\\\":100,\\\"kind\\\":\\\"image\\\"}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Delete up 100 files uplodaed in the 30 days month\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/files\"\n\n\tpayload := strings.NewReader(\"{\\\"after\\\":\\\"2026-10-07T09:42:45.868Z\\\",\\\"before\\\":\\\"2026-11-06T09:42:45.868Z\\\"}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Delete up to 30 files with custom MIME file\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/files\"\n\n\tpayload := strings.NewReader(\"{\\\"limit\\\":30,\\\"mime\\\":\\\"video/mp4\\\"}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Delete files with the specified IDs\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/files\"\n\n\tpayload := strings.NewReader(\"{\\\"ids\\\":\\\"5f734dea0d77567691ff7109,5f734de50d77567691ff7103,5f734def0d77567691ff7101\\\"}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Delete files with the specified tags\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/files\"\n\n\tpayload := strings.NewReader(\"{\\\"tags\\\":\\\"foo,bar,baz\\\"}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Delete files with a custom permission value (only applicable for the account administrator)\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/files\"\n\n\tpayload := strings.NewReader(\"{\\\"permission\\\":\\\"public\\\"}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Delete files uploaded by one or multiple agents (only applicable for the account administrator)\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/files\"\n\n\tpayload := strings.NewReader(\"{\\\"owner\\\":\\\"11134def0d77567691ff7102,1f734def0d77567691ff7101\\\"}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Delete up to 100 image files\nvar client = new RestClient(\"https://api.wassenger.com/v1/files\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"limit\\\":100,\\\"kind\\\":\\\"image\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Delete up 100 files uplodaed in the 30 days month\nvar client = new RestClient(\"https://api.wassenger.com/v1/files\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"after\\\":\\\"2026-10-07T09:42:45.868Z\\\",\\\"before\\\":\\\"2026-11-06T09:42:45.868Z\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Delete up to 30 files with custom MIME file\nvar client = new RestClient(\"https://api.wassenger.com/v1/files\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"limit\\\":30,\\\"mime\\\":\\\"video/mp4\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Delete files with the specified IDs\nvar client = new RestClient(\"https://api.wassenger.com/v1/files\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"ids\\\":\\\"5f734dea0d77567691ff7109,5f734de50d77567691ff7103,5f734def0d77567691ff7101\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Delete files with the specified tags\nvar client = new RestClient(\"https://api.wassenger.com/v1/files\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"tags\\\":\\\"foo,bar,baz\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Delete files with a custom permission value (only applicable for the account administrator)\nvar client = new RestClient(\"https://api.wassenger.com/v1/files\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"permission\\\":\\\"public\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Delete files uploaded by one or multiple agents (only applicable for the account administrator)\nvar client = new RestClient(\"https://api.wassenger.com/v1/files\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"owner\\\":\\\"11134def0d77567691ff7102,1f734def0d77567691ff7101\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Delete up to 100 image files\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/files\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"limit\\\":100,\\\"kind\\\":\\\"image\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Delete up 100 files uplodaed in the 30 days month\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/files\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"after\\\":\\\"2026-10-07T09:42:45.868Z\\\",\\\"before\\\":\\\"2026-11-06T09:42:45.868Z\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Delete up to 30 files with custom MIME file\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/files\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"limit\\\":30,\\\"mime\\\":\\\"video/mp4\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Delete files with the specified IDs\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/files\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"ids\\\":\\\"5f734dea0d77567691ff7109,5f734de50d77567691ff7103,5f734def0d77567691ff7101\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Delete files with the specified tags\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/files\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"tags\\\":\\\"foo,bar,baz\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Delete files with a custom permission value (only applicable for the account administrator)\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/files\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"permission\\\":\\\"public\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Delete files uploaded by one or multiple agents (only applicable for the account administrator)\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/files\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"owner\\\":\\\"11134def0d77567691ff7102,1f734def0d77567691ff7101\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Delete up to 100 image files\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/files\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"limit\\\":100,\\\"kind\\\":\\\"image\\\"}\")\n  .asString();\n\n\n// Delete up 100 files uplodaed in the 30 days month\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/files\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"after\\\":\\\"2026-10-07T09:42:45.868Z\\\",\\\"before\\\":\\\"2026-11-06T09:42:45.868Z\\\"}\")\n  .asString();\n\n\n// Delete up to 30 files with custom MIME file\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/files\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"limit\\\":30,\\\"mime\\\":\\\"video/mp4\\\"}\")\n  .asString();\n\n\n// Delete files with the specified IDs\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/files\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"ids\\\":\\\"5f734dea0d77567691ff7109,5f734de50d77567691ff7103,5f734def0d77567691ff7101\\\"}\")\n  .asString();\n\n\n// Delete files with the specified tags\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/files\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"tags\\\":\\\"foo,bar,baz\\\"}\")\n  .asString();\n\n\n// Delete files with a custom permission value (only applicable for the account administrator)\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/files\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"permission\\\":\\\"public\\\"}\")\n  .asString();\n\n\n// Delete files uploaded by one or multiple agents (only applicable for the account administrator)\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/files\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"owner\\\":\\\"11134def0d77567691ff7102,1f734def0d77567691ff7101\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Delete up to 100 image files\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"limit\\\":100,\\\"kind\\\":\\\"image\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/files\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Delete up 100 files uplodaed in the 30 days month\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"after\\\":\\\"2026-10-07T09:42:45.868Z\\\",\\\"before\\\":\\\"2026-11-06T09:42:45.868Z\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/files\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Delete up to 30 files with custom MIME file\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"limit\\\":30,\\\"mime\\\":\\\"video/mp4\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/files\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Delete files with the specified IDs\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"ids\\\":\\\"5f734dea0d77567691ff7109,5f734de50d77567691ff7103,5f734def0d77567691ff7101\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/files\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Delete files with the specified tags\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"tags\\\":\\\"foo,bar,baz\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/files\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Delete files with a custom permission value (only applicable for the account administrator)\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"permission\\\":\\\"public\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/files\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Delete files uploaded by one or multiple agents (only applicable for the account administrator)\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"owner\\\":\\\"11134def0d77567691ff7102,1f734def0d77567691ff7101\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/files\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Delete up to 100 image files\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/files\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"limit\\\":100,\\\"kind\\\":\\\"image\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Delete up 100 files uplodaed in the 30 days month\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/files\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"after\\\":\\\"2026-10-07T09:42:45.868Z\\\",\\\"before\\\":\\\"2026-11-06T09:42:45.868Z\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Delete up to 30 files with custom MIME file\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/files\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"limit\\\":30,\\\"mime\\\":\\\"video/mp4\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Delete files with the specified IDs\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/files\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"ids\\\":\\\"5f734dea0d77567691ff7109,5f734de50d77567691ff7103,5f734def0d77567691ff7101\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Delete files with the specified tags\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/files\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"tags\\\":\\\"foo,bar,baz\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Delete files with a custom permission value (only applicable for the account administrator)\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/files\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"permission\\\":\\\"public\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Delete files uploaded by one or multiple agents (only applicable for the account administrator)\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/files\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"owner\\\":\\\"11134def0d77567691ff7102,1f734def0d77567691ff7101\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Delete up to 100 image files\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/files' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"limit\":100,\"kind\":\"image\"}'\n\n\n# Delete up 100 files uplodaed in the 30 days month\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/files' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"after\":\"2026-10-07T09:42:45.868Z\",\"before\":\"2026-11-06T09:42:45.868Z\"}'\n\n\n# Delete up to 30 files with custom MIME file\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/files' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"limit\":30,\"mime\":\"video/mp4\"}'\n\n\n# Delete files with the specified IDs\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/files' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"ids\":\"5f734dea0d77567691ff7109,5f734de50d77567691ff7103,5f734def0d77567691ff7101\"}'\n\n\n# Delete files with the specified tags\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/files' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"tags\":\"foo,bar,baz\"}'\n\n\n# Delete files with a custom permission value (only applicable for the account administrator)\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/files' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"permission\":\"public\"}'\n\n\n# Delete files uploaded by one or multiple agents (only applicable for the account administrator)\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/files' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"owner\":\"11134def0d77567691ff7102,1f734def0d77567691ff7101\"}'"},{"lang":"ObjC","source":"// Delete up to 100 image files\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"limit\": @100,\n                              @\"kind\": @\"image\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/files\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Delete up 100 files uplodaed in the 30 days month\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"after\": @\"2026-10-07T09:42:45.868Z\",\n                              @\"before\": @\"2026-11-06T09:42:45.868Z\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/files\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Delete up to 30 files with custom MIME file\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"limit\": @30,\n                              @\"mime\": @\"video/mp4\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/files\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Delete files with the specified IDs\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"ids\": @\"5f734dea0d77567691ff7109,5f734de50d77567691ff7103,5f734def0d77567691ff7101\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/files\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Delete files with the specified tags\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"tags\": @\"foo,bar,baz\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/files\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Delete files with a custom permission value (only applicable for the account administrator)\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"permission\": @\"public\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/files\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Delete files uploaded by one or multiple agents (only applicable for the account administrator)\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"owner\": @\"11134def0d77567691ff7102,1f734def0d77567691ff7101\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/files\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Delete up to 100 image files\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"limit\": 100,\n  \"kind\": \"image\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/files\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Delete up 100 files uplodaed in the 30 days month\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"after\": \"2026-10-07T09:42:45.868Z\",\n  \"before\": \"2026-11-06T09:42:45.868Z\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/files\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Delete up to 30 files with custom MIME file\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"limit\": 30,\n  \"mime\": \"video/mp4\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/files\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Delete files with the specified IDs\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"ids\": \"5f734dea0d77567691ff7109,5f734de50d77567691ff7103,5f734def0d77567691ff7101\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/files\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Delete files with the specified tags\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"tags\": \"foo,bar,baz\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/files\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Delete files with a custom permission value (only applicable for the account administrator)\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"permission\": \"public\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/files\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Delete files uploaded by one or multiple agents (only applicable for the account administrator)\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"owner\": \"11134def0d77567691ff7102,1f734def0d77567691ff7101\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/files\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices":{"parameters":[],"get":{"summary":"Get numbers","description":"List WhatsApp numbers, optionally filtered by search params.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fnumbers&params=%5B%7B%22key%22%3A%22size%22%2C%22value%22%3A10%7D%2C%7B%22key%22%3A%22page%22%2C%22value%22%3A0%7D%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getDevices","security":[{"apiKey":[]}],"tags":["Devices"],"produces":["application/json"],"parameters":[{"in":"query","name":"ids","type":"array","collectionFormat":"csv","description":"Search numbers by ID. For multiple IDs, use comma-separated values. E.g: 11b37a069cba0c15d6c81000,21b37a069cba0c15d6c81111","maxLength":50,"items":{"type":"string","minLength":24,"maxLength":24,"pattern":"^[0-9a-f]{24}$"}},{"in":"query","name":"connector","type":"array","collectionFormat":"csv","description":"Search numbers by connector type. E.g: `web`, `cloud`. Multiple values allowed separated by commas.","items":{"type":"string","enum":["web","cloud"]}},{"in":"query","name":"status","type":"string","default":"any","enum":["any","invalid","banned","removed","disabled","unpaid","preload","pending","authorized","verified","operative"],"description":"Search numbers by status. E.g: operative, pending, disabled, removed"},{"in":"query","name":"sessionStatus","type":"string","enum":["any","online","offline","timeout","timeout_sync","conflict","blocked","error","authorize","authorizing","new","loading","offline_panel","offline_modal"],"description":"Search numbers by session status. E.g: authorize, online, timeout, offline, error"},{"in":"query","name":"search","type":"string","maxLength":100,"description":"Search numbers by phone number, alias or ID. For multiple value searches use comma-separeted values. E.g: +1234567890,61b37a069cba0c15d6c81000"},{"in":"query","name":"page","type":"number","format":"integer","default":0,"minimum":0,"maximum":50},{"in":"query","name":"size","type":"number","format":"integer","default":20,"minimum":1,"maximum":100}],"responses":{"200":{"description":"Messages","schema":{"type":"array","items":{"$ref":"#/definitions/device"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// List numbers\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/numbers?size=10&page=0' \\\n  --header 'Token: <api token goes here>'\n\n\n// Get operative numbers\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/numbers?status=operative' \\\n  --header 'Token: <api token goes here>'\n\n\n// Get pending numbers\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/numbers?status=pending' \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// List numbers\nhttp GET 'https://api.wassenger.com/v1/numbers?size=10&page=0' \\\n  Token:'<api token goes here>'\n\n\n// Get operative numbers\nhttp GET 'https://api.wassenger.com/v1/numbers?status=operative' \\\n  Token:'<api token goes here>'\n\n\n// Get pending numbers\nhttp GET 'https://api.wassenger.com/v1/numbers?status=pending' \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// List numbers\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/numbers?size=10&page=0';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get operative numbers\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/numbers?status=operative';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get pending numbers\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/numbers?status=pending';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// List numbers\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/numbers',\n  params: {size: '10', page: '0'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get operative numbers\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/numbers',\n  params: {status: 'operative'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get pending numbers\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/numbers',\n  params: {status: 'pending'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// List numbers\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/numbers');\n\nreq.query({\n  size: '10',\n  page: '0'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get operative numbers\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/numbers');\n\nreq.query({\n  status: 'operative'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get pending numbers\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/numbers');\n\nreq.query({\n  status: 'pending'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// List numbers\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/numbers?size=10&page=0', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get operative numbers\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/numbers?status=operative', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get pending numbers\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/numbers?status=pending', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// List numbers\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/numbers');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'size' => '10',\n  'page' => '0'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get operative numbers\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/numbers');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'status' => 'operative'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get pending numbers\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/numbers');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'status' => 'pending'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// List numbers\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/numbers?size=10&page=0\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get operative numbers\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/numbers?status=operative\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get pending numbers\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/numbers?status=pending\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# List numbers\nimport requests\n\nurl = \"https://api.wassenger.com/v1/numbers\"\n\nquerystring = {\"size\":\"10\",\"page\":\"0\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Get operative numbers\nimport requests\n\nurl = \"https://api.wassenger.com/v1/numbers\"\n\nquerystring = {\"status\":\"operative\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Get pending numbers\nimport requests\n\nurl = \"https://api.wassenger.com/v1/numbers\"\n\nquerystring = {\"status\":\"pending\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// List numbers\nconst url = 'https://api.wassenger.com/v1/numbers?size=10&page=0';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get operative numbers\nconst url = 'https://api.wassenger.com/v1/numbers?status=operative';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get pending numbers\nconst url = 'https://api.wassenger.com/v1/numbers?status=pending';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// List numbers\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/numbers?size=10&page=0',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get operative numbers\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/numbers?status=operative',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get pending numbers\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/numbers?status=pending',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# List numbers\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/numbers?size=10&page=0\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get operative numbers\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/numbers?status=operative\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get pending numbers\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/numbers?status=pending\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// List numbers\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/numbers?size=10&page=0\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get operative numbers\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/numbers?status=operative\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get pending numbers\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/numbers?status=pending\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// List numbers\nvar client = new RestClient(\"https://api.wassenger.com/v1/numbers?size=10&page=0\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Get operative numbers\nvar client = new RestClient(\"https://api.wassenger.com/v1/numbers?status=operative\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Get pending numbers\nvar client = new RestClient(\"https://api.wassenger.com/v1/numbers?status=pending\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// List numbers\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/numbers?size=10&page=0\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get operative numbers\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/numbers?status=operative\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get pending numbers\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/numbers?status=pending\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// List numbers\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/numbers?size=10&page=0\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Get operative numbers\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/numbers?status=operative\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Get pending numbers\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/numbers?status=pending\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// List numbers\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/numbers?size=10&page=0\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get operative numbers\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/numbers?status=operative\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get pending numbers\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/numbers?status=pending\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// List numbers\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/numbers?size=10&page=0\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get operative numbers\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/numbers?status=operative\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get pending numbers\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/numbers?status=pending\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# List numbers\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/numbers?size=10&page=0' -Method GET -Headers $headers\n\n\n# Get operative numbers\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/numbers?status=operative' -Method GET -Headers $headers\n\n\n# Get pending numbers\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/numbers?status=pending' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// List numbers\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/numbers?size=10&page=0\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get operative numbers\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/numbers?status=operative\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get pending numbers\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/numbers?status=pending\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// List numbers\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/numbers?size=10&page=0\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get operative numbers\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/numbers?status=operative\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get pending numbers\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/numbers?status=pending\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"post":{"description":"Create new number with a specific monthly subscription plan (io-professional, io-business or io-enterprise).\n\n\n\n**Note**: `gateway-*` plans are deprecated and no longer available for new subscriptions. Attempting to use a `gateway-*` plan will return a `403` error.\n\n\n\n\n\nAfter the number creation, you would need to authorize the session by scanning the QR code.\n\n\n\nA new number session creation might take up to 2 minutes to be available and provide a QR scan image.\n\n\n\nYou can retrieve the QR code image by calling the endpoint: [`/numbers/{numberId}/scan`](#operation/scanQR).\n\n\n\nYou might have to retry multiple times the HTTP request until the QR image is available and returns a `200` status code.\n\n\n\n\n\n**IMPORTANT NOTE**:\n\nWhen you create a new number, the default payment card will be charged with the plan's price for the selected billing `interval`.\n\n\n\nIf your account is eligible for a free trial, the new number gets it, unless you already have a trial number that was never connected: then the new number is charged straight away. Connecting that number uses the trial on it. To give the trial to a new number instead, delete that number first. That usually works, but not once three numbers were created in the last 30 days without connecting any of them: the next number is then charged.\n\n\n\n`interval` may be `month` (default) or `year`. `year` charges 12 months up front, at 10x the monthly price (2 months free). Annual billing is only available on eligible accounts and plans; other accounts will receive a `403` error if `year` is requested.\n\n\n\nIf you have no payment card added or the payment fails, this endpoint will return an error and the number will not be created.\n\n\n\n\n\nIf you need further assistance in automating numbers creating, please contact support.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fnumbers&method=POST&body=%7B%0A%20%20%22alias%22%3A%20%22My%20Business%20Name%22%2C%0A%20%20%22description%22%3A%20%22This%20is%20an%20optional%20description%20to%20identify%20the%20number%22%2C%0A%20%20%22billingPlan%22%3A%20%22io-professional%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"createDevice","security":[{"apiKey":[]}],"tags":["Devices"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"device","description":"Create new device","schema":{"type":"object","properties":{"alias":{"type":"string","minLength":2,"maxLength":30},"billingPlan":{"type":"string","enum":["business","enterprise","professional","gateway-business","gateway-enterprise","gateway-professional","io-professional","io-business","io-enterprise"],"description":"Subscription plan for the number. Recommended plans: `io-professional`, `io-business`, `io-enterprise`. **Deprecated**: `gateway-*` plans are no longer available for new subscriptions."},"interval":{"type":"string","enum":["month","year"],"description":"Billing interval for the subscription. `year` (annual, 2 months free) is only available on Platform plans for direct customers.","default":"month"},"agents":{"type":"array","items":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","maxLength":24,"minLength":24},"maxItems":50,"description":"**Restricted to Platform plans**: optionally set the Agents IDs to provide shared chat access to the new device. You can also add or revoke chat agents after the device creation."},"connector":{"type":"string","enum":["web","cloud"],"description":"WhatsApp number connection mode: use `web` for standard WhatsApp mobile app connection, or `cloud` for WhatsApp Cloud API connection.","default":"web"},"paymentIntent":{"type":"string","pattern":"^pi_","minLength":20,"maxLength":80}},"required":["alias","billingPlan"],"additionalProperties":false}}],"responses":{"201":{"description":"New number created","schema":{"$ref":"#/definitions/device"}},"400":{"description":"Bad request because of invalid payload","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Payment method not available","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"summary":"Create number","x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Create new number\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/numbers \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"alias\":\"My Business Name\",\"description\":\"This is an optional description to identify the number\",\"billingPlan\":\"io-professional\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Create new number\necho '{\"alias\":\"My Business Name\",\"description\":\"This is an optional description to identify the number\",\"billingPlan\":\"io-professional\"}' |  \\\n  http POST https://api.wassenger.com/v1/numbers \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Create new number\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/numbers';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"alias\":\"My Business Name\",\"description\":\"This is an optional description to identify the number\",\"billingPlan\":\"io-professional\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Create new number\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/numbers',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    alias: 'My Business Name',\n    description: 'This is an optional description to identify the number',\n    billingPlan: 'io-professional'\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Create new number\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/numbers');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  alias: 'My Business Name',\n  description: 'This is an optional description to identify the number',\n  billingPlan: 'io-professional'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Create new number\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/numbers', [\n  'body' => '{\"alias\":\"My Business Name\",\"description\":\"This is an optional description to identify the number\",\"billingPlan\":\"io-professional\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Create new number\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'alias' => 'My Business Name',\n  'description' => 'This is an optional description to identify the number',\n  'billingPlan' => 'io-professional'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/numbers');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Create new number\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/numbers\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'alias' => 'My Business Name',\n    'description' => 'This is an optional description to identify the number',\n    'billingPlan' => 'io-professional'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Create new number\nimport requests\n\nurl = \"https://api.wassenger.com/v1/numbers\"\n\npayload = {\n    \"alias\": \"My Business Name\",\n    \"description\": \"This is an optional description to identify the number\",\n    \"billingPlan\": \"io-professional\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create new number\nconst url = 'https://api.wassenger.com/v1/numbers';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"alias\":\"My Business Name\",\"description\":\"This is an optional description to identify the number\",\"billingPlan\":\"io-professional\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create new number\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/numbers',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"alias\":\"My Business Name\",\"description\":\"This is an optional description to identify the number\",\"billingPlan\":\"io-professional\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Create new number\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/numbers\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"alias\\\":\\\"My Business Name\\\",\\\"description\\\":\\\"This is an optional description to identify the number\\\",\\\"billingPlan\\\":\\\"io-professional\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Create new number\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/numbers\"\n\n\tpayload := strings.NewReader(\"{\\\"alias\\\":\\\"My Business Name\\\",\\\"description\\\":\\\"This is an optional description to identify the number\\\",\\\"billingPlan\\\":\\\"io-professional\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Create new number\nvar client = new RestClient(\"https://api.wassenger.com/v1/numbers\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"alias\\\":\\\"My Business Name\\\",\\\"description\\\":\\\"This is an optional description to identify the number\\\",\\\"billingPlan\\\":\\\"io-professional\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Create new number\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/numbers\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"alias\\\":\\\"My Business Name\\\",\\\"description\\\":\\\"This is an optional description to identify the number\\\",\\\"billingPlan\\\":\\\"io-professional\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Create new number\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/numbers\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"alias\\\":\\\"My Business Name\\\",\\\"description\\\":\\\"This is an optional description to identify the number\\\",\\\"billingPlan\\\":\\\"io-professional\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Create new number\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"alias\\\":\\\"My Business Name\\\",\\\"description\\\":\\\"This is an optional description to identify the number\\\",\\\"billingPlan\\\":\\\"io-professional\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/numbers\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Create new number\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/numbers\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"alias\\\":\\\"My Business Name\\\",\\\"description\\\":\\\"This is an optional description to identify the number\\\",\\\"billingPlan\\\":\\\"io-professional\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Create new number\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/numbers' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"alias\":\"My Business Name\",\"description\":\"This is an optional description to identify the number\",\"billingPlan\":\"io-professional\"}'"},{"lang":"ObjC","source":"// Create new number\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"alias\": @\"My Business Name\",\n                              @\"description\": @\"This is an optional description to identify the number\",\n                              @\"billingPlan\": @\"io-professional\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/numbers\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Create new number\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"alias\": \"My Business Name\",\n  \"description\": \"This is an optional description to identify the number\",\n  \"billingPlan\": \"io-professional\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/numbers\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/deals/tasks":{"parameters":[],"get":{"summary":"List account tasks","description":"Every task the account owes, across every deal, soonest first.\n\n\n\nA task is a deal note carrying a `dueAt` date, so this is the account-wide\n\nreading of the same documents `GET /deals/{dealId}/notes` returns for one\n\ndeal. Notes without a due date are never included.\n\n\n\nPending only by default. Pass `done=true` to include tasks already completed.\n\n\n\n`from` and `to` are absolute instants, so the caller decides what \"today\",\n\n\"tomorrow\" or \"overdue\" mean in its own timezone: overdue is `to=<now>`, and\n\na day is that day's bounds in the reader's zone.\n\n\n\nThe response carries the tasks and their parent deals as two lists joined by\n\nthe task's `deal` id, so a deal holding several tasks is sent once.\n\n\n\nRestricted agents receive only tasks on their own deals, mirroring the board\n\nand the inbox visibility rules. For those callers the scope is applied after\n\nthe page is cut, so a page may return fewer rows than `limit` while later\n\npages still hold tasks: page until a page comes back empty.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdeals%2Ftasks&params=%5B%7B%22key%22%3A%22to%22%2C%22value%22%3A%222026-09-07T00%3A00%3A00.000Z%22%7D%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"listDealTasks","security":[{"apiKey":[]}],"tags":["Deals"],"produces":["application/json"],"parameters":[{"in":"query","name":"from","type":"string","format":"date-time","required":false,"description":"Only tasks due at or after this instant (ISO 8601)"},{"in":"query","name":"to","type":"string","format":"date-time","required":false,"description":"Only tasks due at or before this instant (ISO 8601). Overdue is this alone, set to now"},{"in":"query","name":"done","type":"boolean","required":false,"description":"Include completed tasks. Default false: only what is still owed"},{"in":"query","name":"device","type":"string","required":false,"minLength":24,"maxLength":24,"pattern":"^[a-f0-9]{24}$","description":"Only tasks on deals of this WhatsApp number"},{"in":"query","name":"deals","type":"string","required":false,"description":"Only tasks on these deals, as a comma-separated list or a repeated parameter, up to 100. Answers \"which of these cards owes something\" for the deals currently on screen"},{"in":"query","name":"limit","type":"number","required":false,"minimum":1,"maximum":200,"description":"Max results, default 50, max 200"},{"in":"query","name":"skip","type":"number","required":false,"minimum":0,"maximum":10000,"description":"Skip N results"}],"responses":{"200":{"description":"Tasks due, soonest first, with their parent deals","schema":{"type":"object","properties":{"tasks":{"type":"array","items":{"$ref":"#/definitions/dealNote"}},"deals":{"type":"array","items":{"$ref":"#/definitions/deal"}}}}},"400":{"description":"Invalid date window or device ID","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Everything already overdue\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/deals/tasks?to=2026-09-07T00%3A00%3A00.000Z' \\\n  --header 'Token: <api token goes here>'\n\n\n// Everything due today, in the caller's own timezone\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/deals/tasks?from=2026-09-07T00%3A00%3A00.000Z&to=2026-09-07T23%3A59%3A59.999Z' \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Everything already overdue\nhttp GET 'https://api.wassenger.com/v1/deals/tasks?to=2026-09-07T00%3A00%3A00.000Z' \\\n  Token:'<api token goes here>'\n\n\n// Everything due today, in the caller's own timezone\nhttp GET 'https://api.wassenger.com/v1/deals/tasks?from=2026-09-07T00%3A00%3A00.000Z&to=2026-09-07T23%3A59%3A59.999Z' \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Everything already overdue\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/deals/tasks?to=2026-09-07T00%3A00%3A00.000Z';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Everything due today, in the caller's own timezone\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/deals/tasks?from=2026-09-07T00%3A00%3A00.000Z&to=2026-09-07T23%3A59%3A59.999Z';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Everything already overdue\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/deals/tasks',\n  params: {to: '2026-09-07T00:00:00.000Z'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Everything due today, in the caller's own timezone\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/deals/tasks',\n  params: {from: '2026-09-07T00:00:00.000Z', to: '2026-09-07T23:59:59.999Z'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Everything already overdue\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/deals/tasks');\n\nreq.query({\n  to: '2026-09-07T00:00:00.000Z'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Everything due today, in the caller's own timezone\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/deals/tasks');\n\nreq.query({\n  from: '2026-09-07T00:00:00.000Z',\n  to: '2026-09-07T23:59:59.999Z'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Everything already overdue\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/deals/tasks?to=2026-09-07T00%3A00%3A00.000Z', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Everything due today, in the caller's own timezone\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/deals/tasks?from=2026-09-07T00%3A00%3A00.000Z&to=2026-09-07T23%3A59%3A59.999Z', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Everything already overdue\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/deals/tasks');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'to' => '2026-09-07T00:00:00.000Z'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Everything due today, in the caller's own timezone\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/deals/tasks');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'from' => '2026-09-07T00:00:00.000Z',\n  'to' => '2026-09-07T23:59:59.999Z'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Everything already overdue\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/deals/tasks?to=2026-09-07T00%3A00%3A00.000Z\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Everything due today, in the caller's own timezone\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/deals/tasks?from=2026-09-07T00%3A00%3A00.000Z&to=2026-09-07T23%3A59%3A59.999Z\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Everything already overdue\nimport requests\n\nurl = \"https://api.wassenger.com/v1/deals/tasks\"\n\nquerystring = {\"to\":\"2026-09-07T00:00:00.000Z\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Everything due today, in the caller's own timezone\nimport requests\n\nurl = \"https://api.wassenger.com/v1/deals/tasks\"\n\nquerystring = {\"from\":\"2026-09-07T00:00:00.000Z\",\"to\":\"2026-09-07T23:59:59.999Z\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Everything already overdue\nconst url = 'https://api.wassenger.com/v1/deals/tasks?to=2026-09-07T00%3A00%3A00.000Z';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Everything due today, in the caller's own timezone\nconst url = 'https://api.wassenger.com/v1/deals/tasks?from=2026-09-07T00%3A00%3A00.000Z&to=2026-09-07T23%3A59%3A59.999Z';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Everything already overdue\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/deals/tasks?to=2026-09-07T00%3A00%3A00.000Z',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Everything due today, in the caller's own timezone\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/deals/tasks?from=2026-09-07T00%3A00%3A00.000Z&to=2026-09-07T23%3A59%3A59.999Z',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Everything already overdue\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/deals/tasks?to=2026-09-07T00%3A00%3A00.000Z\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Everything due today, in the caller's own timezone\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/deals/tasks?from=2026-09-07T00%3A00%3A00.000Z&to=2026-09-07T23%3A59%3A59.999Z\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Everything already overdue\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/deals/tasks?to=2026-09-07T00%3A00%3A00.000Z\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Everything due today, in the caller's own timezone\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/deals/tasks?from=2026-09-07T00%3A00%3A00.000Z&to=2026-09-07T23%3A59%3A59.999Z\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Everything already overdue\nvar client = new RestClient(\"https://api.wassenger.com/v1/deals/tasks?to=2026-09-07T00%3A00%3A00.000Z\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Everything due today, in the caller's own timezone\nvar client = new RestClient(\"https://api.wassenger.com/v1/deals/tasks?from=2026-09-07T00%3A00%3A00.000Z&to=2026-09-07T23%3A59%3A59.999Z\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Everything already overdue\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/deals/tasks?to=2026-09-07T00%3A00%3A00.000Z\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Everything due today, in the caller's own timezone\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/deals/tasks?from=2026-09-07T00%3A00%3A00.000Z&to=2026-09-07T23%3A59%3A59.999Z\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Everything already overdue\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/deals/tasks?to=2026-09-07T00%3A00%3A00.000Z\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Everything due today, in the caller's own timezone\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/deals/tasks?from=2026-09-07T00%3A00%3A00.000Z&to=2026-09-07T23%3A59%3A59.999Z\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Everything already overdue\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/deals/tasks?to=2026-09-07T00%3A00%3A00.000Z\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Everything due today, in the caller's own timezone\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/deals/tasks?from=2026-09-07T00%3A00%3A00.000Z&to=2026-09-07T23%3A59%3A59.999Z\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Everything already overdue\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/deals/tasks?to=2026-09-07T00%3A00%3A00.000Z\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Everything due today, in the caller's own timezone\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/deals/tasks?from=2026-09-07T00%3A00%3A00.000Z&to=2026-09-07T23%3A59%3A59.999Z\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Everything already overdue\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/deals/tasks?to=2026-09-07T00%3A00%3A00.000Z' -Method GET -Headers $headers\n\n\n# Everything due today, in the caller's own timezone\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/deals/tasks?from=2026-09-07T00%3A00%3A00.000Z&to=2026-09-07T23%3A59%3A59.999Z' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Everything already overdue\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/deals/tasks?to=2026-09-07T00%3A00%3A00.000Z\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Everything due today, in the caller's own timezone\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/deals/tasks?from=2026-09-07T00%3A00%3A00.000Z&to=2026-09-07T23%3A59%3A59.999Z\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Everything already overdue\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/deals/tasks?to=2026-09-07T00%3A00%3A00.000Z\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Everything due today, in the caller's own timezone\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/deals/tasks?from=2026-09-07T00%3A00%3A00.000Z&to=2026-09-07T23%3A59%3A59.999Z\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/deals/hydrate":{"parameters":[],"post":{"summary":"Hydrate deals","description":"Refresh the display card of up to 100 deals from the live chat data and return them.\n\n\n\nThis is the read-through freshness path used by the funnel board: the `card` object is a display cache kept up to date by the reconciliation job, and this endpoint lets a client force the same refresh for the deals it is currently painting.\n\n\n\nRestricted agents can only refresh deals assigned to them, mirroring the inbox visibility rules.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdeals%2Fhydrate&method=POST&body=%7B%0A%20%20%22deals%22%3A%20%5B%0A%20%20%20%20%225f7b1b1b1b1b1b1b1b1b1b1b%22%0A%20%20%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"hydrateDeals","security":[{"apiKey":[]}],"tags":["Deals"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"hydrate","description":"Deal IDs to refresh","schema":{"type":"object","properties":{"deals":{"type":"array","items":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24},"minItems":1,"maxItems":100,"description":"Deal IDs to refresh from the live chat data. Max 100 per request"}},"required":["deals"],"additionalProperties":false}}],"responses":{"200":{"description":"The refreshed deals","schema":{"type":"array","items":{"$ref":"#/definitions/deal"}}},"400":{"description":"Invalid hydrate request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Refresh the cards of the deals on screen\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/deals/hydrate \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"deals\":[\"5f7b1b1b1b1b1b1b1b1b1b1b\"]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Refresh the cards of the deals on screen\necho '{\"deals\":[\"5f7b1b1b1b1b1b1b1b1b1b1b\"]}' |  \\\n  http POST https://api.wassenger.com/v1/deals/hydrate \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Refresh the cards of the deals on screen\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/deals/hydrate';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"deals\":[\"5f7b1b1b1b1b1b1b1b1b1b1b\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Refresh the cards of the deals on screen\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/deals/hydrate',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {deals: ['5f7b1b1b1b1b1b1b1b1b1b1b']}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Refresh the cards of the deals on screen\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/deals/hydrate');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  deals: [\n    '5f7b1b1b1b1b1b1b1b1b1b1b'\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Refresh the cards of the deals on screen\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/deals/hydrate', [\n  'body' => '{\"deals\":[\"5f7b1b1b1b1b1b1b1b1b1b1b\"]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Refresh the cards of the deals on screen\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'deals' => [\n    '5f7b1b1b1b1b1b1b1b1b1b1b'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/deals/hydrate');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Refresh the cards of the deals on screen\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/deals/hydrate\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'deals' => [\n        '5f7b1b1b1b1b1b1b1b1b1b1b'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Refresh the cards of the deals on screen\nimport requests\n\nurl = \"https://api.wassenger.com/v1/deals/hydrate\"\n\npayload = { \"deals\": [\"5f7b1b1b1b1b1b1b1b1b1b1b\"] }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Refresh the cards of the deals on screen\nconst url = 'https://api.wassenger.com/v1/deals/hydrate';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"deals\":[\"5f7b1b1b1b1b1b1b1b1b1b1b\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Refresh the cards of the deals on screen\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/deals/hydrate',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"deals\":[\"5f7b1b1b1b1b1b1b1b1b1b1b\"]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Refresh the cards of the deals on screen\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/deals/hydrate\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"deals\\\":[\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\"]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Refresh the cards of the deals on screen\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/deals/hydrate\"\n\n\tpayload := strings.NewReader(\"{\\\"deals\\\":[\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\"]}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Refresh the cards of the deals on screen\nvar client = new RestClient(\"https://api.wassenger.com/v1/deals/hydrate\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"deals\\\":[\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\"]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Refresh the cards of the deals on screen\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/deals/hydrate\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"deals\\\":[\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\"]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Refresh the cards of the deals on screen\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/deals/hydrate\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"deals\\\":[\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\"]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Refresh the cards of the deals on screen\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"deals\\\":[\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\"]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/deals/hydrate\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Refresh the cards of the deals on screen\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/deals/hydrate\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"deals\\\":[\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\"]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Refresh the cards of the deals on screen\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/deals/hydrate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"deals\":[\"5f7b1b1b1b1b1b1b1b1b1b1b\"]}'"},{"lang":"ObjC","source":"// Refresh the cards of the deals on screen\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"deals\": @[ @\"5f7b1b1b1b1b1b1b1b1b1b1b\" ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/deals/hydrate\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Refresh the cards of the deals on screen\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"deals\": [\"5f7b1b1b1b1b1b1b1b1b1b1b\"]] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/deals/hydrate\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/deals":{"parameters":[],"get":{"summary":"Get deals","description":"Retrieve deals of the account, filtered and paginated. Defaults to open deals.\n\n\n\nRestricted agents only receive their own deals, mirroring the inbox visibility rules.\n\n\n\nA deal's activity timestamp moves on any change to the deal AND on new conversation activity mirrored from its chat, which is refreshed at most every 15 minutes. It is the `updatedAt` field of the deal, so a caller can check the filter against what this endpoint returns.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdeals)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getDeals","security":[{"apiKey":[]}],"tags":["Deals"],"parameters":[{"in":"query","name":"pipeline","type":"string","required":false,"description":"Filter by pipeline ID"},{"in":"query","name":"stage","type":"string","required":false,"description":"Filter by stage ID"},{"in":"query","name":"status","type":"string","required":false,"description":"Deal status: open (default), won, lost or archived"},{"in":"query","name":"agent","type":"string","required":false,"description":"Filter by assigned agent ID"},{"in":"query","name":"contact","type":"string","required":false,"description":"Filter by contact WhatsApp ID, spanning the @c.us/@lid identity equivalence"},{"in":"query","name":"device","type":"array","items":{"type":"string"},"required":false,"description":"Filter by device IDs"},{"in":"query","name":"stalled","type":"string","required":false,"enum":["true","false","sla","1w","1m","3m","6m"],"description":"Only deals stuck in their stage. Requires a pipeline.\n\nsla (or true) = past the SLA of the stage the deal sits in. 1w, 1m, 3m and 6m = at least one week, one month, three months or six months in the same stage: these also work on funnels with no stage SLA, and they order the page by stage entry date ascending (longest stuck first) instead of last update descending. false = no filter."},{"in":"query","name":"closedAfter","type":"string","format":"date-time","required":false,"description":"Only deals CLOSED at or after this instant. Filters on `closedAt`, not on `updatedAt`, so it matches the window the pipeline summary reports in `won30d` and `lost30d`. Only meaningful together with `status=won` or `status=lost`: an open deal has no close date and is excluded by it."},{"in":"query","name":"updatedAfter","type":"string","format":"date-time","required":false,"description":"Only deals whose last activity is at or after this instant (ISO 8601). Example: `2026-08-01T00:00:00.000Z`"},{"in":"query","name":"updatedBefore","type":"string","format":"date-time","required":false,"description":"Only deals whose last activity is before this instant (ISO 8601).\n\nCombine with updatedAfter for a bounded period: the range is half-open, [updatedAfter, updatedBefore), so consecutive periods tile without returning the same deal twice.\n\nPair either bound with `stage` on large pipelines. Both ride the trailing key of the stage index, and a pipeline-wide call with no stage cannot use it for the range."},{"in":"query","name":"dueAfter","type":"string","format":"date-time","required":false,"description":"Only deals carrying a pending task due at or after this instant (ISO 8601)."},{"in":"query","name":"dueBefore","type":"string","format":"date-time","required":false,"description":"Only deals carrying a pending task due at or before this instant (ISO 8601).\n\nA task is a deal note with a `dueAt` date; completed tasks never count. Overdue is this bound alone, set to now, and a single day is that day's bounds in the reader's own timezone: the window is absolute so the caller decides what \"today\" means.\n\nResolved from the notes first, so it is the one filter here that reads a second collection. It is exact up to 5000 owing deals per account and under-reports beyond that."},{"in":"query","name":"chatStatus","type":"string","required":false,"description":"Only deals whose WhatsApp conversation is in this state: removed, banned, archived, muted, pending, active, resolved, none. Requires a pipeline, and only applies to open deals.\n\nnone = the deal has no conversation yet (it was created from a phone number). removed = it had one and the conversation was deleted.\n\nThe state is mirrored onto the deal from its chat when the deal is read or refreshed, so a deal nobody has opened or swept yet carries no state at all and is returned by no value of this filter."},{"in":"query","name":"unassigned","type":"string","required":false,"enum":["true","false"],"description":"Only deals with no agent assigned. Cannot be combined with agent. Restricted agents are always pinned to their own deals, so this changes nothing for them."},{"in":"query","name":"unread","type":"string","required":false,"enum":["true","false"],"description":"Only deals whose conversation has unread messages"},{"in":"query","name":"lostReason","type":"string","required":false,"description":"Only deals lost for this reason. Requires a pipeline and `status=lost`.\n\nMatched ignoring surrounding whitespace, the same way the pipeline summary groups reasons, so a reason stored twice with a stray trailing space returns the same deals the summary counted under it. Pass an empty value for the deals closed with no reason recorded, which is the `reason: null` entry of `lostReasonStats`."},{"in":"query","name":"page","type":"number","required":false,"description":"Page number, starts at 1"},{"in":"query","name":"size","type":"number","required":false,"description":"Page size, default 50, max 100"}],"responses":{"200":{"description":"List of deals","schema":{"type":"array","items":{"$ref":"#/definitions/deal"}}},"400":{"description":"Invalid filters","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Pipeline not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get open deals of a pipeline stage\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/deals \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get open deals of a pipeline stage\nhttp GET https://api.wassenger.com/v1/deals \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get open deals of a pipeline stage\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/deals';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get open deals of a pipeline stage\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/deals',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get open deals of a pipeline stage\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/deals');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get open deals of a pipeline stage\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/deals', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get open deals of a pipeline stage\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/deals');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get open deals of a pipeline stage\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/deals\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get open deals of a pipeline stage\nimport requests\n\nurl = \"https://api.wassenger.com/v1/deals\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get open deals of a pipeline stage\nconst url = 'https://api.wassenger.com/v1/deals';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get open deals of a pipeline stage\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/deals',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get open deals of a pipeline stage\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/deals\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get open deals of a pipeline stage\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/deals\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get open deals of a pipeline stage\nvar client = new RestClient(\"https://api.wassenger.com/v1/deals\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get open deals of a pipeline stage\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/deals\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get open deals of a pipeline stage\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/deals\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get open deals of a pipeline stage\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/deals\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get open deals of a pipeline stage\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/deals\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get open deals of a pipeline stage\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/deals' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get open deals of a pipeline stage\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/deals\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get open deals of a pipeline stage\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/deals\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"post":{"summary":"Create deal","description":"Create a deal for a contact in a pipeline.\n\n\n\nOnly one open deal may exist per contact and pipeline: the check spans the `@c.us`/`@lid` identity equivalence, so the same person cannot get duplicated deals under twin WhatsApp IDs.\n\n\n\nAn archived pipeline takes no new deals (409): its existing ones stay readable and can still be moved and closed, but new work has to go into an active pipeline or the archived one has to be restored first.\n\n\n\n**Note**: this API resource is available in the Platform Professional subscription and above.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdeals&method=POST&body=%7B%0A%20%20%22pipeline%22%3A%20%225f7b1b1b1b1b1b1b1b1b1b1b%22%2C%0A%20%20%22device%22%3A%20%225f7b1b1b1b1b1b1b1b1b1b1c%22%2C%0A%20%20%22contactWid%22%3A%20%2234600111222%40c.us%22%2C%0A%20%20%22chatWid%22%3A%20%2234600111222%40c.us%22%2C%0A%20%20%22title%22%3A%20%22Pedido%20inicial%22%2C%0A%20%20%22amount%22%3A%201500%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"createDeal","security":[{"apiKey":[]}],"tags":["Deals"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"deal","description":"Create a new deal","schema":{"type":"object","properties":{"pipeline":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Pipeline unique ID the deal belongs to. Required"},"device":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Device (WhatsApp number) ID the deal belongs to. Required"},"stage":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Initial stage ID. Defaults to the first open stage of the pipeline"},"contactWid":{"type":"string","pattern":"@(c\\.us|lid|g\\.us|newsletter|broadcast)$","minLength":5,"maxLength":50,"description":"Contact WhatsApp ID the deal belongs to. Required"},"chatWid":{"type":"string","pattern":"@(c\\.us|lid|g\\.us|newsletter|broadcast)$","minLength":5,"maxLength":50,"description":"Chat WhatsApp ID the deal was created from. Optional"},"title":{"type":"string","minLength":1,"maxLength":120,"description":"Deal title. Defaults to the contact name"},"amount":{"type":"number","format":"float","minimum":0,"maximum":999999999,"description":"Deal monetary value. Optional"},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code. Defaults to the pipeline currency"},"agent":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Agent user ID assigned to the deal"},"department":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Department ID assigned to the deal"},"card":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120,"description":"Contact display name"},"phone":{"type":"string","minLength":1,"maxLength":30,"description":"Contact phone number"},"avatarUrl":{"type":"string","maxLength":500,"description":"Contact avatar URL"}},"additionalProperties":false,"description":"Display-only card seed. Kept fresh by the reconciliation job, never used for decisions"}},"required":["pipeline","device","contactWid"],"additionalProperties":false}}],"responses":{"200":{"description":"Deal created","schema":{"$ref":"#/definitions/deal"}},"400":{"description":"Invalid deal payload","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unsupported operation - plan upgrade required","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Device or pipeline not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"An open deal already exists for this contact, or the pipeline is archived and takes no new deals","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Create a deal from a chat\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/deals \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"pipeline\":\"5f7b1b1b1b1b1b1b1b1b1b1b\",\"device\":\"5f7b1b1b1b1b1b1b1b1b1b1c\",\"contactWid\":\"34600111222@c.us\",\"chatWid\":\"34600111222@c.us\",\"title\":\"Pedido inicial\",\"amount\":1500}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Create a deal from a chat\necho '{\"pipeline\":\"5f7b1b1b1b1b1b1b1b1b1b1b\",\"device\":\"5f7b1b1b1b1b1b1b1b1b1b1c\",\"contactWid\":\"34600111222@c.us\",\"chatWid\":\"34600111222@c.us\",\"title\":\"Pedido inicial\",\"amount\":1500}' |  \\\n  http POST https://api.wassenger.com/v1/deals \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Create a deal from a chat\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/deals';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"pipeline\":\"5f7b1b1b1b1b1b1b1b1b1b1b\",\"device\":\"5f7b1b1b1b1b1b1b1b1b1b1c\",\"contactWid\":\"34600111222@c.us\",\"chatWid\":\"34600111222@c.us\",\"title\":\"Pedido inicial\",\"amount\":1500}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Create a deal from a chat\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/deals',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    pipeline: '5f7b1b1b1b1b1b1b1b1b1b1b',\n    device: '5f7b1b1b1b1b1b1b1b1b1b1c',\n    contactWid: '34600111222@c.us',\n    chatWid: '34600111222@c.us',\n    title: 'Pedido inicial',\n    amount: 1500\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Create a deal from a chat\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/deals');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  pipeline: '5f7b1b1b1b1b1b1b1b1b1b1b',\n  device: '5f7b1b1b1b1b1b1b1b1b1b1c',\n  contactWid: '34600111222@c.us',\n  chatWid: '34600111222@c.us',\n  title: 'Pedido inicial',\n  amount: 1500\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Create a deal from a chat\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/deals', [\n  'body' => '{\"pipeline\":\"5f7b1b1b1b1b1b1b1b1b1b1b\",\"device\":\"5f7b1b1b1b1b1b1b1b1b1b1c\",\"contactWid\":\"34600111222@c.us\",\"chatWid\":\"34600111222@c.us\",\"title\":\"Pedido inicial\",\"amount\":1500}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Create a deal from a chat\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'pipeline' => '5f7b1b1b1b1b1b1b1b1b1b1b',\n  'device' => '5f7b1b1b1b1b1b1b1b1b1b1c',\n  'contactWid' => '34600111222@c.us',\n  'chatWid' => '34600111222@c.us',\n  'title' => 'Pedido inicial',\n  'amount' => 1500\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/deals');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Create a deal from a chat\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/deals\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'pipeline' => '5f7b1b1b1b1b1b1b1b1b1b1b',\n    'device' => '5f7b1b1b1b1b1b1b1b1b1b1c',\n    'contactWid' => '34600111222@c.us',\n    'chatWid' => '34600111222@c.us',\n    'title' => 'Pedido inicial',\n    'amount' => 1500\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Create a deal from a chat\nimport requests\n\nurl = \"https://api.wassenger.com/v1/deals\"\n\npayload = {\n    \"pipeline\": \"5f7b1b1b1b1b1b1b1b1b1b1b\",\n    \"device\": \"5f7b1b1b1b1b1b1b1b1b1b1c\",\n    \"contactWid\": \"34600111222@c.us\",\n    \"chatWid\": \"34600111222@c.us\",\n    \"title\": \"Pedido inicial\",\n    \"amount\": 1500\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create a deal from a chat\nconst url = 'https://api.wassenger.com/v1/deals';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"pipeline\":\"5f7b1b1b1b1b1b1b1b1b1b1b\",\"device\":\"5f7b1b1b1b1b1b1b1b1b1b1c\",\"contactWid\":\"34600111222@c.us\",\"chatWid\":\"34600111222@c.us\",\"title\":\"Pedido inicial\",\"amount\":1500}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create a deal from a chat\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/deals',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"pipeline\":\"5f7b1b1b1b1b1b1b1b1b1b1b\",\"device\":\"5f7b1b1b1b1b1b1b1b1b1b1c\",\"contactWid\":\"34600111222@c.us\",\"chatWid\":\"34600111222@c.us\",\"title\":\"Pedido inicial\",\"amount\":1500}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Create a deal from a chat\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/deals\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"pipeline\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\",\\\"device\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1c\\\",\\\"contactWid\\\":\\\"34600111222@c.us\\\",\\\"chatWid\\\":\\\"34600111222@c.us\\\",\\\"title\\\":\\\"Pedido inicial\\\",\\\"amount\\\":1500}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Create a deal from a chat\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/deals\"\n\n\tpayload := strings.NewReader(\"{\\\"pipeline\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\",\\\"device\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1c\\\",\\\"contactWid\\\":\\\"34600111222@c.us\\\",\\\"chatWid\\\":\\\"34600111222@c.us\\\",\\\"title\\\":\\\"Pedido inicial\\\",\\\"amount\\\":1500}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Create a deal from a chat\nvar client = new RestClient(\"https://api.wassenger.com/v1/deals\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"pipeline\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\",\\\"device\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1c\\\",\\\"contactWid\\\":\\\"34600111222@c.us\\\",\\\"chatWid\\\":\\\"34600111222@c.us\\\",\\\"title\\\":\\\"Pedido inicial\\\",\\\"amount\\\":1500}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Create a deal from a chat\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/deals\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"pipeline\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\",\\\"device\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1c\\\",\\\"contactWid\\\":\\\"34600111222@c.us\\\",\\\"chatWid\\\":\\\"34600111222@c.us\\\",\\\"title\\\":\\\"Pedido inicial\\\",\\\"amount\\\":1500}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Create a deal from a chat\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/deals\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"pipeline\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\",\\\"device\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1c\\\",\\\"contactWid\\\":\\\"34600111222@c.us\\\",\\\"chatWid\\\":\\\"34600111222@c.us\\\",\\\"title\\\":\\\"Pedido inicial\\\",\\\"amount\\\":1500}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Create a deal from a chat\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"pipeline\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\",\\\"device\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1c\\\",\\\"contactWid\\\":\\\"34600111222@c.us\\\",\\\"chatWid\\\":\\\"34600111222@c.us\\\",\\\"title\\\":\\\"Pedido inicial\\\",\\\"amount\\\":1500}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/deals\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Create a deal from a chat\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/deals\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"pipeline\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\",\\\"device\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1c\\\",\\\"contactWid\\\":\\\"34600111222@c.us\\\",\\\"chatWid\\\":\\\"34600111222@c.us\\\",\\\"title\\\":\\\"Pedido inicial\\\",\\\"amount\\\":1500}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Create a deal from a chat\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/deals' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"pipeline\":\"5f7b1b1b1b1b1b1b1b1b1b1b\",\"device\":\"5f7b1b1b1b1b1b1b1b1b1b1c\",\"contactWid\":\"34600111222@c.us\",\"chatWid\":\"34600111222@c.us\",\"title\":\"Pedido inicial\",\"amount\":1500}'"},{"lang":"ObjC","source":"// Create a deal from a chat\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"pipeline\": @\"5f7b1b1b1b1b1b1b1b1b1b1b\",\n                              @\"device\": @\"5f7b1b1b1b1b1b1b1b1b1b1c\",\n                              @\"contactWid\": @\"34600111222@c.us\",\n                              @\"chatWid\": @\"34600111222@c.us\",\n                              @\"title\": @\"Pedido inicial\",\n                              @\"amount\": @1500 };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/deals\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Create a deal from a chat\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"pipeline\": \"5f7b1b1b1b1b1b1b1b1b1b1b\",\n  \"device\": \"5f7b1b1b1b1b1b1b1b1b1b1c\",\n  \"contactWid\": \"34600111222@c.us\",\n  \"chatWid\": \"34600111222@c.us\",\n  \"title\": \"Pedido inicial\",\n  \"amount\": 1500\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/deals\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/campaigns":{"parameters":[],"get":{"summary":"Get campaigns","description":"Retrieve campaigns, optionally filtered by search parameters\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fcampaigns&params=%5B%7B%22key%22%3A%22size%22%2C%22value%22%3A50%7D%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getCampaigns","security":[{"apiKey":[]}],"tags":["Campaigns"],"produces":["application/json"],"parameters":[{"in":"query","name":"before","type":"string","format":"date-time","description":"Start date in ISO 8601 format. Example: `2023-01-15T00:00:00.000Z`"},{"in":"query","name":"after","type":"string","format":"date-time","description":"End date in ISO 8601 format. Example: `2023-02-15T00:00:00.000Z`"},{"in":"query","name":"status","type":"array","minItems":1,"maxItems":10,"collectionFormat":"csv","description":"Filter by campaign status","items":{"type":"string","enum":["removed","failed","archived","canceled","incomplete","draft","paused","pending","processing","processed"]}},{"in":"query","name":"device","type":"array","minItems":1,"maxItems":10,"collectionFormat":"csv","description":"Filter by WhatsApp device IDs","items":{"type":"string","maxLength":24,"minLength":24,"pattern":"^[0-9A-Fa-f]{24}$"}},{"in":"query","name":"owner","type":"array","collectionFormat":"csv","description":"Filter by owner user IDs","maxItems":10,"items":{"type":"string","maxLength":24,"minLength":24,"pattern":"^[0-9A-Fa-f]{24}$"}},{"in":"query","name":"id","type":"array","collectionFormat":"csv","description":"Filter by campaign IDs","maxItems":30,"items":{"type":"string","maxLength":24,"minLength":24,"pattern":"^[0-9A-Fa-f]{24}$"}},{"in":"query","type":"array","name":"phone","description":"Filter campaigns by recipient phone numbers. Multiple values allowed separated by commas. E.g: `+1234567890`","items":{"type":"string","maxLength":18,"minLength":8},"maxItems":30},{"in":"query","type":"array","name":"group","description":"Filter campaigns by recipient group chats. Multiple values allowed separated by commas E.g: `123456789000000000@g.us`","items":{"type":"string","maxLength":40,"minLength":10},"maxItems":30},{"in":"query","name":"size","type":"number","default":50,"maximum":100,"minimum":1,"description":"Results size per request"},{"in":"query","name":"page","type":"number","default":0,"maximum":100,"minimum":0,"description":"Results page number to browser sequences of entries"},{"in":"query","name":"sort","type":"string","default":"date:desc","enum":["date:desc","date:asc"],"description":"Results sorting criteria by campaign creation date"}],"responses":{"200":{"description":"Campaigns","schema":{"type":"array","items":{"$ref":"#/definitions/campaign"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Retrieve recent campaigns\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/campaigns?size=50' \\\n  --header 'Token: <api token goes here>'\n\n\n// Retrieve campaigns per WhatsApp device\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/campaigns?device={{device.id}}%3E' \\\n  --header 'Token: <api token goes here>'\n\n\n// Retrieve campaigns per status\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/campaigns?status=pending%2Cprocessing%2Cpending%2Cdraft%2Cprocessed' \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Retrieve recent campaigns\nhttp GET 'https://api.wassenger.com/v1/campaigns?size=50' \\\n  Token:'<api token goes here>'\n\n\n// Retrieve campaigns per WhatsApp device\nhttp GET 'https://api.wassenger.com/v1/campaigns?device={{device.id}}%3E' \\\n  Token:'<api token goes here>'\n\n\n// Retrieve campaigns per status\nhttp GET 'https://api.wassenger.com/v1/campaigns?status=pending%2Cprocessing%2Cpending%2Cdraft%2Cprocessed' \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Retrieve recent campaigns\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/campaigns?size=50';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Retrieve campaigns per WhatsApp device\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/campaigns?device={{device.id}}%3E';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Retrieve campaigns per status\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/campaigns?status=pending%2Cprocessing%2Cpending%2Cdraft%2Cprocessed';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Retrieve recent campaigns\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/campaigns',\n  params: {size: '50'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Retrieve campaigns per WhatsApp device\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/campaigns',\n  params: {device: '{{device.id}}>'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Retrieve campaigns per status\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/campaigns',\n  params: {status: 'pending,processing,pending,draft,processed'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Retrieve recent campaigns\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/campaigns');\n\nreq.query({\n  size: '50'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Retrieve campaigns per WhatsApp device\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/campaigns');\n\nreq.query({\n  device: '{{device.id}}>'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Retrieve campaigns per status\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/campaigns');\n\nreq.query({\n  status: 'pending,processing,pending,draft,processed'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Retrieve recent campaigns\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/campaigns?size=50', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Retrieve campaigns per WhatsApp device\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/campaigns?device={{device.id}}%3E', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Retrieve campaigns per status\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/campaigns?status=pending%2Cprocessing%2Cpending%2Cdraft%2Cprocessed', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Retrieve recent campaigns\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/campaigns');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'size' => '50'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Retrieve campaigns per WhatsApp device\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/campaigns');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'device' => '{{device.id}}>'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Retrieve campaigns per status\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/campaigns');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'status' => 'pending,processing,pending,draft,processed'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Retrieve recent campaigns\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/campaigns?size=50\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Retrieve campaigns per WhatsApp device\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/campaigns?device={{device.id}}%3E\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Retrieve campaigns per status\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/campaigns?status=pending%2Cprocessing%2Cpending%2Cdraft%2Cprocessed\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Retrieve recent campaigns\nimport requests\n\nurl = \"https://api.wassenger.com/v1/campaigns\"\n\nquerystring = {\"size\":\"50\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Retrieve campaigns per WhatsApp device\nimport requests\n\nurl = \"https://api.wassenger.com/v1/campaigns\"\n\nquerystring = {\"device\":\"{{device.id}}>\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Retrieve campaigns per status\nimport requests\n\nurl = \"https://api.wassenger.com/v1/campaigns\"\n\nquerystring = {\"status\":\"pending,processing,pending,draft,processed\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Retrieve recent campaigns\nconst url = 'https://api.wassenger.com/v1/campaigns?size=50';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Retrieve campaigns per WhatsApp device\nconst url = 'https://api.wassenger.com/v1/campaigns?device={{device.id}}%3E';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Retrieve campaigns per status\nconst url = 'https://api.wassenger.com/v1/campaigns?status=pending%2Cprocessing%2Cpending%2Cdraft%2Cprocessed';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Retrieve recent campaigns\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/campaigns?size=50',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Retrieve campaigns per WhatsApp device\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/campaigns?device={{device.id}}%3E',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Retrieve campaigns per status\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/campaigns?status=pending%2Cprocessing%2Cpending%2Cdraft%2Cprocessed',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Retrieve recent campaigns\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/campaigns?size=50\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Retrieve campaigns per WhatsApp device\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/campaigns?device={{device.id}}%3E\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Retrieve campaigns per status\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/campaigns?status=pending%2Cprocessing%2Cpending%2Cdraft%2Cprocessed\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Retrieve recent campaigns\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/campaigns?size=50\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Retrieve campaigns per WhatsApp device\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/campaigns?device={{device.id}}%3E\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Retrieve campaigns per status\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/campaigns?status=pending%2Cprocessing%2Cpending%2Cdraft%2Cprocessed\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Retrieve recent campaigns\nvar client = new RestClient(\"https://api.wassenger.com/v1/campaigns?size=50\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Retrieve campaigns per WhatsApp device\nvar client = new RestClient(\"https://api.wassenger.com/v1/campaigns?device={{device.id}}%3E\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Retrieve campaigns per status\nvar client = new RestClient(\"https://api.wassenger.com/v1/campaigns?status=pending%2Cprocessing%2Cpending%2Cdraft%2Cprocessed\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Retrieve recent campaigns\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/campaigns?size=50\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Retrieve campaigns per WhatsApp device\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/campaigns?device={{device.id}}%3E\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Retrieve campaigns per status\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/campaigns?status=pending%2Cprocessing%2Cpending%2Cdraft%2Cprocessed\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Retrieve recent campaigns\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/campaigns?size=50\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Retrieve campaigns per WhatsApp device\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/campaigns?device={{device.id}}%3E\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Retrieve campaigns per status\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/campaigns?status=pending%2Cprocessing%2Cpending%2Cdraft%2Cprocessed\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Retrieve recent campaigns\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/campaigns?size=50\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Retrieve campaigns per WhatsApp device\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/campaigns?device={{device.id}}%3E\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Retrieve campaigns per status\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/campaigns?status=pending%2Cprocessing%2Cpending%2Cdraft%2Cprocessed\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Retrieve recent campaigns\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/campaigns?size=50\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Retrieve campaigns per WhatsApp device\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/campaigns?device={{device.id}}%3E\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Retrieve campaigns per status\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/campaigns?status=pending%2Cprocessing%2Cpending%2Cdraft%2Cprocessed\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Retrieve recent campaigns\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/campaigns?size=50' -Method GET -Headers $headers\n\n\n# Retrieve campaigns per WhatsApp device\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/campaigns?device={{device.id}}%3E' -Method GET -Headers $headers\n\n\n# Retrieve campaigns per status\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/campaigns?status=pending%2Cprocessing%2Cpending%2Cdraft%2Cprocessed' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Retrieve recent campaigns\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/campaigns?size=50\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Retrieve campaigns per WhatsApp device\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/campaigns?device={{device.id}}%3E\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Retrieve campaigns per status\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/campaigns?status=pending%2Cprocessing%2Cpending%2Cdraft%2Cprocessed\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Retrieve recent campaigns\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/campaigns?size=50\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Retrieve campaigns per WhatsApp device\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/campaigns?device={{device.id}}%3E\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Retrieve campaigns per status\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/campaigns?status=pending%2Cprocessing%2Cpending%2Cdraft%2Cprocessed\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"post":{"summary":"Create campaign","description":"Creates a new message campaign to be delivered to a list of recipients through a specific WhatsApp number.\n\n\n\nThe `name` field is required and identifies the new campaign with an alias.\n\nThe `device` field is required and must be a valid WhatsApp device ID connected in your account.\n\n\n\nNote campaigns are not automatically active when created, instead they are created in `draft` mode.\n\nOnce a campaign is created, you can add the target contacts, a message to send and finally activate it by updating the campaign status.\n\n\n\nCampaigns can only be delivered through a specific WhatsApp number (device). To send it through multiple WhatsApp numbers, you can repeat or clone the campaign for each target WhatsApp number connected in your account.\n\n\n\nCampaigns can be scheduled to be delivered at a specific date and time, or immediately after activation.\n\n\n\n**New feature**: you can optionally enable the native unsubscribe feature, allowing recipients to reply with a predefined word like `stop` to automatically unsubscribe from any future message campaigns. This feature is included in all current Platform plans: numbers on a Gateway or legacy plan need to upgrade to use it.\n\n\n\n**Limitations apply**: only one campaign per day can be delivered per WhatsApp number. Depending on your subscription plan, you can create from 5 to 30 campaings per month.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fcampaigns&method=POST&body=%7B%0A%20%20%22name%22%3A%20%22Campaign%20test%22%2C%0A%20%20%22device%22%3A%20%22%7B%7Bdevice.id%7D%7D%3E%22%2C%0A%20%20%22message%22%3A%20%22Dear%20%7B%7B%20name%20%7D%7D%2C%20this%20is%20a%20sample%20message%20campaign%20with%20template%20variables%22%2C%0A%20%20%22activate%22%3A%20false%2C%0A%20%20%22settings%22%3A%20%7B%0A%20%20%20%20%22date%22%3A%20%222026-11-13T09%3A42%3A45.829Z%22%2C%0A%20%20%20%20%22speed%22%3A%201%0A%20%20%7D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"createCampaign","security":[{"apiKey":[]}],"tags":["Campaigns"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"campaign","description":"New campaign","schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":50,"description":"Campaign name. Required."},"device":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"WhatsApp target device ID to be used for the campaign messages delivery"},"message":{"type":"string","minLength":2,"maxLength":10000,"description":"Optional. General message to be sent in the campaign. If not specified, the campaign message will be used instead. Message can use [template variables](/help/templates) and [WhatsApp text-rich syntax](/help/text-format) to format the message."},"template":{"type":"object","properties":{"name":{"type":"string","pattern":"^[a-z0-9_]+$","maxLength":512,"description":"Template name (lowercase, alphanumeric and underscores only)"},"language":{"type":"string","maxLength":5,"minLength":2,"description":"Language code for the template. Example: `en_US`, `de_DE`, `es_MX`, etc."}},"required":["name"],"additionalProperties":false,"description":"WABA pre-approved template message to send. Required if `message` and `file` fields are empty. Only available in WABA enabled numbers."},"file":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Optional. Image, video or document file ID (`image/*`, `video/mp4`, or `application/pdf`) to be sent in every message in this campaign. **The file must be previously uploaded** using the [File Upload API](#tag/Files/operation/uploadFile). Set to `null` to remove the existing file."},"filename":{"type":"string","maxLength":50,"description":"Optional. Filename to be used when the user downloads the file. Only applicable to WABA API numbers."},"activate":{"type":"boolean","description":"Optional. Activate the campaign after updating it. If not specified, the campaign will remain in draft mode.\\n**Important**: only campaigns with a configured date and at least one contact can be activated, otherwise an error will be returned.","default":false},"settings":{"type":"object","properties":{"speed":{"type":"number","format":"float","minimum":0,"maximum":5,"enum":[0.025,0.0286,0.0333,0.04,0.05,0.0667,0.1,0.15,0.2,0.3,0.5,1,1.25,1.5,1.75,2,2.5,3,4,5],"description":"Campaign messages delivery speed per minute. To reduce risk of getting banned due to spam/bulk messaging, use 1 messages per minute or higher. Alternatively, for faster delivery use: `0.5` = 2 messages per minute, `0.3` = 3 messages per minute, `0.2` = 4 messages per minute"},"date":{"type":"string","format":"date-time","description":"Campaign delivery date and time in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. Example: `2024-01-15T14:00:00Z`. Time is by default based on your account time zone configuration, but you can override it by specifying a `timezone` field in the settings (see below)"},"expiration":{"type":"string","enum":["4h","8h","12h","24h","2d","3d","4d","5d","6d","7d","15d"],"description":"Optional. Campaign expiration time. Defaults to 3 days = `3d`. If the campaigns messages are not fully processed by the given time, the campaign will be automatically stopped and marked as `incomplete`. Example: `24h`"},"timezone":{"type":"string","minLength":1,"maxLength":100,"description":"Optional. Time zone to use. If not specified, your default account time zone will be used. Example: `America/New_York`. [See the list of allowed time zones values here](https://bit.ly/3wvIqJC)"}},"additionalProperties":false,"description":"Campaign settings such as delivery date and time, messages delivery speed, time zone, and allowed delivery hours"},"contacts":{"type":"array","items":{"type":"object","properties":{"phone":{"type":"string","minLength":6,"maxLength":16,"description":"Target contact phone number in E164 format. Example: `+1234567890`"},"group":{"type":"string","pattern":"^([0-9-]{15,30})(@g.us)?$","minLength":10,"maxLength":30,"description":"Target group chat WhatsApp ID. Example: `123456789000000000@g.us`"},"name":{"type":"string","maxLength":50,"description":"Optional. Target contact name. If not specified, the internal CRM contact name, if it exists, will be used instead. In case there is no contact available, the field will be empty"},"message":{"type":"string","minLength":2,"maxLength":10000,"description":"Optional. Message to be sent to the specific phone number. If not specified, the campaign message will be used instead. Message can use WhatsApp text-rich syntax to format the message."},"url":{"type":"string","maxLength":2048,"description":"Optional file URL header to be sent for this specific contact. Only applicable to WABA API numbers using template messages with a multimedia header. The URL must point to a valid image (`image/*`), video (`video/mp4`), or document file (`application/pdf`)."},"reference":{"type":"string","maxLength":200,"description":"Optional message reference identifier. The reference edentifier will be notified via webhook events. See the [webhooks documentation](/help/webhooks) for more information."},"source":{"type":"string","maxLength":20,"enum":["import","contacts"],"description":"Campaign recipients source. Use `import` for the file imported recipients via Excel/CSV/Google Sheets, or `contacts` for CRM loaded contacts source."},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-zA-Z0-9_]*$","minLength":1,"maxLength":50,"description":"Variable key name"},"value":{"type":"string","minLength":1,"maxLength":500,"description":"Variable value"},"component":{"type":"string","pattern":"^(body|header|header_location|button_url_\\d+|button_copy_code_\\d+)$","description":"Variable component type: body, header, header_location (for location headers), button_url_N (for dynamic URL buttons), or button_copy_code_N (for copy code buttons). If omitted, it is inferred from the variable key prefix (`header_*` -> header, `header_location_*` -> header_location, `button_url_N*` -> button_url_N, `button_copy_code_N*` -> button_copy_code_N), defaulting to `body`."}},"required":["key","value"],"additionalProperties":false},"maxItems":30,"description":"Optional list of variables to use in the message. Variables can be used to personalize the message content. See the [variables documentation](/help/template) for more details."}},"additionalProperties":false,"description":"Campaign target contact entry. You can specify either a `phone` or `group` field, but not both. If you specify a `group` field, the message will be sent to all participants in the group."},"minItems":0,"maxItems":2000},"actions":{"type":"array","items":{"type":"object","properties":{"action":{"type":"string","maxLength":50,"enum":["chat:assign","chat:unassign","chat:resolve","chat:unresolve","chat:read","chat:unread","labels:add","labels:set","labels:remove","metadata:add","metadata:set","metadata:remove"],"description":"Action command. See above the supported commands and params"},"params":{"type":"object","properties":{},"description":"Optional param to use per action. See the documentation above for further details about supported params per specific action command."}},"required":["action"],"additionalProperties":false},"maxItems":10,"description":"Optional list of actions to trigger after the message delivery.\n\n\n\nActions scope are limited to the chat/contact receiving the message.\n\n\n\nIf the message delivery fails, actions will be ignored.\n\n\n\n**Note**: this feature is only applicable to devices with multi-agent chat support.\n\n\n\n### Supported actions\n\n\n\n* **Action**: `chat:assign`\n* **Description**: Assign chat to an agent.\n* **Params**:\n  - **agent**: `string` (optional) - Required if `department` is not defined. Agent ID to assign the chat to after message delivery. You can retrieve the agents ID [from here](#operation/getDeviceAgents)\n  - **department**: `string` (optional) - Required if `agent` is not defined. Department ID to assign the chat to after message delivery. It can be together with `agent` field to assign a chat to both an agent and department. You can retrieve the department ID [from here](#operation/getDepartments)\n  - **assigner**: `string` (optional) - Optinoal. Agent ID who assigns the chat to the other agent\n----\n* **Action**: `chat:unassign`\n* **Description**: Unassign chat from existing agent\n* **Params**:\n  - **assigner**: `string` (optional) - Agent ID who assigns the chat to the other agent. You can retrieve the agents ID [from here](#operation/getDeviceAgents)\n----\n* **Action**: `chat:resolve`\n* **Description**: Resolve chat if not already resolved. Cannot be used along with `chat:unresolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `chat:unresolve`\n* **Description**: Unresolve chat if already resolved. Cannot be used along with `chat:resolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `chat:read`\n* **Description**: Mark the chat internally as read in the web chat interface after the message is delivered. Cannot be used along with `chat:resolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `chat:unread`\n* **Description**: Mark the chat internally as unread in the web chat interface after the message is delivered. Cannot be used along with `chat:resolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `labels:add`\n* **Description**: Add label(s) to the chat after the message is delivered\n* **Params**:\n  - **labels**: `array` (optional) - Label tags to add to the chat while keeping the existing ones. You can obtain a list of existing labels [querying this endpoint](#operation/getLabels)\n----\n* **Action**: `labels:remove`\n* **Description**: Remove label(s) from the chat, when already present, after the message is delivered\n* **Params**:\n  - **labels**: `array` (optional) - Label tags to remove from the chat. You can obtain a list of existing labels [querying this endpoint](#operation/getLabels)\n----\n* **Action**: `labels:set`\n* **Description**: Set and override label(s) in the chat after the message is delivered\n* **Params**:\n  - **labels**: `array` (optional) - Label tags to set and override in the chat. You can obtain a list of existing labels [querying this endpoint](#operation/getLabels)\n----\n* **Action**: `metadata:set`\n* **Description**: Set and override metadata key-value entries in the target chat's contact entity after the message is delivered\n* **Params**:\n  - **metadata**: `array` (optional) - Metadata entries with `key` and `value` properties to set and override in the chat's contact\n----\n* **Action**: `metadata:add`\n* **Description**: Add or override by `key` field existing metadata key-value entries in the target chat's contact entity after the message is delivered\n* **Params**:\n  - **metadata**: `array` (optional) - Metadata entries with `key` and `value` properties to append in the chat's contact\n----\n* **Action**: `metadata:remove`\n* **Description**: Remove existing metadata entries by `key` field in the target chat's contact entity after the message is delivered\n* **Params**:\n  - **keys**: `array` (optional) - Metadata entries to remove by `key` in the chat's contact"},"unsubscribe":{"type":"object","properties":{"active":{"type":"boolean","description":"Set `true` to enable automatic campaigns opt-out feature. If enabled, users can reply a pre-defined word to stop receiving messages from the campaign. **Note**: this feature is included in all current Platform plans.","default":false},"word":{"type":"string","minLength":2,"maxLength":30,"description":"Unsubscribe word to stop receiving messages from the campaign. If not specified, the default word `stop` will be used."},"message":{"type":"string","minLength":10,"maxLength":500,"description":"Unsubscribe message to append at the end of the campaign message to inform recipients how to unsubscribe from future campaigns. The message must contain a value specificed in the `word` field or `stop` as part of the message text. Required when `active` is `true`. Example message: `Reply *stop* to unsubscribe`. **Note**: message is ignored when sending WABA templates due to pre-approved content restrictions, instead you can add unsubscribe message in the template message footer."},"actions":{"type":"array","items":{"type":"object","properties":{"action":{"type":"string","maxLength":50,"enum":["chat:assign","chat:unassign","chat:resolve","chat:unresolve","chat:read","chat:unread","labels:add","labels:set","labels:remove","metadata:add","metadata:set","metadata:remove","message:send"],"description":"Action command. See above the supported commands and params"},"params":{"type":"object","properties":{},"description":"Optional params to use per action. See the documentation above for further details about supported params per specific action command."}},"required":["action"],"additionalProperties":false},"maxItems":10,"description":"Optional list of actions to trigger after the user replies unsubscribes. \n\n\n\nActions will only be executed on the specific chat that triggered the unsubscribe feature replying with the specific word, e.g: `stop`.\n\n\n\n**Note**: this feature is only applicable if the campaign has the unsubscribe feature enabled, which is included in all current Platform plans.\n\n\n\n### Supported actions\n\n\n\n* **Action**: `message:send`\n* **Description**: Send an automated message to confirm the user has opted-out successfully. This action is limited to campaigns with the opt-out feature enabled.\n* **Params**:\n  - **message**: `string` (optional) - Message text to send as a reply automated action\n----\n* **Action**: `chat:assign`\n* **Description**: Assign chat to an agent.\n* **Params**:\n  - **agent**: `string` (optional) - Required if `department` is not defined. Agent ID to assign the chat to after message delivery. You can retrieve the agents ID [from here](#operation/getDeviceAgents)\n  - **department**: `string` (optional) - Required if `agent` is not defined. Department ID to assign the chat to after message delivery. It can be together with `agent` field to assign a chat to both an agent and department. You can retrieve the department ID [from here](#operation/getDepartments)\n  - **assigner**: `string` (optional) - Optinoal. Agent ID who assigns the chat to the other agent\n----\n* **Action**: `chat:unassign`\n* **Description**: Unassign chat from existing agent\n* **Params**:\n  - **assigner**: `string` (optional) - Agent ID who assigns the chat to the other agent. You can retrieve the agents ID [from here](#operation/getDeviceAgents)\n----\n* **Action**: `chat:resolve`\n* **Description**: Resolve chat if not already resolved. Cannot be used along with `chat:unresolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `chat:unresolve`\n* **Description**: Unresolve chat if already resolved. Cannot be used along with `chat:resolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `chat:read`\n* **Description**: Mark the chat internally as read in the web chat interface after the message is delivered. Cannot be used along with `chat:resolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `chat:unread`\n* **Description**: Mark the chat internally as unread in the web chat interface after the message is delivered. Cannot be used along with `chat:resolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `labels:add`\n* **Description**: Add label(s) to the chat after the message is delivered\n* **Params**:\n  - **labels**: `array` (optional) - Label tags to add to the chat while keeping the existing ones. You can obtain a list of existing labels [querying this endpoint](#operation/getLabels)\n----\n* **Action**: `labels:remove`\n* **Description**: Remove label(s) from the chat, when already present, after the message is delivered\n* **Params**:\n  - **labels**: `array` (optional) - Label tags to remove from the chat. You can obtain a list of existing labels [querying this endpoint](#operation/getLabels)\n----\n* **Action**: `labels:set`\n* **Description**: Set and override label(s) in the chat after the message is delivered\n* **Params**:\n  - **labels**: `array` (optional) - Label tags to set and override in the chat. You can obtain a list of existing labels [querying this endpoint](#operation/getLabels)\n----\n* **Action**: `metadata:set`\n* **Description**: Set and override metadata key-value entries in the target chat's contact entity after the message is delivered\n* **Params**:\n  - **metadata**: `array` (optional) - Metadata entries with `key` and `value` properties to set and override in the chat's contact\n----\n* **Action**: `metadata:add`\n* **Description**: Add or override by `key` field existing metadata key-value entries in the target chat's contact entity after the message is delivered\n* **Params**:\n  - **metadata**: `array` (optional) - Metadata entries with `key` and `value` properties to append in the chat's contact\n----\n* **Action**: `metadata:remove`\n* **Description**: Remove existing metadata entries by `key` field in the target chat's contact entity after the message is delivered\n* **Params**:\n  - **keys**: `array` (optional) - Metadata entries to remove by `key` in the chat's contact"}},"additionalProperties":false,"description":"Optionally allow users to unsubscribe from the campaign messages. If enabled, users can reply a pre-defined word to stop receiving messages from in future campaigns."}},"required":["name","device"],"additionalProperties":false}}],"responses":{"200":{"description":"New campaign created","schema":{"type":"object","$ref":"#/definitions/campaign"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Create new campaign\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/campaigns \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"name\":\"Campaign test\",\"device\":\"{{device.id}}>\",\"message\":\"Dear {{ name }}, this is a sample message campaign with template variables\",\"activate\":false,\"settings\":{\"date\":\"2026-11-13T09:42:45.829Z\",\"speed\":1}}'\n\n\n// Create new campaign with contacts and different message per recipient\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/campaigns \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"name\":\"Campaign with contacts\",\"device\":\"{{device.id}}>\",\"activate\":true,\"contacts\":[{\"phone\":\"+1234567890\",\"name\":\"John\",\"message\":\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\",\"variables\":[{\"key\":\"address\",\"value\":\"123 Main St, New York, NY 10030\"}]},{\"phone\":\"+1234567890\",\"name\":\"Mary\",\"message\":\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\",\"variables\":[{\"key\":\"support_phone\",\"value\":\"+19402930131\"}]},{\"phone\":\"+1234567890\",\"name\":\"Elisabeth\",\"message\":\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\",\"variables\":[{\"key\":\"order\",\"value\":\"9582311\"},{\"key\":\"rate_url\",\"value\":\"https://company.com/rate?order=9582311\"}]}],\"settings\":{\"date\":\"2026-11-13T09:42:45.829Z\",\"speed\":1}}'\n\n\n// Create new campaign with unsubscribe feature\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/campaigns \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"name\":\"Campaign with contacts\",\"device\":\"{{device.id}}>\",\"activate\":true,\"unsubscribe\":{\"active\":true,\"word\":\"stop\",\"message\":\"Reply *{{word}}** to unsubscribe\",\"actions\":[{\"action\":\"message:send\",\"params\":{\"message\":\"You’ve successfully unsubscribed and won’t receive any more communications.\"}},{\"action\":\"metadata:add\",\"params\":{\"metadata\":[{\"key\":\"unsubscribed\",\"value\":\"true\"}]}}]},\"contacts\":[{\"phone\":\"+1234567890\",\"name\":\"John\",\"message\":\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\",\"variables\":[{\"key\":\"address\",\"value\":\"123 Main St, New York, NY 10030\"}]},{\"phone\":\"+1234567890\",\"name\":\"Mary\",\"message\":\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\",\"variables\":[{\"key\":\"support_phone\",\"value\":\"+19402930131\"}]},{\"phone\":\"+1234567890\",\"name\":\"Elisabeth\",\"message\":\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\",\"variables\":[{\"key\":\"order\",\"value\":\"9582311\"},{\"key\":\"rate_url\",\"value\":\"https://company.com/rate?order=9582311\"}]}],\"settings\":{\"date\":\"2026-11-13T09:42:45.829Z\",\"speed\":1}}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Create new campaign\necho '{\"name\":\"Campaign test\",\"device\":\"{{device.id}}>\",\"message\":\"Dear {{ name }}, this is a sample message campaign with template variables\",\"activate\":false,\"settings\":{\"date\":\"2026-11-13T09:42:45.829Z\",\"speed\":1}}' |  \\\n  http POST https://api.wassenger.com/v1/campaigns \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Create new campaign with contacts and different message per recipient\necho '{\"name\":\"Campaign with contacts\",\"device\":\"{{device.id}}>\",\"activate\":true,\"contacts\":[{\"phone\":\"+1234567890\",\"name\":\"John\",\"message\":\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\",\"variables\":[{\"key\":\"address\",\"value\":\"123 Main St, New York, NY 10030\"}]},{\"phone\":\"+1234567890\",\"name\":\"Mary\",\"message\":\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\",\"variables\":[{\"key\":\"support_phone\",\"value\":\"+19402930131\"}]},{\"phone\":\"+1234567890\",\"name\":\"Elisabeth\",\"message\":\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\",\"variables\":[{\"key\":\"order\",\"value\":\"9582311\"},{\"key\":\"rate_url\",\"value\":\"https://company.com/rate?order=9582311\"}]}],\"settings\":{\"date\":\"2026-11-13T09:42:45.829Z\",\"speed\":1}}' |  \\\n  http POST https://api.wassenger.com/v1/campaigns \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Create new campaign with unsubscribe feature\necho '{\"name\":\"Campaign with contacts\",\"device\":\"{{device.id}}>\",\"activate\":true,\"unsubscribe\":{\"active\":true,\"word\":\"stop\",\"message\":\"Reply *{{word}}** to unsubscribe\",\"actions\":[{\"action\":\"message:send\",\"params\":{\"message\":\"You’ve successfully unsubscribed and won’t receive any more communications.\"}},{\"action\":\"metadata:add\",\"params\":{\"metadata\":[{\"key\":\"unsubscribed\",\"value\":\"true\"}]}}]},\"contacts\":[{\"phone\":\"+1234567890\",\"name\":\"John\",\"message\":\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\",\"variables\":[{\"key\":\"address\",\"value\":\"123 Main St, New York, NY 10030\"}]},{\"phone\":\"+1234567890\",\"name\":\"Mary\",\"message\":\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\",\"variables\":[{\"key\":\"support_phone\",\"value\":\"+19402930131\"}]},{\"phone\":\"+1234567890\",\"name\":\"Elisabeth\",\"message\":\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\",\"variables\":[{\"key\":\"order\",\"value\":\"9582311\"},{\"key\":\"rate_url\",\"value\":\"https://company.com/rate?order=9582311\"}]}],\"settings\":{\"date\":\"2026-11-13T09:42:45.829Z\",\"speed\":1}}' |  \\\n  http POST https://api.wassenger.com/v1/campaigns \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Create new campaign\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/campaigns';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"Campaign test\",\"device\":\"{{device.id}}>\",\"message\":\"Dear {{ name }}, this is a sample message campaign with template variables\",\"activate\":false,\"settings\":{\"date\":\"2026-11-13T09:42:45.829Z\",\"speed\":1}}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Create new campaign with contacts and different message per recipient\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/campaigns';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"Campaign with contacts\",\"device\":\"{{device.id}}>\",\"activate\":true,\"contacts\":[{\"phone\":\"+1234567890\",\"name\":\"John\",\"message\":\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\",\"variables\":[{\"key\":\"address\",\"value\":\"123 Main St, New York, NY 10030\"}]},{\"phone\":\"+1234567890\",\"name\":\"Mary\",\"message\":\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\",\"variables\":[{\"key\":\"support_phone\",\"value\":\"+19402930131\"}]},{\"phone\":\"+1234567890\",\"name\":\"Elisabeth\",\"message\":\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\",\"variables\":[{\"key\":\"order\",\"value\":\"9582311\"},{\"key\":\"rate_url\",\"value\":\"https://company.com/rate?order=9582311\"}]}],\"settings\":{\"date\":\"2026-11-13T09:42:45.829Z\",\"speed\":1}}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Create new campaign with unsubscribe feature\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/campaigns';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"Campaign with contacts\",\"device\":\"{{device.id}}>\",\"activate\":true,\"unsubscribe\":{\"active\":true,\"word\":\"stop\",\"message\":\"Reply *{{word}}** to unsubscribe\",\"actions\":[{\"action\":\"message:send\",\"params\":{\"message\":\"You’ve successfully unsubscribed and won’t receive any more communications.\"}},{\"action\":\"metadata:add\",\"params\":{\"metadata\":[{\"key\":\"unsubscribed\",\"value\":\"true\"}]}}]},\"contacts\":[{\"phone\":\"+1234567890\",\"name\":\"John\",\"message\":\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\",\"variables\":[{\"key\":\"address\",\"value\":\"123 Main St, New York, NY 10030\"}]},{\"phone\":\"+1234567890\",\"name\":\"Mary\",\"message\":\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\",\"variables\":[{\"key\":\"support_phone\",\"value\":\"+19402930131\"}]},{\"phone\":\"+1234567890\",\"name\":\"Elisabeth\",\"message\":\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\",\"variables\":[{\"key\":\"order\",\"value\":\"9582311\"},{\"key\":\"rate_url\",\"value\":\"https://company.com/rate?order=9582311\"}]}],\"settings\":{\"date\":\"2026-11-13T09:42:45.829Z\",\"speed\":1}}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Create new campaign\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/campaigns',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    name: 'Campaign test',\n    device: '{{device.id}}>',\n    message: 'Dear {{ name }}, this is a sample message campaign with template variables',\n    activate: false,\n    settings: {date: '2026-11-13T09:42:45.829Z', speed: 1}\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Create new campaign with contacts and different message per recipient\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/campaigns',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    name: 'Campaign with contacts',\n    device: '{{device.id}}>',\n    activate: true,\n    contacts: [\n      {\n        phone: '+1234567890',\n        name: 'John',\n        message: 'Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}',\n        variables: [{key: 'address', value: '123 Main St, New York, NY 10030'}]\n      },\n      {\n        phone: '+1234567890',\n        name: 'Mary',\n        message: 'Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}',\n        variables: [{key: 'support_phone', value: '+19402930131'}]\n      },\n      {\n        phone: '+1234567890',\n        name: 'Elisabeth',\n        message: 'Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}',\n        variables: [\n          {key: 'order', value: '9582311'},\n          {key: 'rate_url', value: 'https://company.com/rate?order=9582311'}\n        ]\n      }\n    ],\n    settings: {date: '2026-11-13T09:42:45.829Z', speed: 1}\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Create new campaign with unsubscribe feature\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/campaigns',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    name: 'Campaign with contacts',\n    device: '{{device.id}}>',\n    activate: true,\n    unsubscribe: {\n      active: true,\n      word: 'stop',\n      message: 'Reply *{{word}}** to unsubscribe',\n      actions: [\n        {\n          action: 'message:send',\n          params: {\n            message: 'You’ve successfully unsubscribed and won’t receive any more communications.'\n          }\n        },\n        {\n          action: 'metadata:add',\n          params: {metadata: [{key: 'unsubscribed', value: 'true'}]}\n        }\n      ]\n    },\n    contacts: [\n      {\n        phone: '+1234567890',\n        name: 'John',\n        message: 'Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}',\n        variables: [{key: 'address', value: '123 Main St, New York, NY 10030'}]\n      },\n      {\n        phone: '+1234567890',\n        name: 'Mary',\n        message: 'Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}',\n        variables: [{key: 'support_phone', value: '+19402930131'}]\n      },\n      {\n        phone: '+1234567890',\n        name: 'Elisabeth',\n        message: 'Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}',\n        variables: [\n          {key: 'order', value: '9582311'},\n          {key: 'rate_url', value: 'https://company.com/rate?order=9582311'}\n        ]\n      }\n    ],\n    settings: {date: '2026-11-13T09:42:45.829Z', speed: 1}\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Create new campaign\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/campaigns');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  name: 'Campaign test',\n  device: '{{device.id}}>',\n  message: 'Dear {{ name }}, this is a sample message campaign with template variables',\n  activate: false,\n  settings: {\n    date: '2026-11-13T09:42:45.829Z',\n    speed: 1\n  }\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Create new campaign with contacts and different message per recipient\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/campaigns');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  name: 'Campaign with contacts',\n  device: '{{device.id}}>',\n  activate: true,\n  contacts: [\n    {\n      phone: '+1234567890',\n      name: 'John',\n      message: 'Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}',\n      variables: [\n        {\n          key: 'address',\n          value: '123 Main St, New York, NY 10030'\n        }\n      ]\n    },\n    {\n      phone: '+1234567890',\n      name: 'Mary',\n      message: 'Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}',\n      variables: [\n        {\n          key: 'support_phone',\n          value: '+19402930131'\n        }\n      ]\n    },\n    {\n      phone: '+1234567890',\n      name: 'Elisabeth',\n      message: 'Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}',\n      variables: [\n        {\n          key: 'order',\n          value: '9582311'\n        },\n        {\n          key: 'rate_url',\n          value: 'https://company.com/rate?order=9582311'\n        }\n      ]\n    }\n  ],\n  settings: {\n    date: '2026-11-13T09:42:45.829Z',\n    speed: 1\n  }\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Create new campaign with unsubscribe feature\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/campaigns');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  name: 'Campaign with contacts',\n  device: '{{device.id}}>',\n  activate: true,\n  unsubscribe: {\n    active: true,\n    word: 'stop',\n    message: 'Reply *{{word}}** to unsubscribe',\n    actions: [\n      {\n        action: 'message:send',\n        params: {\n          message: 'You’ve successfully unsubscribed and won’t receive any more communications.'\n        }\n      },\n      {\n        action: 'metadata:add',\n        params: {\n          metadata: [\n            {\n              key: 'unsubscribed',\n              value: 'true'\n            }\n          ]\n        }\n      }\n    ]\n  },\n  contacts: [\n    {\n      phone: '+1234567890',\n      name: 'John',\n      message: 'Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}',\n      variables: [\n        {\n          key: 'address',\n          value: '123 Main St, New York, NY 10030'\n        }\n      ]\n    },\n    {\n      phone: '+1234567890',\n      name: 'Mary',\n      message: 'Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}',\n      variables: [\n        {\n          key: 'support_phone',\n          value: '+19402930131'\n        }\n      ]\n    },\n    {\n      phone: '+1234567890',\n      name: 'Elisabeth',\n      message: 'Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}',\n      variables: [\n        {\n          key: 'order',\n          value: '9582311'\n        },\n        {\n          key: 'rate_url',\n          value: 'https://company.com/rate?order=9582311'\n        }\n      ]\n    }\n  ],\n  settings: {\n    date: '2026-11-13T09:42:45.829Z',\n    speed: 1\n  }\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Create new campaign\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/campaigns', [\n  'body' => '{\"name\":\"Campaign test\",\"device\":\"{{device.id}}>\",\"message\":\"Dear {{ name }}, this is a sample message campaign with template variables\",\"activate\":false,\"settings\":{\"date\":\"2026-11-13T09:42:45.829Z\",\"speed\":1}}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Create new campaign with contacts and different message per recipient\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/campaigns', [\n  'body' => '{\"name\":\"Campaign with contacts\",\"device\":\"{{device.id}}>\",\"activate\":true,\"contacts\":[{\"phone\":\"+1234567890\",\"name\":\"John\",\"message\":\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\",\"variables\":[{\"key\":\"address\",\"value\":\"123 Main St, New York, NY 10030\"}]},{\"phone\":\"+1234567890\",\"name\":\"Mary\",\"message\":\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\",\"variables\":[{\"key\":\"support_phone\",\"value\":\"+19402930131\"}]},{\"phone\":\"+1234567890\",\"name\":\"Elisabeth\",\"message\":\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\",\"variables\":[{\"key\":\"order\",\"value\":\"9582311\"},{\"key\":\"rate_url\",\"value\":\"https://company.com/rate?order=9582311\"}]}],\"settings\":{\"date\":\"2026-11-13T09:42:45.829Z\",\"speed\":1}}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Create new campaign with unsubscribe feature\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/campaigns', [\n  'body' => '{\"name\":\"Campaign with contacts\",\"device\":\"{{device.id}}>\",\"activate\":true,\"unsubscribe\":{\"active\":true,\"word\":\"stop\",\"message\":\"Reply *{{word}}** to unsubscribe\",\"actions\":[{\"action\":\"message:send\",\"params\":{\"message\":\"You’ve successfully unsubscribed and won’t receive any more communications.\"}},{\"action\":\"metadata:add\",\"params\":{\"metadata\":[{\"key\":\"unsubscribed\",\"value\":\"true\"}]}}]},\"contacts\":[{\"phone\":\"+1234567890\",\"name\":\"John\",\"message\":\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\",\"variables\":[{\"key\":\"address\",\"value\":\"123 Main St, New York, NY 10030\"}]},{\"phone\":\"+1234567890\",\"name\":\"Mary\",\"message\":\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\",\"variables\":[{\"key\":\"support_phone\",\"value\":\"+19402930131\"}]},{\"phone\":\"+1234567890\",\"name\":\"Elisabeth\",\"message\":\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\",\"variables\":[{\"key\":\"order\",\"value\":\"9582311\"},{\"key\":\"rate_url\",\"value\":\"https://company.com/rate?order=9582311\"}]}],\"settings\":{\"date\":\"2026-11-13T09:42:45.829Z\",\"speed\":1}}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Create new campaign\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'name' => 'Campaign test',\n  'device' => '{{device.id}}>',\n  'message' => 'Dear {{ name }}, this is a sample message campaign with template variables',\n  'activate' => null,\n  'settings' => [\n    'date' => '2026-11-13T09:42:45.829Z',\n    'speed' => 1\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/campaigns');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Create new campaign with contacts and different message per recipient\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'name' => 'Campaign with contacts',\n  'device' => '{{device.id}}>',\n  'activate' => null,\n  'contacts' => [\n    [\n        'phone' => '+1234567890',\n        'name' => 'John',\n        'message' => 'Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}',\n        'variables' => [\n                [\n                                'key' => 'address',\n                                'value' => '123 Main St, New York, NY 10030'\n                ]\n        ]\n    ],\n    [\n        'phone' => '+1234567890',\n        'name' => 'Mary',\n        'message' => 'Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}',\n        'variables' => [\n                [\n                                'key' => 'support_phone',\n                                'value' => '+19402930131'\n                ]\n        ]\n    ],\n    [\n        'phone' => '+1234567890',\n        'name' => 'Elisabeth',\n        'message' => 'Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}',\n        'variables' => [\n                [\n                                'key' => 'order',\n                                'value' => '9582311'\n                ],\n                [\n                                'key' => 'rate_url',\n                                'value' => 'https://company.com/rate?order=9582311'\n                ]\n        ]\n    ]\n  ],\n  'settings' => [\n    'date' => '2026-11-13T09:42:45.829Z',\n    'speed' => 1\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/campaigns');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Create new campaign with unsubscribe feature\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'name' => 'Campaign with contacts',\n  'device' => '{{device.id}}>',\n  'activate' => null,\n  'unsubscribe' => [\n    'active' => null,\n    'word' => 'stop',\n    'message' => 'Reply *{{word}}** to unsubscribe',\n    'actions' => [\n        [\n                'action' => 'message:send',\n                'params' => [\n                                'message' => 'You’ve successfully unsubscribed and won’t receive any more communications.'\n                ]\n        ],\n        [\n                'action' => 'metadata:add',\n                'params' => [\n                                'metadata' => [\n                                                                [\n                                                                                                                                'key' => 'unsubscribed',\n                                                                                                                                'value' => 'true'\n                                                                ]\n                                ]\n                ]\n        ]\n    ]\n  ],\n  'contacts' => [\n    [\n        'phone' => '+1234567890',\n        'name' => 'John',\n        'message' => 'Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}',\n        'variables' => [\n                [\n                                'key' => 'address',\n                                'value' => '123 Main St, New York, NY 10030'\n                ]\n        ]\n    ],\n    [\n        'phone' => '+1234567890',\n        'name' => 'Mary',\n        'message' => 'Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}',\n        'variables' => [\n                [\n                                'key' => 'support_phone',\n                                'value' => '+19402930131'\n                ]\n        ]\n    ],\n    [\n        'phone' => '+1234567890',\n        'name' => 'Elisabeth',\n        'message' => 'Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}',\n        'variables' => [\n                [\n                                'key' => 'order',\n                                'value' => '9582311'\n                ],\n                [\n                                'key' => 'rate_url',\n                                'value' => 'https://company.com/rate?order=9582311'\n                ]\n        ]\n    ]\n  ],\n  'settings' => [\n    'date' => '2026-11-13T09:42:45.829Z',\n    'speed' => 1\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/campaigns');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Create new campaign\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/campaigns\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'name' => 'Campaign test',\n    'device' => '{{device.id}}>',\n    'message' => 'Dear {{ name }}, this is a sample message campaign with template variables',\n    'activate' => null,\n    'settings' => [\n        'date' => '2026-11-13T09:42:45.829Z',\n        'speed' => 1\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Create new campaign with contacts and different message per recipient\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/campaigns\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'name' => 'Campaign with contacts',\n    'device' => '{{device.id}}>',\n    'activate' => null,\n    'contacts' => [\n        [\n                'phone' => '+1234567890',\n                'name' => 'John',\n                'message' => 'Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}',\n                'variables' => [\n                                [\n                                                                'key' => 'address',\n                                                                'value' => '123 Main St, New York, NY 10030'\n                                ]\n                ]\n        ],\n        [\n                'phone' => '+1234567890',\n                'name' => 'Mary',\n                'message' => 'Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}',\n                'variables' => [\n                                [\n                                                                'key' => 'support_phone',\n                                                                'value' => '+19402930131'\n                                ]\n                ]\n        ],\n        [\n                'phone' => '+1234567890',\n                'name' => 'Elisabeth',\n                'message' => 'Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}',\n                'variables' => [\n                                [\n                                                                'key' => 'order',\n                                                                'value' => '9582311'\n                                ],\n                                [\n                                                                'key' => 'rate_url',\n                                                                'value' => 'https://company.com/rate?order=9582311'\n                                ]\n                ]\n        ]\n    ],\n    'settings' => [\n        'date' => '2026-11-13T09:42:45.829Z',\n        'speed' => 1\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Create new campaign with unsubscribe feature\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/campaigns\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'name' => 'Campaign with contacts',\n    'device' => '{{device.id}}>',\n    'activate' => null,\n    'unsubscribe' => [\n        'active' => null,\n        'word' => 'stop',\n        'message' => 'Reply *{{word}}** to unsubscribe',\n        'actions' => [\n                [\n                                'action' => 'message:send',\n                                'params' => [\n                                                                'message' => 'You’ve successfully unsubscribed and won’t receive any more communications.'\n                                ]\n                ],\n                [\n                                'action' => 'metadata:add',\n                                'params' => [\n                                                                'metadata' => [\n                                                                                                                                [\n                                                                                                                                                                                                                                                                'key' => 'unsubscribed',\n                                                                                                                                                                                                                                                                'value' => 'true'\n                                                                                                                                ]\n                                                                ]\n                                ]\n                ]\n        ]\n    ],\n    'contacts' => [\n        [\n                'phone' => '+1234567890',\n                'name' => 'John',\n                'message' => 'Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}',\n                'variables' => [\n                                [\n                                                                'key' => 'address',\n                                                                'value' => '123 Main St, New York, NY 10030'\n                                ]\n                ]\n        ],\n        [\n                'phone' => '+1234567890',\n                'name' => 'Mary',\n                'message' => 'Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}',\n                'variables' => [\n                                [\n                                                                'key' => 'support_phone',\n                                                                'value' => '+19402930131'\n                                ]\n                ]\n        ],\n        [\n                'phone' => '+1234567890',\n                'name' => 'Elisabeth',\n                'message' => 'Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}',\n                'variables' => [\n                                [\n                                                                'key' => 'order',\n                                                                'value' => '9582311'\n                                ],\n                                [\n                                                                'key' => 'rate_url',\n                                                                'value' => 'https://company.com/rate?order=9582311'\n                                ]\n                ]\n        ]\n    ],\n    'settings' => [\n        'date' => '2026-11-13T09:42:45.829Z',\n        'speed' => 1\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Create new campaign\nimport requests\n\nurl = \"https://api.wassenger.com/v1/campaigns\"\n\npayload = {\n    \"name\": \"Campaign test\",\n    \"device\": \"{{device.id}}>\",\n    \"message\": \"Dear {{ name }}, this is a sample message campaign with template variables\",\n    \"activate\": False,\n    \"settings\": {\n        \"date\": \"2026-11-13T09:42:45.829Z\",\n        \"speed\": 1\n    }\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Create new campaign with contacts and different message per recipient\nimport requests\n\nurl = \"https://api.wassenger.com/v1/campaigns\"\n\npayload = {\n    \"name\": \"Campaign with contacts\",\n    \"device\": \"{{device.id}}>\",\n    \"activate\": True,\n    \"contacts\": [\n        {\n            \"phone\": \"+1234567890\",\n            \"name\": \"John\",\n            \"message\": \"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\",\n            \"variables\": [\n                {\n                    \"key\": \"address\",\n                    \"value\": \"123 Main St, New York, NY 10030\"\n                }\n            ]\n        },\n        {\n            \"phone\": \"+1234567890\",\n            \"name\": \"Mary\",\n            \"message\": \"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\",\n            \"variables\": [\n                {\n                    \"key\": \"support_phone\",\n                    \"value\": \"+19402930131\"\n                }\n            ]\n        },\n        {\n            \"phone\": \"+1234567890\",\n            \"name\": \"Elisabeth\",\n            \"message\": \"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\",\n            \"variables\": [\n                {\n                    \"key\": \"order\",\n                    \"value\": \"9582311\"\n                },\n                {\n                    \"key\": \"rate_url\",\n                    \"value\": \"https://company.com/rate?order=9582311\"\n                }\n            ]\n        }\n    ],\n    \"settings\": {\n        \"date\": \"2026-11-13T09:42:45.829Z\",\n        \"speed\": 1\n    }\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Create new campaign with unsubscribe feature\nimport requests\n\nurl = \"https://api.wassenger.com/v1/campaigns\"\n\npayload = {\n    \"name\": \"Campaign with contacts\",\n    \"device\": \"{{device.id}}>\",\n    \"activate\": True,\n    \"unsubscribe\": {\n        \"active\": True,\n        \"word\": \"stop\",\n        \"message\": \"Reply *{{word}}** to unsubscribe\",\n        \"actions\": [\n            {\n                \"action\": \"message:send\",\n                \"params\": { \"message\": \"You’ve successfully unsubscribed and won’t receive any more communications.\" }\n            },\n            {\n                \"action\": \"metadata:add\",\n                \"params\": { \"metadata\": [\n                        {\n                            \"key\": \"unsubscribed\",\n                            \"value\": \"true\"\n                        }\n                    ] }\n            }\n        ]\n    },\n    \"contacts\": [\n        {\n            \"phone\": \"+1234567890\",\n            \"name\": \"John\",\n            \"message\": \"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\",\n            \"variables\": [\n                {\n                    \"key\": \"address\",\n                    \"value\": \"123 Main St, New York, NY 10030\"\n                }\n            ]\n        },\n        {\n            \"phone\": \"+1234567890\",\n            \"name\": \"Mary\",\n            \"message\": \"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\",\n            \"variables\": [\n                {\n                    \"key\": \"support_phone\",\n                    \"value\": \"+19402930131\"\n                }\n            ]\n        },\n        {\n            \"phone\": \"+1234567890\",\n            \"name\": \"Elisabeth\",\n            \"message\": \"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\",\n            \"variables\": [\n                {\n                    \"key\": \"order\",\n                    \"value\": \"9582311\"\n                },\n                {\n                    \"key\": \"rate_url\",\n                    \"value\": \"https://company.com/rate?order=9582311\"\n                }\n            ]\n        }\n    ],\n    \"settings\": {\n        \"date\": \"2026-11-13T09:42:45.829Z\",\n        \"speed\": 1\n    }\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create new campaign\nconst url = 'https://api.wassenger.com/v1/campaigns';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"Campaign test\",\"device\":\"{{device.id}}>\",\"message\":\"Dear {{ name }}, this is a sample message campaign with template variables\",\"activate\":false,\"settings\":{\"date\":\"2026-11-13T09:42:45.829Z\",\"speed\":1}}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Create new campaign with contacts and different message per recipient\nconst url = 'https://api.wassenger.com/v1/campaigns';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"Campaign with contacts\",\"device\":\"{{device.id}}>\",\"activate\":true,\"contacts\":[{\"phone\":\"+1234567890\",\"name\":\"John\",\"message\":\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\",\"variables\":[{\"key\":\"address\",\"value\":\"123 Main St, New York, NY 10030\"}]},{\"phone\":\"+1234567890\",\"name\":\"Mary\",\"message\":\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\",\"variables\":[{\"key\":\"support_phone\",\"value\":\"+19402930131\"}]},{\"phone\":\"+1234567890\",\"name\":\"Elisabeth\",\"message\":\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\",\"variables\":[{\"key\":\"order\",\"value\":\"9582311\"},{\"key\":\"rate_url\",\"value\":\"https://company.com/rate?order=9582311\"}]}],\"settings\":{\"date\":\"2026-11-13T09:42:45.829Z\",\"speed\":1}}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Create new campaign with unsubscribe feature\nconst url = 'https://api.wassenger.com/v1/campaigns';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"Campaign with contacts\",\"device\":\"{{device.id}}>\",\"activate\":true,\"unsubscribe\":{\"active\":true,\"word\":\"stop\",\"message\":\"Reply *{{word}}** to unsubscribe\",\"actions\":[{\"action\":\"message:send\",\"params\":{\"message\":\"You’ve successfully unsubscribed and won’t receive any more communications.\"}},{\"action\":\"metadata:add\",\"params\":{\"metadata\":[{\"key\":\"unsubscribed\",\"value\":\"true\"}]}}]},\"contacts\":[{\"phone\":\"+1234567890\",\"name\":\"John\",\"message\":\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\",\"variables\":[{\"key\":\"address\",\"value\":\"123 Main St, New York, NY 10030\"}]},{\"phone\":\"+1234567890\",\"name\":\"Mary\",\"message\":\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\",\"variables\":[{\"key\":\"support_phone\",\"value\":\"+19402930131\"}]},{\"phone\":\"+1234567890\",\"name\":\"Elisabeth\",\"message\":\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\",\"variables\":[{\"key\":\"order\",\"value\":\"9582311\"},{\"key\":\"rate_url\",\"value\":\"https://company.com/rate?order=9582311\"}]}],\"settings\":{\"date\":\"2026-11-13T09:42:45.829Z\",\"speed\":1}}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create new campaign\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/campaigns',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"name\":\"Campaign test\",\"device\":\"{{device.id}}>\",\"message\":\"Dear {{ name }}, this is a sample message campaign with template variables\",\"activate\":false,\"settings\":{\"date\":\"2026-11-13T09:42:45.829Z\",\"speed\":1}}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Create new campaign with contacts and different message per recipient\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/campaigns',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"name\":\"Campaign with contacts\",\"device\":\"{{device.id}}>\",\"activate\":true,\"contacts\":[{\"phone\":\"+1234567890\",\"name\":\"John\",\"message\":\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\",\"variables\":[{\"key\":\"address\",\"value\":\"123 Main St, New York, NY 10030\"}]},{\"phone\":\"+1234567890\",\"name\":\"Mary\",\"message\":\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\",\"variables\":[{\"key\":\"support_phone\",\"value\":\"+19402930131\"}]},{\"phone\":\"+1234567890\",\"name\":\"Elisabeth\",\"message\":\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\",\"variables\":[{\"key\":\"order\",\"value\":\"9582311\"},{\"key\":\"rate_url\",\"value\":\"https://company.com/rate?order=9582311\"}]}],\"settings\":{\"date\":\"2026-11-13T09:42:45.829Z\",\"speed\":1}}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Create new campaign with unsubscribe feature\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/campaigns',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"name\":\"Campaign with contacts\",\"device\":\"{{device.id}}>\",\"activate\":true,\"unsubscribe\":{\"active\":true,\"word\":\"stop\",\"message\":\"Reply *{{word}}** to unsubscribe\",\"actions\":[{\"action\":\"message:send\",\"params\":{\"message\":\"You’ve successfully unsubscribed and won’t receive any more communications.\"}},{\"action\":\"metadata:add\",\"params\":{\"metadata\":[{\"key\":\"unsubscribed\",\"value\":\"true\"}]}}]},\"contacts\":[{\"phone\":\"+1234567890\",\"name\":\"John\",\"message\":\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\",\"variables\":[{\"key\":\"address\",\"value\":\"123 Main St, New York, NY 10030\"}]},{\"phone\":\"+1234567890\",\"name\":\"Mary\",\"message\":\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\",\"variables\":[{\"key\":\"support_phone\",\"value\":\"+19402930131\"}]},{\"phone\":\"+1234567890\",\"name\":\"Elisabeth\",\"message\":\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\",\"variables\":[{\"key\":\"order\",\"value\":\"9582311\"},{\"key\":\"rate_url\",\"value\":\"https://company.com/rate?order=9582311\"}]}],\"settings\":{\"date\":\"2026-11-13T09:42:45.829Z\",\"speed\":1}}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Create new campaign\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/campaigns\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"name\\\":\\\"Campaign test\\\",\\\"device\\\":\\\"{{device.id}}>\\\",\\\"message\\\":\\\"Dear {{ name }}, this is a sample message campaign with template variables\\\",\\\"activate\\\":false,\\\"settings\\\":{\\\"date\\\":\\\"2026-11-13T09:42:45.829Z\\\",\\\"speed\\\":1}}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Create new campaign with contacts and different message per recipient\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/campaigns\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"name\\\":\\\"Campaign with contacts\\\",\\\"device\\\":\\\"{{device.id}}>\\\",\\\"activate\\\":true,\\\"contacts\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"John\\\",\\\"message\\\":\\\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"address\\\",\\\"value\\\":\\\"123 Main St, New York, NY 10030\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Mary\\\",\\\"message\\\":\\\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"support_phone\\\",\\\"value\\\":\\\"+19402930131\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Elisabeth\\\",\\\"message\\\":\\\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"order\\\",\\\"value\\\":\\\"9582311\\\"},{\\\"key\\\":\\\"rate_url\\\",\\\"value\\\":\\\"https://company.com/rate?order=9582311\\\"}]}],\\\"settings\\\":{\\\"date\\\":\\\"2026-11-13T09:42:45.829Z\\\",\\\"speed\\\":1}}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Create new campaign with unsubscribe feature\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/campaigns\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"name\\\":\\\"Campaign with contacts\\\",\\\"device\\\":\\\"{{device.id}}>\\\",\\\"activate\\\":true,\\\"unsubscribe\\\":{\\\"active\\\":true,\\\"word\\\":\\\"stop\\\",\\\"message\\\":\\\"Reply *{{word}}** to unsubscribe\\\",\\\"actions\\\":[{\\\"action\\\":\\\"message:send\\\",\\\"params\\\":{\\\"message\\\":\\\"You’ve successfully unsubscribed and won’t receive any more communications.\\\"}},{\\\"action\\\":\\\"metadata:add\\\",\\\"params\\\":{\\\"metadata\\\":[{\\\"key\\\":\\\"unsubscribed\\\",\\\"value\\\":\\\"true\\\"}]}}]},\\\"contacts\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"John\\\",\\\"message\\\":\\\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"address\\\",\\\"value\\\":\\\"123 Main St, New York, NY 10030\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Mary\\\",\\\"message\\\":\\\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"support_phone\\\",\\\"value\\\":\\\"+19402930131\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Elisabeth\\\",\\\"message\\\":\\\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"order\\\",\\\"value\\\":\\\"9582311\\\"},{\\\"key\\\":\\\"rate_url\\\",\\\"value\\\":\\\"https://company.com/rate?order=9582311\\\"}]}],\\\"settings\\\":{\\\"date\\\":\\\"2026-11-13T09:42:45.829Z\\\",\\\"speed\\\":1}}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Create new campaign\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/campaigns\"\n\n\tpayload := strings.NewReader(\"{\\\"name\\\":\\\"Campaign test\\\",\\\"device\\\":\\\"{{device.id}}>\\\",\\\"message\\\":\\\"Dear {{ name }}, this is a sample message campaign with template variables\\\",\\\"activate\\\":false,\\\"settings\\\":{\\\"date\\\":\\\"2026-11-13T09:42:45.829Z\\\",\\\"speed\\\":1}}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Create new campaign with contacts and different message per recipient\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/campaigns\"\n\n\tpayload := strings.NewReader(\"{\\\"name\\\":\\\"Campaign with contacts\\\",\\\"device\\\":\\\"{{device.id}}>\\\",\\\"activate\\\":true,\\\"contacts\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"John\\\",\\\"message\\\":\\\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"address\\\",\\\"value\\\":\\\"123 Main St, New York, NY 10030\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Mary\\\",\\\"message\\\":\\\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"support_phone\\\",\\\"value\\\":\\\"+19402930131\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Elisabeth\\\",\\\"message\\\":\\\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"order\\\",\\\"value\\\":\\\"9582311\\\"},{\\\"key\\\":\\\"rate_url\\\",\\\"value\\\":\\\"https://company.com/rate?order=9582311\\\"}]}],\\\"settings\\\":{\\\"date\\\":\\\"2026-11-13T09:42:45.829Z\\\",\\\"speed\\\":1}}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Create new campaign with unsubscribe feature\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/campaigns\"\n\n\tpayload := strings.NewReader(\"{\\\"name\\\":\\\"Campaign with contacts\\\",\\\"device\\\":\\\"{{device.id}}>\\\",\\\"activate\\\":true,\\\"unsubscribe\\\":{\\\"active\\\":true,\\\"word\\\":\\\"stop\\\",\\\"message\\\":\\\"Reply *{{word}}** to unsubscribe\\\",\\\"actions\\\":[{\\\"action\\\":\\\"message:send\\\",\\\"params\\\":{\\\"message\\\":\\\"You’ve successfully unsubscribed and won’t receive any more communications.\\\"}},{\\\"action\\\":\\\"metadata:add\\\",\\\"params\\\":{\\\"metadata\\\":[{\\\"key\\\":\\\"unsubscribed\\\",\\\"value\\\":\\\"true\\\"}]}}]},\\\"contacts\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"John\\\",\\\"message\\\":\\\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"address\\\",\\\"value\\\":\\\"123 Main St, New York, NY 10030\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Mary\\\",\\\"message\\\":\\\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"support_phone\\\",\\\"value\\\":\\\"+19402930131\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Elisabeth\\\",\\\"message\\\":\\\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"order\\\",\\\"value\\\":\\\"9582311\\\"},{\\\"key\\\":\\\"rate_url\\\",\\\"value\\\":\\\"https://company.com/rate?order=9582311\\\"}]}],\\\"settings\\\":{\\\"date\\\":\\\"2026-11-13T09:42:45.829Z\\\",\\\"speed\\\":1}}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Create new campaign\nvar client = new RestClient(\"https://api.wassenger.com/v1/campaigns\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"name\\\":\\\"Campaign test\\\",\\\"device\\\":\\\"{{device.id}}>\\\",\\\"message\\\":\\\"Dear {{ name }}, this is a sample message campaign with template variables\\\",\\\"activate\\\":false,\\\"settings\\\":{\\\"date\\\":\\\"2026-11-13T09:42:45.829Z\\\",\\\"speed\\\":1}}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Create new campaign with contacts and different message per recipient\nvar client = new RestClient(\"https://api.wassenger.com/v1/campaigns\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"name\\\":\\\"Campaign with contacts\\\",\\\"device\\\":\\\"{{device.id}}>\\\",\\\"activate\\\":true,\\\"contacts\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"John\\\",\\\"message\\\":\\\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"address\\\",\\\"value\\\":\\\"123 Main St, New York, NY 10030\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Mary\\\",\\\"message\\\":\\\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"support_phone\\\",\\\"value\\\":\\\"+19402930131\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Elisabeth\\\",\\\"message\\\":\\\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"order\\\",\\\"value\\\":\\\"9582311\\\"},{\\\"key\\\":\\\"rate_url\\\",\\\"value\\\":\\\"https://company.com/rate?order=9582311\\\"}]}],\\\"settings\\\":{\\\"date\\\":\\\"2026-11-13T09:42:45.829Z\\\",\\\"speed\\\":1}}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Create new campaign with unsubscribe feature\nvar client = new RestClient(\"https://api.wassenger.com/v1/campaigns\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"name\\\":\\\"Campaign with contacts\\\",\\\"device\\\":\\\"{{device.id}}>\\\",\\\"activate\\\":true,\\\"unsubscribe\\\":{\\\"active\\\":true,\\\"word\\\":\\\"stop\\\",\\\"message\\\":\\\"Reply *{{word}}** to unsubscribe\\\",\\\"actions\\\":[{\\\"action\\\":\\\"message:send\\\",\\\"params\\\":{\\\"message\\\":\\\"You’ve successfully unsubscribed and won’t receive any more communications.\\\"}},{\\\"action\\\":\\\"metadata:add\\\",\\\"params\\\":{\\\"metadata\\\":[{\\\"key\\\":\\\"unsubscribed\\\",\\\"value\\\":\\\"true\\\"}]}}]},\\\"contacts\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"John\\\",\\\"message\\\":\\\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"address\\\",\\\"value\\\":\\\"123 Main St, New York, NY 10030\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Mary\\\",\\\"message\\\":\\\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"support_phone\\\",\\\"value\\\":\\\"+19402930131\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Elisabeth\\\",\\\"message\\\":\\\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"order\\\",\\\"value\\\":\\\"9582311\\\"},{\\\"key\\\":\\\"rate_url\\\",\\\"value\\\":\\\"https://company.com/rate?order=9582311\\\"}]}],\\\"settings\\\":{\\\"date\\\":\\\"2026-11-13T09:42:45.829Z\\\",\\\"speed\\\":1}}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Create new campaign\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/campaigns\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"name\\\":\\\"Campaign test\\\",\\\"device\\\":\\\"{{device.id}}>\\\",\\\"message\\\":\\\"Dear {{ name }}, this is a sample message campaign with template variables\\\",\\\"activate\\\":false,\\\"settings\\\":{\\\"date\\\":\\\"2026-11-13T09:42:45.829Z\\\",\\\"speed\\\":1}}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Create new campaign with contacts and different message per recipient\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/campaigns\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"name\\\":\\\"Campaign with contacts\\\",\\\"device\\\":\\\"{{device.id}}>\\\",\\\"activate\\\":true,\\\"contacts\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"John\\\",\\\"message\\\":\\\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"address\\\",\\\"value\\\":\\\"123 Main St, New York, NY 10030\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Mary\\\",\\\"message\\\":\\\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"support_phone\\\",\\\"value\\\":\\\"+19402930131\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Elisabeth\\\",\\\"message\\\":\\\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"order\\\",\\\"value\\\":\\\"9582311\\\"},{\\\"key\\\":\\\"rate_url\\\",\\\"value\\\":\\\"https://company.com/rate?order=9582311\\\"}]}],\\\"settings\\\":{\\\"date\\\":\\\"2026-11-13T09:42:45.829Z\\\",\\\"speed\\\":1}}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Create new campaign with unsubscribe feature\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/campaigns\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"name\\\":\\\"Campaign with contacts\\\",\\\"device\\\":\\\"{{device.id}}>\\\",\\\"activate\\\":true,\\\"unsubscribe\\\":{\\\"active\\\":true,\\\"word\\\":\\\"stop\\\",\\\"message\\\":\\\"Reply *{{word}}** to unsubscribe\\\",\\\"actions\\\":[{\\\"action\\\":\\\"message:send\\\",\\\"params\\\":{\\\"message\\\":\\\"You’ve successfully unsubscribed and won’t receive any more communications.\\\"}},{\\\"action\\\":\\\"metadata:add\\\",\\\"params\\\":{\\\"metadata\\\":[{\\\"key\\\":\\\"unsubscribed\\\",\\\"value\\\":\\\"true\\\"}]}}]},\\\"contacts\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"John\\\",\\\"message\\\":\\\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"address\\\",\\\"value\\\":\\\"123 Main St, New York, NY 10030\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Mary\\\",\\\"message\\\":\\\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"support_phone\\\",\\\"value\\\":\\\"+19402930131\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Elisabeth\\\",\\\"message\\\":\\\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"order\\\",\\\"value\\\":\\\"9582311\\\"},{\\\"key\\\":\\\"rate_url\\\",\\\"value\\\":\\\"https://company.com/rate?order=9582311\\\"}]}],\\\"settings\\\":{\\\"date\\\":\\\"2026-11-13T09:42:45.829Z\\\",\\\"speed\\\":1}}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Create new campaign\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/campaigns\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"name\\\":\\\"Campaign test\\\",\\\"device\\\":\\\"{{device.id}}>\\\",\\\"message\\\":\\\"Dear {{ name }}, this is a sample message campaign with template variables\\\",\\\"activate\\\":false,\\\"settings\\\":{\\\"date\\\":\\\"2026-11-13T09:42:45.829Z\\\",\\\"speed\\\":1}}\")\n  .asString();\n\n\n// Create new campaign with contacts and different message per recipient\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/campaigns\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"name\\\":\\\"Campaign with contacts\\\",\\\"device\\\":\\\"{{device.id}}>\\\",\\\"activate\\\":true,\\\"contacts\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"John\\\",\\\"message\\\":\\\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"address\\\",\\\"value\\\":\\\"123 Main St, New York, NY 10030\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Mary\\\",\\\"message\\\":\\\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"support_phone\\\",\\\"value\\\":\\\"+19402930131\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Elisabeth\\\",\\\"message\\\":\\\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"order\\\",\\\"value\\\":\\\"9582311\\\"},{\\\"key\\\":\\\"rate_url\\\",\\\"value\\\":\\\"https://company.com/rate?order=9582311\\\"}]}],\\\"settings\\\":{\\\"date\\\":\\\"2026-11-13T09:42:45.829Z\\\",\\\"speed\\\":1}}\")\n  .asString();\n\n\n// Create new campaign with unsubscribe feature\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/campaigns\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"name\\\":\\\"Campaign with contacts\\\",\\\"device\\\":\\\"{{device.id}}>\\\",\\\"activate\\\":true,\\\"unsubscribe\\\":{\\\"active\\\":true,\\\"word\\\":\\\"stop\\\",\\\"message\\\":\\\"Reply *{{word}}** to unsubscribe\\\",\\\"actions\\\":[{\\\"action\\\":\\\"message:send\\\",\\\"params\\\":{\\\"message\\\":\\\"You’ve successfully unsubscribed and won’t receive any more communications.\\\"}},{\\\"action\\\":\\\"metadata:add\\\",\\\"params\\\":{\\\"metadata\\\":[{\\\"key\\\":\\\"unsubscribed\\\",\\\"value\\\":\\\"true\\\"}]}}]},\\\"contacts\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"John\\\",\\\"message\\\":\\\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"address\\\",\\\"value\\\":\\\"123 Main St, New York, NY 10030\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Mary\\\",\\\"message\\\":\\\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"support_phone\\\",\\\"value\\\":\\\"+19402930131\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Elisabeth\\\",\\\"message\\\":\\\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"order\\\",\\\"value\\\":\\\"9582311\\\"},{\\\"key\\\":\\\"rate_url\\\",\\\"value\\\":\\\"https://company.com/rate?order=9582311\\\"}]}],\\\"settings\\\":{\\\"date\\\":\\\"2026-11-13T09:42:45.829Z\\\",\\\"speed\\\":1}}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Create new campaign\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"name\\\":\\\"Campaign test\\\",\\\"device\\\":\\\"{{device.id}}>\\\",\\\"message\\\":\\\"Dear {{ name }}, this is a sample message campaign with template variables\\\",\\\"activate\\\":false,\\\"settings\\\":{\\\"date\\\":\\\"2026-11-13T09:42:45.829Z\\\",\\\"speed\\\":1}}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/campaigns\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Create new campaign with contacts and different message per recipient\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"name\\\":\\\"Campaign with contacts\\\",\\\"device\\\":\\\"{{device.id}}>\\\",\\\"activate\\\":true,\\\"contacts\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"John\\\",\\\"message\\\":\\\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"address\\\",\\\"value\\\":\\\"123 Main St, New York, NY 10030\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Mary\\\",\\\"message\\\":\\\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"support_phone\\\",\\\"value\\\":\\\"+19402930131\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Elisabeth\\\",\\\"message\\\":\\\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"order\\\",\\\"value\\\":\\\"9582311\\\"},{\\\"key\\\":\\\"rate_url\\\",\\\"value\\\":\\\"https://company.com/rate?order=9582311\\\"}]}],\\\"settings\\\":{\\\"date\\\":\\\"2026-11-13T09:42:45.829Z\\\",\\\"speed\\\":1}}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/campaigns\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Create new campaign with unsubscribe feature\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"name\\\":\\\"Campaign with contacts\\\",\\\"device\\\":\\\"{{device.id}}>\\\",\\\"activate\\\":true,\\\"unsubscribe\\\":{\\\"active\\\":true,\\\"word\\\":\\\"stop\\\",\\\"message\\\":\\\"Reply *{{word}}** to unsubscribe\\\",\\\"actions\\\":[{\\\"action\\\":\\\"message:send\\\",\\\"params\\\":{\\\"message\\\":\\\"You’ve successfully unsubscribed and won’t receive any more communications.\\\"}},{\\\"action\\\":\\\"metadata:add\\\",\\\"params\\\":{\\\"metadata\\\":[{\\\"key\\\":\\\"unsubscribed\\\",\\\"value\\\":\\\"true\\\"}]}}]},\\\"contacts\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"John\\\",\\\"message\\\":\\\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"address\\\",\\\"value\\\":\\\"123 Main St, New York, NY 10030\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Mary\\\",\\\"message\\\":\\\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"support_phone\\\",\\\"value\\\":\\\"+19402930131\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Elisabeth\\\",\\\"message\\\":\\\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"order\\\",\\\"value\\\":\\\"9582311\\\"},{\\\"key\\\":\\\"rate_url\\\",\\\"value\\\":\\\"https://company.com/rate?order=9582311\\\"}]}],\\\"settings\\\":{\\\"date\\\":\\\"2026-11-13T09:42:45.829Z\\\",\\\"speed\\\":1}}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/campaigns\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Create new campaign\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/campaigns\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"name\\\":\\\"Campaign test\\\",\\\"device\\\":\\\"{{device.id}}>\\\",\\\"message\\\":\\\"Dear {{ name }}, this is a sample message campaign with template variables\\\",\\\"activate\\\":false,\\\"settings\\\":{\\\"date\\\":\\\"2026-11-13T09:42:45.829Z\\\",\\\"speed\\\":1}}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Create new campaign with contacts and different message per recipient\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/campaigns\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"name\\\":\\\"Campaign with contacts\\\",\\\"device\\\":\\\"{{device.id}}>\\\",\\\"activate\\\":true,\\\"contacts\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"John\\\",\\\"message\\\":\\\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"address\\\",\\\"value\\\":\\\"123 Main St, New York, NY 10030\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Mary\\\",\\\"message\\\":\\\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"support_phone\\\",\\\"value\\\":\\\"+19402930131\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Elisabeth\\\",\\\"message\\\":\\\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"order\\\",\\\"value\\\":\\\"9582311\\\"},{\\\"key\\\":\\\"rate_url\\\",\\\"value\\\":\\\"https://company.com/rate?order=9582311\\\"}]}],\\\"settings\\\":{\\\"date\\\":\\\"2026-11-13T09:42:45.829Z\\\",\\\"speed\\\":1}}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Create new campaign with unsubscribe feature\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/campaigns\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"name\\\":\\\"Campaign with contacts\\\",\\\"device\\\":\\\"{{device.id}}>\\\",\\\"activate\\\":true,\\\"unsubscribe\\\":{\\\"active\\\":true,\\\"word\\\":\\\"stop\\\",\\\"message\\\":\\\"Reply *{{word}}** to unsubscribe\\\",\\\"actions\\\":[{\\\"action\\\":\\\"message:send\\\",\\\"params\\\":{\\\"message\\\":\\\"You’ve successfully unsubscribed and won’t receive any more communications.\\\"}},{\\\"action\\\":\\\"metadata:add\\\",\\\"params\\\":{\\\"metadata\\\":[{\\\"key\\\":\\\"unsubscribed\\\",\\\"value\\\":\\\"true\\\"}]}}]},\\\"contacts\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"John\\\",\\\"message\\\":\\\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"address\\\",\\\"value\\\":\\\"123 Main St, New York, NY 10030\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Mary\\\",\\\"message\\\":\\\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"support_phone\\\",\\\"value\\\":\\\"+19402930131\\\"}]},{\\\"phone\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Elisabeth\\\",\\\"message\\\":\\\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\\\",\\\"variables\\\":[{\\\"key\\\":\\\"order\\\",\\\"value\\\":\\\"9582311\\\"},{\\\"key\\\":\\\"rate_url\\\",\\\"value\\\":\\\"https://company.com/rate?order=9582311\\\"}]}],\\\"settings\\\":{\\\"date\\\":\\\"2026-11-13T09:42:45.829Z\\\",\\\"speed\\\":1}}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Create new campaign\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/campaigns' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"name\":\"Campaign test\",\"device\":\"{{device.id}}>\",\"message\":\"Dear {{ name }}, this is a sample message campaign with template variables\",\"activate\":false,\"settings\":{\"date\":\"2026-11-13T09:42:45.829Z\",\"speed\":1}}'\n\n\n# Create new campaign with contacts and different message per recipient\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/campaigns' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"name\":\"Campaign with contacts\",\"device\":\"{{device.id}}>\",\"activate\":true,\"contacts\":[{\"phone\":\"+1234567890\",\"name\":\"John\",\"message\":\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\",\"variables\":[{\"key\":\"address\",\"value\":\"123 Main St, New York, NY 10030\"}]},{\"phone\":\"+1234567890\",\"name\":\"Mary\",\"message\":\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\",\"variables\":[{\"key\":\"support_phone\",\"value\":\"+19402930131\"}]},{\"phone\":\"+1234567890\",\"name\":\"Elisabeth\",\"message\":\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\",\"variables\":[{\"key\":\"order\",\"value\":\"9582311\"},{\"key\":\"rate_url\",\"value\":\"https://company.com/rate?order=9582311\"}]}],\"settings\":{\"date\":\"2026-11-13T09:42:45.829Z\",\"speed\":1}}'\n\n\n# Create new campaign with unsubscribe feature\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/campaigns' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"name\":\"Campaign with contacts\",\"device\":\"{{device.id}}>\",\"activate\":true,\"unsubscribe\":{\"active\":true,\"word\":\"stop\",\"message\":\"Reply *{{word}}** to unsubscribe\",\"actions\":[{\"action\":\"message:send\",\"params\":{\"message\":\"You’ve successfully unsubscribed and won’t receive any more communications.\"}},{\"action\":\"metadata:add\",\"params\":{\"metadata\":[{\"key\":\"unsubscribed\",\"value\":\"true\"}]}}]},\"contacts\":[{\"phone\":\"+1234567890\",\"name\":\"John\",\"message\":\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\",\"variables\":[{\"key\":\"address\",\"value\":\"123 Main St, New York, NY 10030\"}]},{\"phone\":\"+1234567890\",\"name\":\"Mary\",\"message\":\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\",\"variables\":[{\"key\":\"support_phone\",\"value\":\"+19402930131\"}]},{\"phone\":\"+1234567890\",\"name\":\"Elisabeth\",\"message\":\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\",\"variables\":[{\"key\":\"order\",\"value\":\"9582311\"},{\"key\":\"rate_url\",\"value\":\"https://company.com/rate?order=9582311\"}]}],\"settings\":{\"date\":\"2026-11-13T09:42:45.829Z\",\"speed\":1}}'"},{"lang":"ObjC","source":"// Create new campaign\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"name\": @\"Campaign test\",\n                              @\"device\": @\"{{device.id}}>\",\n                              @\"message\": @\"Dear {{ name }}, this is a sample message campaign with template variables\",\n                              @\"activate\": @NO,\n                              @\"settings\": @{ @\"date\": @\"2026-11-13T09:42:45.829Z\", @\"speed\": @1 } };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/campaigns\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Create new campaign with contacts and different message per recipient\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"name\": @\"Campaign with contacts\",\n                              @\"device\": @\"{{device.id}}>\",\n                              @\"activate\": @YES,\n                              @\"contacts\": @[ @{ @\"phone\": @\"+1234567890\", @\"name\": @\"John\", @\"message\": @\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\", @\"variables\": @[ @{ @\"key\": @\"address\", @\"value\": @\"123 Main St, New York, NY 10030\" } ] }, @{ @\"phone\": @\"+1234567890\", @\"name\": @\"Mary\", @\"message\": @\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\", @\"variables\": @[ @{ @\"key\": @\"support_phone\", @\"value\": @\"+19402930131\" } ] }, @{ @\"phone\": @\"+1234567890\", @\"name\": @\"Elisabeth\", @\"message\": @\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\", @\"variables\": @[ @{ @\"key\": @\"order\", @\"value\": @\"9582311\" }, @{ @\"key\": @\"rate_url\", @\"value\": @\"https://company.com/rate?order=9582311\" } ] } ],\n                              @\"settings\": @{ @\"date\": @\"2026-11-13T09:42:45.829Z\", @\"speed\": @1 } };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/campaigns\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Create new campaign with unsubscribe feature\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"name\": @\"Campaign with contacts\",\n                              @\"device\": @\"{{device.id}}>\",\n                              @\"activate\": @YES,\n                              @\"unsubscribe\": @{ @\"active\": @YES, @\"word\": @\"stop\", @\"message\": @\"Reply *{{word}}** to unsubscribe\", @\"actions\": @[ @{ @\"action\": @\"message:send\", @\"params\": @{ @\"message\": @\"You’ve successfully unsubscribed and won’t receive any more communications.\" } }, @{ @\"action\": @\"metadata:add\", @\"params\": @{ @\"metadata\": @[ @{ @\"key\": @\"unsubscribed\", @\"value\": @\"true\" } ] } } ] },\n                              @\"contacts\": @[ @{ @\"phone\": @\"+1234567890\", @\"name\": @\"John\", @\"message\": @\"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\", @\"variables\": @[ @{ @\"key\": @\"address\", @\"value\": @\"123 Main St, New York, NY 10030\" } ] }, @{ @\"phone\": @\"+1234567890\", @\"name\": @\"Mary\", @\"message\": @\"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\", @\"variables\": @[ @{ @\"key\": @\"support_phone\", @\"value\": @\"+19402930131\" } ] }, @{ @\"phone\": @\"+1234567890\", @\"name\": @\"Elisabeth\", @\"message\": @\"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\", @\"variables\": @[ @{ @\"key\": @\"order\", @\"value\": @\"9582311\" }, @{ @\"key\": @\"rate_url\", @\"value\": @\"https://company.com/rate?order=9582311\" } ] } ],\n                              @\"settings\": @{ @\"date\": @\"2026-11-13T09:42:45.829Z\", @\"speed\": @1 } };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/campaigns\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Create new campaign\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"name\": \"Campaign test\",\n  \"device\": \"{{device.id}}>\",\n  \"message\": \"Dear {{ name }}, this is a sample message campaign with template variables\",\n  \"activate\": false,\n  \"settings\": [\n    \"date\": \"2026-11-13T09:42:45.829Z\",\n    \"speed\": 1\n  ]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/campaigns\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Create new campaign with contacts and different message per recipient\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"name\": \"Campaign with contacts\",\n  \"device\": \"{{device.id}}>\",\n  \"activate\": true,\n  \"contacts\": [\n    [\n      \"phone\": \"+1234567890\",\n      \"name\": \"John\",\n      \"message\": \"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\",\n      \"variables\": [\n        [\n          \"key\": \"address\",\n          \"value\": \"123 Main St, New York, NY 10030\"\n        ]\n      ]\n    ],\n    [\n      \"phone\": \"+1234567890\",\n      \"name\": \"Mary\",\n      \"message\": \"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\",\n      \"variables\": [\n        [\n          \"key\": \"support_phone\",\n          \"value\": \"+19402930131\"\n        ]\n      ]\n    ],\n    [\n      \"phone\": \"+1234567890\",\n      \"name\": \"Elisabeth\",\n      \"message\": \"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\",\n      \"variables\": [\n        [\n          \"key\": \"order\",\n          \"value\": \"9582311\"\n        ],\n        [\n          \"key\": \"rate_url\",\n          \"value\": \"https://company.com/rate?order=9582311\"\n        ]\n      ]\n    ]\n  ],\n  \"settings\": [\n    \"date\": \"2026-11-13T09:42:45.829Z\",\n    \"speed\": 1\n  ]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/campaigns\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Create new campaign with unsubscribe feature\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"name\": \"Campaign with contacts\",\n  \"device\": \"{{device.id}}>\",\n  \"activate\": true,\n  \"unsubscribe\": [\n    \"active\": true,\n    \"word\": \"stop\",\n    \"message\": \"Reply *{{word}}** to unsubscribe\",\n    \"actions\": [\n      [\n        \"action\": \"message:send\",\n        \"params\": [\"message\": \"You’ve successfully unsubscribed and won’t receive any more communications.\"]\n      ],\n      [\n        \"action\": \"metadata:add\",\n        \"params\": [\"metadata\": [\n            [\n              \"key\": \"unsubscribed\",\n              \"value\": \"true\"\n            ]\n          ]]\n      ]\n    ]\n  ],\n  \"contacts\": [\n    [\n      \"phone\": \"+1234567890\",\n      \"name\": \"John\",\n      \"message\": \"Dear {{ name }}, your package is in delivery and will arrive soon to {{ address }}\",\n      \"variables\": [\n        [\n          \"key\": \"address\",\n          \"value\": \"123 Main St, New York, NY 10030\"\n        ]\n      ]\n    ],\n    [\n      \"phone\": \"+1234567890\",\n      \"name\": \"Mary\",\n      \"message\": \"Dear {{ name }}, package delivery failed, please contact us to reschedule the delivery at {{ support_phone }}\",\n      \"variables\": [\n        [\n          \"key\": \"support_phone\",\n          \"value\": \"+19402930131\"\n        ]\n      ]\n    ],\n    [\n      \"phone\": \"+1234567890\",\n      \"name\": \"Elisabeth\",\n      \"message\": \"Dear {{ name }}, your order {{ order }} has shipped, thank you for your purchase! Rate your experience: {{ rate_url }}\",\n      \"variables\": [\n        [\n          \"key\": \"order\",\n          \"value\": \"9582311\"\n        ],\n        [\n          \"key\": \"rate_url\",\n          \"value\": \"https://company.com/rate?order=9582311\"\n        ]\n      ]\n    ]\n  ],\n  \"settings\": [\n    \"date\": \"2026-11-13T09:42:45.829Z\",\n    \"speed\": 1\n  ]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/campaigns\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/bridges/pending":{"parameters":[],"post":{"summary":"Create pending connection","description":"Park the credentials of a connection that started in the host until the customer finishes it in the console.\n\n\n\nRequires a bridge key without the `X-Install-Id` header. `externalAccountId` is optional, because the host account may not exist yet: the bridge sets it with `PATCH /v1/install` once the install is created. The vault is stored encrypted and expires in 30 minutes.","operationId":"createPending","security":[{"apiKey":[]}],"tags":["Integrations"],"parameters":[{"name":"body","in":"body","required":false,"schema":{"type":"object"}}],"responses":{"400":{"description":"A body this route cannot serve"},"503":{"description":"The vault store is not available right now"},"default":{"description":"The id of the pending connection","schema":{"type":"object"}}}}},"/bridges/installs":{"parameters":[],"get":{"summary":"Bridge installs","description":"List the active CRM installs of the calling bridge, or find the one of a host account.\n\n\n\nRequires a bridge key without the `X-Install-Id` header. Pass `externalAccountId` to look one up, or `status=active` with `cursor` and `size` to page through them all.","operationId":"listInstalls","security":[{"apiKey":[]}],"tags":["Integrations"],"parameters":[{"name":"externalAccountId","in":"query","required":false,"type":"string"},{"name":"status","in":"query","required":false,"type":"string"},{"name":"cursor","in":"query","required":false,"type":"string"},{"name":"size","in":"query","required":false,"type":"string"}],"responses":{"400":{"description":"A query this route cannot serve"},"403":{"description":"The token is not a bridge key, or carries an install"},"default":{"description":"Installs of the bridge","schema":{"type":"object"}}}}},"/bridges/exchange":{"parameters":[],"post":{"summary":"Exchange install code","description":"Exchange the one-time code of a console connection for the install behind it.\n\n\n\nRequires a bridge key without the `X-Install-Id` header. A code can be exchanged once: the second time it answers 409 `install:code_used`. `fromPending` says the install came from a pending connection started in the host, and `reconnect` that the customer reconnected an install that already existed.\n\n\n\nPass as `origin` the Origin of the request the customer's browser sent to the bridge. A code bound to the console that asked for it only goes with that origin: any other answers 403 `install:code_origin` and leaves the code unspent.","operationId":"exchangeCode","security":[{"apiKey":[]}],"tags":["Integrations"],"parameters":[{"name":"body","in":"body","required":false,"schema":{"type":"object"}}],"responses":{"400":{"description":"A key the body cannot carry"},"401":{"description":"The code does not exist, belongs to another bridge or expired"},"403":{"description":"The install was revoked, or the code is bound to another console origin"},"409":{"description":"The code was already exchanged"},"default":{"description":"The install of the code","schema":{"type":"object"}}}}},"/analytics":{"parameters":[],"get":{"summary":"Get analytics","description":"Retrieve chat usage analytics metrics in a specific time window per WhastApp device and/or team members\n\n\n\n**Note**: analytics is only available in Platform Business and Enterprise plans, otherwise the API will return a 409 error\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fanalytics&params=%5B%7B%22key%22%3A%22timeframe%22%2C%22value%22%3A%22hour%22%7D%2C%7B%22key%22%3A%22device%22%2C%22value%22%3A%22%7B%7Bdevice.id%7D%7D%22%7D%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getAnalytics","security":[{"apiKey":[]}],"tags":["Analytics"],"produces":["application/json"],"parameters":[{"in":"query","name":"from","type":"string","format":"date-time","required":true,"description":"Start date in ISO 8601 format. Example: `2023-01-15T00:00:00.000Z`"},{"in":"query","name":"to","type":"string","format":"date-time","required":true,"description":"End date in ISO 8601 format. Example: `2023-02-15T00:00:00.000Z`"},{"in":"query","name":"compareFrom","type":"string","format":"date-time","description":"Compare start date in ISO 8601 format. Example: `2023-01-15T00:00:00.000Z`"},{"in":"query","name":"compareTo","type":"string","format":"date-time","description":"Compare end date in ISO 8601 format. Example: `2023-02-15T00:00:00.000Z`"},{"in":"query","name":"timeframe","type":"string","default":"daily","enum":["hourly","daily","monthly"],"description":"Time frame data unit for aggregated metrics data"},{"in":"query","name":"scope","type":"string","default":"chat","enum":["agent","chat"],"description":"Metrics data scope"},{"in":"query","name":"include","type":"array","collectionFormat":"csv","description":"Include team members (agents) data in the response","items":{"type":"string","enum":["agents"]}},{"in":"query","name":"exclude","type":"array","collectionFormat":"csv","description":"Exclude chats data in the response","items":{"type":"string","enum":["chats"]}},{"in":"query","name":"devices","type":"array","minItems":1,"maxItems":10,"collectionFormat":"csv","description":"Filter by WhatsApp device IDs","items":{"type":"string","maxLength":24,"minLength":24,"pattern":"^[0-9A-Fa-f]{24}$"}},{"in":"query","name":"agents","type":"array","collectionFormat":"csv","description":"Filter by agents","maxItems":30,"items":{"type":"string","maxLength":24,"minLength":24,"pattern":"^[0-9A-Fa-f]{24}$"}},{"in":"query","name":"compareDevices","type":"array","collectionFormat":"csv","description":"Compate to WhatsApp device IDs","maxItems":10,"items":{"type":"string","maxLength":24,"minLength":24,"pattern":"^[0-9A-Fa-f]{24}$"}}],"responses":{"200":{"description":"Analytics data","schema":{"type":"object","properties":{"metrics":{"type":"array"},"compares":{"type":"array"}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Analytics not supported in the current plan","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Retrieve chat usage analytics\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/analytics?timeframe=hour&device={{device.id}}' \\\n  --header 'Token: <api token goes here>'\n\n\n// Retrieve chat usage per team member\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/analytics?timeframe=daily&scope=agent&agents={{user.id}}%2C{{user.id}}' \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Retrieve chat usage analytics\nhttp GET 'https://api.wassenger.com/v1/analytics?timeframe=hour&device={{device.id}}' \\\n  Token:'<api token goes here>'\n\n\n// Retrieve chat usage per team member\nhttp GET 'https://api.wassenger.com/v1/analytics?timeframe=daily&scope=agent&agents={{user.id}}%2C{{user.id}}' \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Retrieve chat usage analytics\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/analytics?timeframe=hour&device={{device.id}}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Retrieve chat usage per team member\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/analytics?timeframe=daily&scope=agent&agents={{user.id}}%2C{{user.id}}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Retrieve chat usage analytics\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/analytics',\n  params: {timeframe: 'hour', device: '{{device.id}}'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Retrieve chat usage per team member\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/analytics',\n  params: {timeframe: 'daily', scope: 'agent', agents: '{{user.id}},{{user.id}}'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Retrieve chat usage analytics\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/analytics');\n\nreq.query({\n  timeframe: 'hour',\n  device: '{{device.id}}'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Retrieve chat usage per team member\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/analytics');\n\nreq.query({\n  timeframe: 'daily',\n  scope: 'agent',\n  agents: '{{user.id}},{{user.id}}'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Retrieve chat usage analytics\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/analytics?timeframe=hour&device={{device.id}}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Retrieve chat usage per team member\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/analytics?timeframe=daily&scope=agent&agents={{user.id}}%2C{{user.id}}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Retrieve chat usage analytics\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/analytics');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'timeframe' => 'hour',\n  'device' => '{{device.id}}'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Retrieve chat usage per team member\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/analytics');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'timeframe' => 'daily',\n  'scope' => 'agent',\n  'agents' => '{{user.id}},{{user.id}}'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Retrieve chat usage analytics\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/analytics?timeframe=hour&device={{device.id}}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Retrieve chat usage per team member\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/analytics?timeframe=daily&scope=agent&agents={{user.id}}%2C{{user.id}}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Retrieve chat usage analytics\nimport requests\n\nurl = \"https://api.wassenger.com/v1/analytics\"\n\nquerystring = {\"timeframe\":\"hour\",\"device\":\"{{device.id}}\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Retrieve chat usage per team member\nimport requests\n\nurl = \"https://api.wassenger.com/v1/analytics\"\n\nquerystring = {\"timeframe\":\"daily\",\"scope\":\"agent\",\"agents\":\"{{user.id}},{{user.id}}\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Retrieve chat usage analytics\nconst url = 'https://api.wassenger.com/v1/analytics?timeframe=hour&device={{device.id}}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Retrieve chat usage per team member\nconst url = 'https://api.wassenger.com/v1/analytics?timeframe=daily&scope=agent&agents={{user.id}}%2C{{user.id}}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Retrieve chat usage analytics\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/analytics?timeframe=hour&device={{device.id}}',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Retrieve chat usage per team member\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/analytics?timeframe=daily&scope=agent&agents={{user.id}}%2C{{user.id}}',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Retrieve chat usage analytics\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/analytics?timeframe=hour&device={{device.id}}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Retrieve chat usage per team member\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/analytics?timeframe=daily&scope=agent&agents={{user.id}}%2C{{user.id}}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Retrieve chat usage analytics\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/analytics?timeframe=hour&device={{device.id}}\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Retrieve chat usage per team member\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/analytics?timeframe=daily&scope=agent&agents={{user.id}}%2C{{user.id}}\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Retrieve chat usage analytics\nvar client = new RestClient(\"https://api.wassenger.com/v1/analytics?timeframe=hour&device={{device.id}}\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Retrieve chat usage per team member\nvar client = new RestClient(\"https://api.wassenger.com/v1/analytics?timeframe=daily&scope=agent&agents={{user.id}}%2C{{user.id}}\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Retrieve chat usage analytics\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/analytics?timeframe=hour&device={{device.id}}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Retrieve chat usage per team member\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/analytics?timeframe=daily&scope=agent&agents={{user.id}}%2C{{user.id}}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Retrieve chat usage analytics\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/analytics?timeframe=hour&device={{device.id}}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Retrieve chat usage per team member\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/analytics?timeframe=daily&scope=agent&agents={{user.id}}%2C{{user.id}}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Retrieve chat usage analytics\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/analytics?timeframe=hour&device={{device.id}}\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Retrieve chat usage per team member\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/analytics?timeframe=daily&scope=agent&agents={{user.id}}%2C{{user.id}}\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Retrieve chat usage analytics\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/analytics?timeframe=hour&device={{device.id}}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Retrieve chat usage per team member\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/analytics?timeframe=daily&scope=agent&agents={{user.id}}%2C{{user.id}}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Retrieve chat usage analytics\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/analytics?timeframe=hour&device={{device.id}}' -Method GET -Headers $headers\n\n\n# Retrieve chat usage per team member\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/analytics?timeframe=daily&scope=agent&agents={{user.id}}%2C{{user.id}}' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Retrieve chat usage analytics\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/analytics?timeframe=hour&device={{device.id}}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Retrieve chat usage per team member\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/analytics?timeframe=daily&scope=agent&agents={{user.id}}%2C{{user.id}}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Retrieve chat usage analytics\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/analytics?timeframe=hour&device={{device.id}}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Retrieve chat usage per team member\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/analytics?timeframe=daily&scope=agent&agents={{user.id}}%2C{{user.id}}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/webhooks/{webhookId}/logs":{"parameters":[],"get":{"summary":"Get webhook logs","description":"Get webhook logs by ID\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fwebhooks%2F%7Bid%7D%2Flogs)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getWebhookLogs","security":[{"apiKey":[]}],"tags":["Webhooks"],"consumes":["application/json"],"parameters":[{"in":"query","name":"size","description":"Maximum entries to retrieve","type":"number","format":"integer","default":50,"minimum":1,"maximum":100},{"in":"query","name":"skip","description":"Number of entries to skip","type":"number","format":"integer","default":0,"minimum":0,"maximum":300}],"responses":{"200":{"description":"Webhook logs","schema":{"type":"array","items":{"$ref":"#/definitions/webhookLog"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get webhook logs by ID\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/webhooks/{id}/logs \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get webhook logs by ID\nhttp GET https://api.wassenger.com/v1/webhooks/{id}/logs \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get webhook logs by ID\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/webhooks/{id}/logs';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get webhook logs by ID\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/webhooks/{id}/logs',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get webhook logs by ID\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/webhooks/{id}/logs');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get webhook logs by ID\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/webhooks/{id}/logs', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get webhook logs by ID\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/webhooks/{id}/logs');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get webhook logs by ID\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/webhooks/{id}/logs\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get webhook logs by ID\nimport requests\n\nurl = \"https://api.wassenger.com/v1/webhooks/{id}/logs\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get webhook logs by ID\nconst url = 'https://api.wassenger.com/v1/webhooks/{id}/logs';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get webhook logs by ID\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/webhooks/{id}/logs',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get webhook logs by ID\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/webhooks/{id}/logs\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get webhook logs by ID\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/webhooks/{id}/logs\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get webhook logs by ID\nvar client = new RestClient(\"https://api.wassenger.com/v1/webhooks/{id}/logs\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get webhook logs by ID\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/webhooks/{id}/logs\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get webhook logs by ID\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/webhooks/{id}/logs\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get webhook logs by ID\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/webhooks/{id}/logs\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get webhook logs by ID\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/webhooks/{id}/logs\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get webhook logs by ID\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/webhooks/{id}/logs' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get webhook logs by ID\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/webhooks/{id}/logs\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get webhook logs by ID\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/webhooks/{id}/logs\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/webhooks/{webhookId}/enable":{"parameters":[],"post":{"summary":"Enable webhook","description":"Enable the specific webhook endpoint, in case the webhook was disabled manually or automatically in case of many failures.\n\n\n\nWebhook manual or API automated re-activation is usually required after too many failures in a row, which will automatically disable the webhook endpoint and alert you via email about the issue for manual action.\n\n\n\nWebhooks are automatically disabled when their failure count reaches 60. The count goes up by one at most once every 2 minutes, however many failures happen in that time, so this takes about 2 hours of continuous failures. A successful delivery resets the count to 0, and so does enabling the webhook.\n\n\n\nOn QR numbers, the `message:in:new`, `message:out:new` and `channel:in` events the webhook missed while it was disabled after too many failures are kept for 7 days from the message, and sent within about 15 minutes of enabling it again, except a `message:out:new` that another webhook of the number already received.\n\n\n\n**Note**: it is recommended to inspect the failing or failed webhook logs in order to better diagnosticate the problem with your webhook communication.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fwebhooks%2F%7BwebhookId%7D%2Fenable&method=POST&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"enableWebhook","security":[{"apiKey":[]}],"tags":["Webhooks"],"consumes":["application/json"],"produces":["application/json"],"parameters":[],"responses":{"202":{"description":"Webhook enabled","schema":{"$ref":"#/definitions/webhook"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Enable webhook endpoint\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/webhooks/{webhookId}/enable \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Enable webhook endpoint\nhttp POST https://api.wassenger.com/v1/webhooks/{webhookId}/enable \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Enable webhook endpoint\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/webhooks/{webhookId}/enable';\nconst options = {method: 'POST', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Enable webhook endpoint\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/webhooks/{webhookId}/enable',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Enable webhook endpoint\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/webhooks/{webhookId}/enable');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Enable webhook endpoint\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/webhooks/{webhookId}/enable', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Enable webhook endpoint\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/webhooks/{webhookId}/enable');\n$request->setRequestMethod('POST');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Enable webhook endpoint\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/webhooks/{webhookId}/enable\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Enable webhook endpoint\nimport requests\n\nurl = \"https://api.wassenger.com/v1/webhooks/{webhookId}/enable\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.post(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Enable webhook endpoint\nconst url = 'https://api.wassenger.com/v1/webhooks/{webhookId}/enable';\nconst options = {method: 'POST', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Enable webhook endpoint\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/webhooks/{webhookId}/enable',\n  method: 'POST',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Enable webhook endpoint\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/webhooks/{webhookId}/enable\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Enable webhook endpoint\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/webhooks/{webhookId}/enable\"\n\n\treq, _ := http.NewRequest(\"POST\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Enable webhook endpoint\nvar client = new RestClient(\"https://api.wassenger.com/v1/webhooks/{webhookId}/enable\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Enable webhook endpoint\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/webhooks/{webhookId}/enable\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Enable webhook endpoint\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/webhooks/{webhookId}/enable\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Enable webhook endpoint\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/webhooks/{webhookId}/enable\")\n  .post(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Enable webhook endpoint\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/webhooks/{webhookId}/enable\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Enable webhook endpoint\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/webhooks/{webhookId}/enable' -Method POST -Headers $headers"},{"lang":"ObjC","source":"// Enable webhook endpoint\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/webhooks/{webhookId}/enable\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Enable webhook endpoint\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/webhooks/{webhookId}/enable\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/webhooks/{webhookId}":{"parameters":[],"get":{"summary":"Get webhook details","description":"Get webhook details by ID\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fwebhooks%2F%7Bid%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getWebhook","security":[{"apiKey":[]}],"tags":["Webhooks"],"consumes":["application/json"],"parameters":[],"responses":{"200":{"description":"Get webhook by ID","schema":{"$ref":"#/definitions/webhook"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get webhook by ID\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/webhooks/{id} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get webhook by ID\nhttp GET https://api.wassenger.com/v1/webhooks/{id} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get webhook by ID\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/webhooks/{id}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get webhook by ID\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/webhooks/{id}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get webhook by ID\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/webhooks/{id}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get webhook by ID\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/webhooks/{id}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get webhook by ID\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/webhooks/{id}');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get webhook by ID\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/webhooks/{id}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get webhook by ID\nimport requests\n\nurl = \"https://api.wassenger.com/v1/webhooks/{id}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get webhook by ID\nconst url = 'https://api.wassenger.com/v1/webhooks/{id}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get webhook by ID\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/webhooks/{id}',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get webhook by ID\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/webhooks/{id}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get webhook by ID\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/webhooks/{id}\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get webhook by ID\nvar client = new RestClient(\"https://api.wassenger.com/v1/webhooks/{id}\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get webhook by ID\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/webhooks/{id}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get webhook by ID\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/webhooks/{id}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get webhook by ID\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/webhooks/{id}\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get webhook by ID\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/webhooks/{id}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get webhook by ID\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/webhooks/{id}' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get webhook by ID\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/webhooks/{id}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get webhook by ID\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/webhooks/{id}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Update webhook","description":"Update existent webhook URL\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fwebhooks%2F%7Bid%7D&method=PATCH&body=%7B%0A%20%20%22name%22%3A%20%22My%20custom%20webhook%22%2C%0A%20%20%22url%22%3A%20%22http%3A%2F%2Fwebhook.company.com%22%2C%0A%20%20%22events%22%3A%20%5B%0A%20%20%20%20%22message%3Aout%3Asent%22%2C%0A%20%20%20%20%22message%3Aout%3Afailed%22%0A%20%20%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateWebhook","security":[{"apiKey":[]}],"tags":["Webhooks"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"webhook","schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":30,"description":"Webhook internal name for your reference"},"device":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Restrict webhook events to specific a device. Pass the device ID here (24 alphanumeric characters)."},"url":{"type":"string","minLength":6,"maxLength":500,"description":"Webhook endpoint URL. Must be a valid URL with http or https scheme that is reachable from the Internet. Local or private networks IPs or domains are not allowed."},"events":{"type":"array","items":{"type":"string","enum":["message:in:new","message:out:new","message:out:sent","message:out:ack","message:out:failed","channel:in","message:update","status:update","message:reaction","message:flow:response","group:update","chat:update","contact:update","number:session","deal:stage:changed","deal:won","deal:lost","deal:assigned","deal:updated","deal:archived","deal:reopened"]},"minItems":1,"maxItems":21,"description":"Event or events to be notified on this webhook endpoint. See the events description above for more information."}},"required":["name","url","events"],"additionalProperties":false}}],"responses":{"202":{"description":"Webhook updated","schema":{"$ref":"#/definitions/webhook"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Update webhook URL\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/webhooks/{id} \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"name\":\"My custom webhook\",\"url\":\"http://webhook.company.com\",\"events\":[\"message:out:sent\",\"message:out:failed\"]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Update webhook URL\necho '{\"name\":\"My custom webhook\",\"url\":\"http://webhook.company.com\",\"events\":[\"message:out:sent\",\"message:out:failed\"]}' |  \\\n  http PATCH https://api.wassenger.com/v1/webhooks/{id} \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Update webhook URL\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/webhooks/{id}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"My custom webhook\",\"url\":\"http://webhook.company.com\",\"events\":[\"message:out:sent\",\"message:out:failed\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Update webhook URL\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/webhooks/{id}',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    name: 'My custom webhook',\n    url: 'http://webhook.company.com',\n    events: ['message:out:sent', 'message:out:failed']\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Update webhook URL\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/webhooks/{id}');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  name: 'My custom webhook',\n  url: 'http://webhook.company.com',\n  events: [\n    'message:out:sent',\n    'message:out:failed'\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Update webhook URL\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/webhooks/{id}', [\n  'body' => '{\"name\":\"My custom webhook\",\"url\":\"http://webhook.company.com\",\"events\":[\"message:out:sent\",\"message:out:failed\"]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Update webhook URL\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'name' => 'My custom webhook',\n  'url' => 'http://webhook.company.com',\n  'events' => [\n    'message:out:sent',\n    'message:out:failed'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/webhooks/{id}');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Update webhook URL\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/webhooks/{id}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'name' => 'My custom webhook',\n    'url' => 'http://webhook.company.com',\n    'events' => [\n        'message:out:sent',\n        'message:out:failed'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Update webhook URL\nimport requests\n\nurl = \"https://api.wassenger.com/v1/webhooks/{id}\"\n\npayload = {\n    \"name\": \"My custom webhook\",\n    \"url\": \"http://webhook.company.com\",\n    \"events\": [\"message:out:sent\", \"message:out:failed\"]\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update webhook URL\nconst url = 'https://api.wassenger.com/v1/webhooks/{id}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"My custom webhook\",\"url\":\"http://webhook.company.com\",\"events\":[\"message:out:sent\",\"message:out:failed\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update webhook URL\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/webhooks/{id}',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"name\":\"My custom webhook\",\"url\":\"http://webhook.company.com\",\"events\":[\"message:out:sent\",\"message:out:failed\"]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Update webhook URL\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/webhooks/{id}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"name\\\":\\\"My custom webhook\\\",\\\"url\\\":\\\"http://webhook.company.com\\\",\\\"events\\\":[\\\"message:out:sent\\\",\\\"message:out:failed\\\"]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Update webhook URL\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/webhooks/{id}\"\n\n\tpayload := strings.NewReader(\"{\\\"name\\\":\\\"My custom webhook\\\",\\\"url\\\":\\\"http://webhook.company.com\\\",\\\"events\\\":[\\\"message:out:sent\\\",\\\"message:out:failed\\\"]}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Update webhook URL\nvar client = new RestClient(\"https://api.wassenger.com/v1/webhooks/{id}\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"name\\\":\\\"My custom webhook\\\",\\\"url\\\":\\\"http://webhook.company.com\\\",\\\"events\\\":[\\\"message:out:sent\\\",\\\"message:out:failed\\\"]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Update webhook URL\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/webhooks/{id}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"name\\\":\\\"My custom webhook\\\",\\\"url\\\":\\\"http://webhook.company.com\\\",\\\"events\\\":[\\\"message:out:sent\\\",\\\"message:out:failed\\\"]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Update webhook URL\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/webhooks/{id}\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"name\\\":\\\"My custom webhook\\\",\\\"url\\\":\\\"http://webhook.company.com\\\",\\\"events\\\":[\\\"message:out:sent\\\",\\\"message:out:failed\\\"]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Update webhook URL\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"name\\\":\\\"My custom webhook\\\",\\\"url\\\":\\\"http://webhook.company.com\\\",\\\"events\\\":[\\\"message:out:sent\\\",\\\"message:out:failed\\\"]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/webhooks/{id}\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Update webhook URL\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/webhooks/{id}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"name\\\":\\\"My custom webhook\\\",\\\"url\\\":\\\"http://webhook.company.com\\\",\\\"events\\\":[\\\"message:out:sent\\\",\\\"message:out:failed\\\"]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Update webhook URL\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/webhooks/{id}' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"name\":\"My custom webhook\",\"url\":\"http://webhook.company.com\",\"events\":[\"message:out:sent\",\"message:out:failed\"]}'"},{"lang":"ObjC","source":"// Update webhook URL\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"name\": @\"My custom webhook\",\n                              @\"url\": @\"http://webhook.company.com\",\n                              @\"events\": @[ @\"message:out:sent\", @\"message:out:failed\" ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/webhooks/{id}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Update webhook URL\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"name\": \"My custom webhook\",\n  \"url\": \"http://webhook.company.com\",\n  \"events\": [\"message:out:sent\", \"message:out:failed\"]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/webhooks/{id}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Delete webhook","description":"Delete webhook endpoint.\n\nAfter a webhook removal, no more events will be notified to the webhook endpoint.\n\nThis would take instant effects.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fwebhooks%2F%7Bid%7D&method=DELETE&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deleteWebhook","security":[{"apiKey":[]}],"tags":["Webhooks"],"consumes":["application/json"],"produces":["application/json"],"parameters":[],"responses":{"204":{"description":"Webhook removed"},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Delete webhook by ID\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/webhooks/{id} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Delete webhook by ID\nhttp DELETE https://api.wassenger.com/v1/webhooks/{id} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Delete webhook by ID\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/webhooks/{id}';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Delete webhook by ID\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/webhooks/{id}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Delete webhook by ID\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/webhooks/{id}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Delete webhook by ID\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/webhooks/{id}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Delete webhook by ID\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/webhooks/{id}');\n$request->setRequestMethod('DELETE');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Delete webhook by ID\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/webhooks/{id}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Delete webhook by ID\nimport requests\n\nurl = \"https://api.wassenger.com/v1/webhooks/{id}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.delete(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete webhook by ID\nconst url = 'https://api.wassenger.com/v1/webhooks/{id}';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete webhook by ID\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/webhooks/{id}',\n  method: 'DELETE',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Delete webhook by ID\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/webhooks/{id}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Delete webhook by ID\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/webhooks/{id}\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Delete webhook by ID\nvar client = new RestClient(\"https://api.wassenger.com/v1/webhooks/{id}\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Delete webhook by ID\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/webhooks/{id}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Delete webhook by ID\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/webhooks/{id}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Delete webhook by ID\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/webhooks/{id}\")\n  .delete(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Delete webhook by ID\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/webhooks/{id}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Delete webhook by ID\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/webhooks/{id}' -Method DELETE -Headers $headers"},{"lang":"ObjC","source":"// Delete webhook by ID\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/webhooks/{id}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Delete webhook by ID\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/webhooks/{id}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/pipelines/{pipelineId}/summary":{"parameters":[],"get":{"summary":"Get pipeline summary","description":"Per-stage counters and open amount totals for the board columns, plus the won and lost totals.\n\n\n\nEach stage row also carries `closed` (`{count, amount, mixedCurrency, currency}`): the deals that finished in that stage over the whole life of the pipeline. A won or lost stage holds no open deals by construction, so its `count`/`amount` pair is always zero and `closed` is the only figure that describes it.\n\n\n\n`closedOffStage` carries the same shape for the closed deals whose stage is no longer part of the pipeline, which a stage deleted after deals were decided in it leaves behind. The per-stage `closed` figures plus `closedOffStage` always add up to `won` plus `lost`; without the second term they would silently stop doing so.\n\n\n\nThose totals come in two windows: `won` and `lost` cover the whole life of the pipeline, `won30d` and `lost30d` the last 30 days, measured from the `since` date in the response. An archived pipeline is read by the lifetime pair: a funnel retired more than a month ago has an empty 30-day window, and its history is exactly what archiving keeps.\n\n\n\n`wonPrev30d` and `lostPrev30d` carry the same pair for the window immediately BEFORE that one, `[previousSince, since)`, which is what a variation is measured against. The two windows are half-open and meet at `since`, so no deal is counted by both. A period in which nothing closed is returned as a zero rather than omitted, because \"nothing closed then\" and \"this was not measured\" are different answers: there is no percentage between no deals and five, so a caller reading a zero here should omit the variation rather than divide by it.\n\n\n\nAlso returns `lostReasonStats`: the reasons the lost deals were lost, one entry per reason with its lifetime `count` and `amount` plus the `count30d` / `amount30d` of those that closed inside the window, ranked by count and then by amount. Deals closed without a reason are grouped into a single entry whose `reason` is `null`, and that entry is always returned. A reason is free text, so at most 20 named reasons are ranked and returned, and everything left over is summed into `lostReasonStatsOther` (`{reasons, count, amount, count30d, amount30d, mixedCurrency, currency, mixedCurrency30d, currency30d}`, or `null` when nothing was left over). The remainder is worked out by subtracting the listed entries from the lost totals rather than by reading the tail, so the two always add up to `lost`, and their 30-day halves to `lost30d`, exactly.\n\n\n\n`mixedCurrency` carries one flag per figure (`open`, `won`, `lost`, `won30d`, `lost30d`, `wonPrev30d`, `lostPrev30d`), and each stage row and each loss reason carries its own (a loss reason carries `mixedCurrency30d` for its windowed half too). A true flag means the deals behind that amount do not all share one currency: `deal.currency` is seeded from the pipeline currency but can be set per deal, and no exchange rate is applied anywhere, so the amount is a sum of different units and should not be printed as a single figure. A deal that states no currency of its own is not a second currency. The remainder entry answers this question conservatively: it is subtracted rather than read, so it reports one unit only when every lost deal in the funnel shares it.\n\n\n\n`currencies` mirrors it with the unit each figure IS in, and every stage row and loss reason carries its own `currency` (and `currency30d`) too. It is `null` exactly when the matching flag is true. This is not the same answer as `currency`, the pipeline's own unit: a pipeline priced in EUR whose deals were all stored in USD mixes nothing, and pricing its totals in the pipeline currency would print dollars with a euro sign.\n\n\n\nRestricted agents only see figures for their own deals, and `scope` says which of the two the response is: `account` for the whole funnel, `agent` when every figure has been narrowed to the reader.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fpipelines%2F%7BpipelineId%7D%2Fsummary)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getPipelineSummary","security":[{"apiKey":[]}],"tags":["Funnel"],"parameters":[],"responses":{"200":{"description":"Pipeline summary"},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Pipeline not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get the pipeline board summary\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/pipelines/{pipelineId}/summary \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get the pipeline board summary\nhttp GET https://api.wassenger.com/v1/pipelines/{pipelineId}/summary \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get the pipeline board summary\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/pipelines/{pipelineId}/summary';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get the pipeline board summary\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/pipelines/{pipelineId}/summary',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get the pipeline board summary\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/pipelines/{pipelineId}/summary');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get the pipeline board summary\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/pipelines/{pipelineId}/summary', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get the pipeline board summary\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/pipelines/{pipelineId}/summary');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get the pipeline board summary\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/pipelines/{pipelineId}/summary\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get the pipeline board summary\nimport requests\n\nurl = \"https://api.wassenger.com/v1/pipelines/{pipelineId}/summary\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get the pipeline board summary\nconst url = 'https://api.wassenger.com/v1/pipelines/{pipelineId}/summary';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get the pipeline board summary\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/pipelines/{pipelineId}/summary',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get the pipeline board summary\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/pipelines/{pipelineId}/summary\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get the pipeline board summary\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/pipelines/{pipelineId}/summary\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get the pipeline board summary\nvar client = new RestClient(\"https://api.wassenger.com/v1/pipelines/{pipelineId}/summary\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get the pipeline board summary\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/pipelines/{pipelineId}/summary\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get the pipeline board summary\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/pipelines/{pipelineId}/summary\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get the pipeline board summary\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/pipelines/{pipelineId}/summary\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get the pipeline board summary\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/pipelines/{pipelineId}/summary\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get the pipeline board summary\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/pipelines/{pipelineId}/summary' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get the pipeline board summary\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/pipelines/{pipelineId}/summary\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get the pipeline board summary\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/pipelines/{pipelineId}/summary\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/pipelines/{pipelineId}":{"parameters":[],"get":{"summary":"Get pipeline","description":"Get a sales pipeline by ID\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fpipelines%2F%7BpipelineId%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getPipeline","security":[{"apiKey":[]}],"tags":["Pipeline"],"parameters":[],"responses":{"200":{"description":"Pipeline information","schema":{"$ref":"#/definitions/pipeline"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Pipeline not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get a pipeline by ID\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/pipelines/{pipelineId} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get a pipeline by ID\nhttp GET https://api.wassenger.com/v1/pipelines/{pipelineId} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get a pipeline by ID\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/pipelines/{pipelineId}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get a pipeline by ID\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/pipelines/{pipelineId}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get a pipeline by ID\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/pipelines/{pipelineId}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get a pipeline by ID\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/pipelines/{pipelineId}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get a pipeline by ID\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/pipelines/{pipelineId}');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get a pipeline by ID\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/pipelines/{pipelineId}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get a pipeline by ID\nimport requests\n\nurl = \"https://api.wassenger.com/v1/pipelines/{pipelineId}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get a pipeline by ID\nconst url = 'https://api.wassenger.com/v1/pipelines/{pipelineId}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get a pipeline by ID\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/pipelines/{pipelineId}',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get a pipeline by ID\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/pipelines/{pipelineId}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get a pipeline by ID\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/pipelines/{pipelineId}\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get a pipeline by ID\nvar client = new RestClient(\"https://api.wassenger.com/v1/pipelines/{pipelineId}\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get a pipeline by ID\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/pipelines/{pipelineId}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get a pipeline by ID\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/pipelines/{pipelineId}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get a pipeline by ID\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/pipelines/{pipelineId}\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get a pipeline by ID\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/pipelines/{pipelineId}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get a pipeline by ID\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/pipelines/{pipelineId}' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get a pipeline by ID\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/pipelines/{pipelineId}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get a pipeline by ID\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/pipelines/{pipelineId}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Update pipeline","description":"Update a sales pipeline by ID.\n\n\n\nStages are merged by their stable `id`: a stage matching a stored id inherits every omitted field, new stages are assigned a fresh id, and stored stages missing from the payload are removed, unless open deals remain in them (409: move, close or archive them first). The pipeline must always keep at least one open, one won and one lost stage.\n\n\n\nStage order is the array order. The won and lost stages must come after all the open ones, or the update is refused with a 400: a deal advances to the next open stage by position, so a terminal stage in the middle would be skipped over. A pipeline already stored out of order is exempt, so it stays editable while it is put right.\n\n\n\nSend `archived: true` to archive the pipeline. Archiving is allowed with open deals and leaves every one of them untouched: the pipeline drops out of the default list, stamps `archivedAt`, keeps all its history readable and stops taking new deals (`POST /deals` answers 409) and AI analysis. Send `archived: false` to restore it, which re-checks the plan pipeline limit (429, `pipelines:quota_exceeded`) and the name uniqueness against the active pipelines (409, `pipelines:name_in_use`), because an archived pipeline consumes neither while it is archived. A rename sent in the same request is the name the uniqueness is checked on, which is how a collision is resolved from a screen with no name field.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fpipelines%2F%7BpipelineId%7D&method=PATCH&body=%7B%0A%20%20%22pipeline%22%3A%20%225f7b1b1b1b1b1b1b1b1b1b1b%22%2C%0A%20%20%22name%22%3A%20%22Ventas%20B2B%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updatePipeline","security":[{"apiKey":[]}],"tags":["Pipeline"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"pipeline","description":"Update pipeline","schema":{"type":"object","properties":{"pipeline":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Pipeline unique ID to update. Required"},"name":{"type":"string","minLength":2,"maxLength":30,"description":"Pipeline name"},"description":{"type":"string","minLength":0,"maxLength":300,"description":"Pipeline description"},"color":{"type":"string","minLength":1,"maxLength":30,"description":"Pipeline color name"},"icon":{"type":"string","enum":["funnel-dollar","filter","chart-line","handshake","money-bill-wave","bullseye","flag-checkered","coins","chart-pie","briefcase"],"description":"Pipeline icon identifier"},"devices":{"type":"array","items":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Device ID fed into this pipeline"},"maxItems":50,"description":"Devices that feed this pipeline. Empty means all the account devices"},"currency":{"type":["string","null"],"minLength":3,"maxLength":3,"description":"ISO 4217 currency code for deal amounts, or null to clear it back to the account default"},"entry":{"type":"object","properties":{"mode":{"type":"string","enum":["manual","filter","all"],"description":"How chats enter this pipeline: manual, filter or all. Persisted value is preserved when omitted"},"filters":{"type":"object","properties":{"labels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":20,"description":"Chat labels that make a chat enter the pipeline"},"type":{"type":"array","items":{"type":"string","enum":["chat","group","channel","broadcast"]},"maxItems":4,"description":"Chat types that make a chat enter the pipeline"}},"additionalProperties":false,"description":"Entry filters, only used when mode is filter"}},"additionalProperties":false,"description":"Entry rule configuration"},"stages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40,"description":"Stable stage identifier. Assigned by the server when omitted"},"name":{"type":"string","minLength":1,"maxLength":30,"description":"Stage name"},"color":{"type":"string","minLength":1,"maxLength":30,"description":"Stage color name used for quick identification"},"position":{"type":"integer","minimum":0,"maximum":99,"description":"Stage order position. Derived from the array order when omitted"},"kind":{"type":"string","enum":["open","won","lost"],"description":"Stage kind: open, won or lost. Persisted value is preserved when omitted on update"},"slaDays":{"type":["integer","null"],"minimum":1,"maximum":365,"description":"Maximum days a deal may stay in this stage before being flagged as stalled"},"labelMap":{"type":["string","null"],"minLength":1,"maxLength":40,"description":"Chat label name mapped to this stage"},"actions":{"type":"object","properties":{"assignAgent":{"type":["string","null"],"pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Agent to assign when a deal enters this stage"},"assignDepartment":{"type":["string","null"],"pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Department to assign when a deal enters this stage"},"addLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":10,"description":"Labels to add when a deal enters this stage"},"removeLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":10,"description":"Labels to remove when a deal enters this stage"}},"additionalProperties":false,"description":"Automatic actions fired when a deal enters this stage"}},"required":["name"],"additionalProperties":false},"minItems":3,"maxItems":20,"description":"Pipeline stages, in order. Stages matching a stored id are merged preserving omitted fields. The won and lost stages must come after all the open ones"},"lostReasons":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":20,"description":"Preset lost reasons"},"settings":{"type":"object","properties":{"closeChatOnWon":{"type":"boolean","description":"Resolve the chat when the deal is won"},"closeChatOnLost":{"type":"boolean","description":"Resolve the chat when the deal is lost"},"ai":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Enable AI analysis for deals in this pipeline"},"coolOffMinutes":{"type":"integer","minimum":5,"maximum":1440,"description":"Minutes without new messages before a conversation is analyzed"}},"additionalProperties":false,"description":"AI analysis settings"}},"additionalProperties":false,"description":"Pipeline behaviour settings"},"archived":{"type":"boolean","description":"Archive the pipeline (`true`) or restore it (`false`). Archiving leaves every deal untouched; restoring re-checks the plan pipeline limit and the name uniqueness against the active pipelines"}},"required":["pipeline"],"additionalProperties":false}}],"responses":{"200":{"description":"Pipeline updated","schema":{"$ref":"#/definitions/pipeline"}},"400":{"description":"Invalid pipeline configuration, or stages out of order","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Pipeline not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Pipeline name already in use (`pipelines:name_in_use`), or open deals remain in a removed stage","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Maximum allowed pipelines reached (`pipelines:quota_exceeded`): the account cannot restore an archived pipeline past its plan allowance","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Rename a pipeline\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/pipelines/{pipelineId} \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"pipeline\":\"5f7b1b1b1b1b1b1b1b1b1b1b\",\"name\":\"Ventas B2B\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Rename a pipeline\necho '{\"pipeline\":\"5f7b1b1b1b1b1b1b1b1b1b1b\",\"name\":\"Ventas B2B\"}' |  \\\n  http PATCH https://api.wassenger.com/v1/pipelines/{pipelineId} \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Rename a pipeline\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/pipelines/{pipelineId}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"pipeline\":\"5f7b1b1b1b1b1b1b1b1b1b1b\",\"name\":\"Ventas B2B\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Rename a pipeline\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/pipelines/{pipelineId}',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {pipeline: '5f7b1b1b1b1b1b1b1b1b1b1b', name: 'Ventas B2B'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Rename a pipeline\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/pipelines/{pipelineId}');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  pipeline: '5f7b1b1b1b1b1b1b1b1b1b1b',\n  name: 'Ventas B2B'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Rename a pipeline\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/pipelines/{pipelineId}', [\n  'body' => '{\"pipeline\":\"5f7b1b1b1b1b1b1b1b1b1b1b\",\"name\":\"Ventas B2B\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Rename a pipeline\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'pipeline' => '5f7b1b1b1b1b1b1b1b1b1b1b',\n  'name' => 'Ventas B2B'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/pipelines/{pipelineId}');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Rename a pipeline\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/pipelines/{pipelineId}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'pipeline' => '5f7b1b1b1b1b1b1b1b1b1b1b',\n    'name' => 'Ventas B2B'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Rename a pipeline\nimport requests\n\nurl = \"https://api.wassenger.com/v1/pipelines/{pipelineId}\"\n\npayload = {\n    \"pipeline\": \"5f7b1b1b1b1b1b1b1b1b1b1b\",\n    \"name\": \"Ventas B2B\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Rename a pipeline\nconst url = 'https://api.wassenger.com/v1/pipelines/{pipelineId}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"pipeline\":\"5f7b1b1b1b1b1b1b1b1b1b1b\",\"name\":\"Ventas B2B\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Rename a pipeline\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/pipelines/{pipelineId}',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"pipeline\":\"5f7b1b1b1b1b1b1b1b1b1b1b\",\"name\":\"Ventas B2B\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Rename a pipeline\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/pipelines/{pipelineId}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"pipeline\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\",\\\"name\\\":\\\"Ventas B2B\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Rename a pipeline\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/pipelines/{pipelineId}\"\n\n\tpayload := strings.NewReader(\"{\\\"pipeline\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\",\\\"name\\\":\\\"Ventas B2B\\\"}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Rename a pipeline\nvar client = new RestClient(\"https://api.wassenger.com/v1/pipelines/{pipelineId}\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"pipeline\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\",\\\"name\\\":\\\"Ventas B2B\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Rename a pipeline\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/pipelines/{pipelineId}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"pipeline\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\",\\\"name\\\":\\\"Ventas B2B\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Rename a pipeline\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/pipelines/{pipelineId}\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"pipeline\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\",\\\"name\\\":\\\"Ventas B2B\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Rename a pipeline\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"pipeline\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\",\\\"name\\\":\\\"Ventas B2B\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/pipelines/{pipelineId}\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Rename a pipeline\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/pipelines/{pipelineId}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"pipeline\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\",\\\"name\\\":\\\"Ventas B2B\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Rename a pipeline\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/pipelines/{pipelineId}' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"pipeline\":\"5f7b1b1b1b1b1b1b1b1b1b1b\",\"name\":\"Ventas B2B\"}'"},{"lang":"ObjC","source":"// Rename a pipeline\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"pipeline\": @\"5f7b1b1b1b1b1b1b1b1b1b1b\",\n                              @\"name\": @\"Ventas B2B\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/pipelines/{pipelineId}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Rename a pipeline\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"pipeline\": \"5f7b1b1b1b1b1b1b1b1b1b1b\",\n  \"name\": \"Ventas B2B\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/pipelines/{pipelineId}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Delete pipeline","description":"Delete a sales pipeline by ID.\n\n\n\nA pipeline with open deals cannot be deleted: close or archive them first. Closed and archived deals are preserved for history.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fpipelines%2F%7BpipelineId%7D&method=DELETE&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deletePipeline","security":[{"apiKey":[]}],"tags":["Pipeline"],"parameters":[],"responses":{"200":{"description":"Pipeline deleted"},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Pipeline not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Open deals remain in the pipeline","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Delete a pipeline\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/pipelines/{pipelineId} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Delete a pipeline\nhttp DELETE https://api.wassenger.com/v1/pipelines/{pipelineId} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Delete a pipeline\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/pipelines/{pipelineId}';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Delete a pipeline\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/pipelines/{pipelineId}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Delete a pipeline\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/pipelines/{pipelineId}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Delete a pipeline\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/pipelines/{pipelineId}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Delete a pipeline\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/pipelines/{pipelineId}');\n$request->setRequestMethod('DELETE');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Delete a pipeline\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/pipelines/{pipelineId}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Delete a pipeline\nimport requests\n\nurl = \"https://api.wassenger.com/v1/pipelines/{pipelineId}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.delete(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete a pipeline\nconst url = 'https://api.wassenger.com/v1/pipelines/{pipelineId}';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete a pipeline\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/pipelines/{pipelineId}',\n  method: 'DELETE',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Delete a pipeline\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/pipelines/{pipelineId}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Delete a pipeline\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/pipelines/{pipelineId}\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Delete a pipeline\nvar client = new RestClient(\"https://api.wassenger.com/v1/pipelines/{pipelineId}\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Delete a pipeline\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/pipelines/{pipelineId}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Delete a pipeline\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/pipelines/{pipelineId}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Delete a pipeline\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/pipelines/{pipelineId}\")\n  .delete(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Delete a pipeline\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/pipelines/{pipelineId}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Delete a pipeline\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/pipelines/{pipelineId}' -Method DELETE -Headers $headers"},{"lang":"ObjC","source":"// Delete a pipeline\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/pipelines/{pipelineId}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Delete a pipeline\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/pipelines/{pipelineId}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/messages/{messageId}":{"parameters":[],"get":{"summary":"Get message by ID","description":"Retrieve outbound message document by internal ID (24 characters hexadecimal length) or WhatsApp ID (20 or 22 characters hexadecimal length).\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fmessages%2F%7Bid%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getMessage","security":[{"apiKey":[]}],"tags":["Messages"],"produces":["application/json"],"parameters":[{"in":"query","name":"include","type":"array","collectionFormat":"csv","default":"device,logs,webhooks,preview","items":{"type":"string","enum":["device","logs","webhooks","preview"]}}],"responses":{"200":{"description":"Message model","schema":{"$ref":"#/definitions/message"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not found message","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get message details by ID\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/messages/{id} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get message details by ID\nhttp GET https://api.wassenger.com/v1/messages/{id} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get message details by ID\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/messages/{id}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get message details by ID\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/messages/{id}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get message details by ID\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/messages/{id}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get message details by ID\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/messages/{id}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get message details by ID\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/messages/{id}');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get message details by ID\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/messages/{id}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get message details by ID\nimport requests\n\nurl = \"https://api.wassenger.com/v1/messages/{id}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get message details by ID\nconst url = 'https://api.wassenger.com/v1/messages/{id}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get message details by ID\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/messages/{id}',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get message details by ID\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/messages/{id}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get message details by ID\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/messages/{id}\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get message details by ID\nvar client = new RestClient(\"https://api.wassenger.com/v1/messages/{id}\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get message details by ID\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/messages/{id}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get message details by ID\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/messages/{id}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get message details by ID\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/messages/{id}\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get message details by ID\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/messages/{id}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get message details by ID\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/messages/{id}' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get message details by ID\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/messages/{id}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get message details by ID\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/messages/{id}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Update queued message","description":"Update message information before it gets processed.\n\n**Note**: only messages not yet delivered and in \"queued\" status can be updated.\n\nIn order to edit the content of an already sent message, see [Edit message](#operation/editMessage) endpoint.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fmessages%2F%7Bid%7D&method=PATCH&body=%7B%0A%20%20%22phone%22%3A%20%22%2B987654321%22%2C%0A%20%20%22message%22%3A%20%22This%20is%20a%20new%20text%20message%22%2C%0A%20%20%22reference%22%3A%20%22my-custom-id%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateMessage","security":[{"apiKey":[]}],"tags":["Messages"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"message","schema":{"type":"object","properties":{"message":{"type":"string","minLength":0,"maxLength":15000,"description":"Text to be sent. WhatsApp rich text syntax allowed. [Read more about the syntax here](https://bit.ly/whatsapp-format-text). In group chats you can also mention participants using the following syntax: `@1234567890` where `1234567890` is the [E.164](https://en.wikipedia.org/wiki/E.164) phone number of the participant user."},"phone":{"type":"string","minLength":6,"description":"**Required field** if `group` and `channel` are empty. Phone number with international prefix using the [E164 format](https://en.wikipedia.org/wiki/E.164) to send the message. Example: `+1234567890`"},"group":{"type":"string","minLength":8,"maxLength":40,"description":"**Required field** if `phone` and `channel` are empty. Target group chat WhatsApp ID (WID) where the message should be delivered. You can retrieve the available group ID in your WhatsApp from the [Number dashboard](/number/groups). Example group ID: `123456789000000000@g.us`"},"channel":{"type":"string","minLength":18,"maxLength":30,"description":"**Required field** if `phone` and `group` are empty. Target channel WhatsApp ID (WID) where the message should be delivered. You can retrieve the available channel IDs in your WhatsApp from the [Number dashboard](/number/groups). Example channel ID: `123000098765421000@newsletter`"},"chat":{"type":"string","minLength":6,"maxLength":141,"description":"Target chat WhatsApp ID (WID) to send the message to. **If `phone`, `group` and `channel` fields are empty, this field will be required**. Example chat WIDs are: `1234567890@c.us` = for user chats, `123456789000000000@g.us` for group chats, `1234567890000000@newsletter` for channels, `1234567890000000@lid` for private user chats and `PE.1045742271480925@bsuid` for contacts who hide their phone number."},"number":{"type":"string","minLength":6,"maxLength":18,"description":"Source WhatsApp phone number connected in your account to be used for message delivery. Only required if you have multiple WhatsApp numbers connected. Alternatively, you can specicy the `device` ID field instead. Use this field to route messages through multiple WhatsApp numbers available in your account. If you have only one WhatsApp number connected, this field is optional. Required if you have multiple WhatsApp numbers connected. Example phone number value in [E164 format](https://en.wikipedia.org/wiki/E.164): `+1234567890`"},"device":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Target WhatsApp device ID to be used for the message delivery. Alternatively, you can use the `from` field to target your WhatsApp device by phone number instead of ID. If not present, the first connected number will be used by default. You can use this field to route messages across multiple numbers connected in your account. Obtain the device ID from the [Web Dashboard](/number/info)"},"agent":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Optional Agent ID to send the message on behalf of. The chat will not be assigned to the agent unless explicitly defined [via message actions](#supported-actions). The agent must have access permissions to the device. You can retrieve the agents ID [from here](#operation/getDeviceAgents)"},"template":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":512,"description":"Template name. Must match the pre-approved template name exactly. Use the [Get templates](#operation/getTemplates) endpoint to retrieve the list of approved templates."},"language":{"type":"string","pattern":"^[a-z]{2}(_[A-Z]{2})?$","description":"Optional. Language code of the template (e.g., en_US, es_ES). If not specified, the default language of the first template will be used.","example":"en_US"},"header":{"type":"object","properties":{"text":{"type":"object","properties":{"name":{"type":"string","pattern":"^[a-zA-Z0-9_]{1,32}$","maxLength":32,"description":"The variable placeholder named or positional value to match: use `0` to `9`  for positional variables and `name` syntax for named variables"},"value":{"type":"string","maxLength":1024,"description":"The text string to replace the variable placeholder `{{0}}` or `{{name}}`"}},"required":["name","value"],"additionalProperties":false},"media":{"type":"object","properties":{"type":{"type":"string","enum":["image","video","document"],"description":"Media type to be sent: image, video or document. If not specified, the type will be inferred from the file type."},"file":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","maxLength":24,"minLength":24,"description":"Uploaded File ID 24-length hexadecimal (preferred). The file must be previously uploaded by using the [Upload file API endpoint](#tag/Files/operation/uploadFile) and obtaning the unique file ID (24 length hexadecimal value)"},"url":{"type":"string","maxLength":2048,"description":"Public URL of the file to be sent. This method is slower, prone to errors and not recommended"},"caption":{"type":"string","maxLength":1024,"description":"Caption for the media (not supported on all types)"},"filename":{"type":"string","description":"Filename for documents. Ignored for other media types"}},"additionalProperties":false},"location":{"type":"object","properties":{"latitude":{"type":"number","format":"float","minimum":-90,"maximum":90},"longitude":{"type":"number","format":"float","minimum":-180,"maximum":180},"name":{"type":"string"},"address":{"type":"string"}},"required":["latitude","longitude"],"additionalProperties":false}},"additionalProperties":false,"description":"Header component can be either text, media (image, video, document) or location type."},"body":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"name":{"type":"string","pattern":"^[a-zA-Z0-9_]{1,32}$","maxLength":32,"description":"The variable placeholder named or positional value to match: use `0` to `9`  for positional variables and `name` syntax for named variables"},"value":{"type":"string","maxLength":1024,"description":"The text string to replace the variable placeholder `{{0}}` or `{{name}}`"}},"required":["name","value"],"additionalProperties":false},{"type":"object","properties":{"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 Currency Code (e.g. USD, EUR, GBP, IDR, BRL)"},"amount":{"type":"integer","description":"Amount in minor units multiplied by 1000 (e.g. 10990 for $10.99)"},"presentation":{"type":"string","description":"Default text if localization fails (e.g. \"$10.99\")"}},"required":["currency","amount","presentation"],"additionalProperties":false},{"type":"object","properties":{"date":{"type":"string","format":"date-time","description":"ISO 8601 date string (e.g. \"2025-12-05T14:45:00.000Z\"). Required if \"timestamp\" is not provided."},"timestamp":{"type":"integer","minimum":0,"description":"Unix epoch timestamp in seconds. Required if \"date\" is not provided."},"timezone":{"type":"string","description":"Optional IANA time zone name (e.g. \"America/New_York\" or \"Asia/Hong_Kong\"). If not specified, your account timezone will be used."},"calendar":{"type":"string","enum":["gregorian","solar_hijri"],"description":"Optional calendar system, either \"gregorian\" or \"solar_hijri\". Defaults to \"gregorian\" if not specified."}},"additionalProperties":false}]},"maxItems":15},"button":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["quick_reply","url","copy_code","mpm","flow"],"description":"Button type, defines the button action to be performed when the user taps the button"},"position":{"type":"integer","minimum":0,"maximum":9,"description":"Position order of the button start from 0 to 9. Optional if `type` is not `quick_reply`"},"url":{"type":"string","maxLength":2048,"description":"Required if `type` is url (the URL suffix)"},"name":{"type":"string","maxLength":32,"description":"Placeholder variable name to replace in the button URL template when `type` is `url`. Use `1` for positional variables, or `name` for named variables"},"value":{"type":"string","maxLength":512,"description":"Placeholder variable value to replace in the template, e.g: `{{1}}` or `{{name}}`. Only required if the button content template variables when `type` is `url`"},"coupon":{"type":"string","maxLength":15,"description":"Required if `type` is `copy_code`"},"action":{"type":"object","properties":{"flow":{"type":"string"},"data":{"type":"object","properties":{"flow_token":{"type":"string","maxLength":200},"flow_action_data":{"type":"object","properties":{},"additionalProperties":false}}},"thumbnail":{"type":"string"},"sections":{"type":"array","items":{}}},"additionalProperties":false,"description":"Required if `type` is `flow` or `mpm`"},"payload":{"type":"string","maxLength":128,"description":"Required if `type` is `quick_reply`"}},"additionalProperties":false,"description":"Template button component, can be of type: quick_reply, url, copy_code, mpm, flow"},"minItems":0,"maxItems":10},"timeoffer":{"type":"object","properties":{"date":{"type":"string","format":"date-time","description":"ISO 8601 formatted date string indicating when the offer expires. E.g: `2025-12-31T23:59:59.000Z`"},"timestamp":{"type":"integer","minimum":1793958160639,"description":"Unix epoch timestamp in seconds indicating when the offer expires. E.g: `1735689600`"},"timezone":{"type":"string","description":"Optional IANA time zone name (e.g. \"America/New_York\" or \"Asia/Hong_Kong\"). If not specified, your account timezone will be used."}},"required":["date"],"additionalProperties":false},"flow":{"type":"object","properties":{"token":{"type":"string","maxLength":200,"description":"Optional session token Meta returns with the answers. Defaults to one that identifies this message."},"data":{"type":"object","properties":{},"additionalProperties":false,"description":"Optional initial data for the first screen of the form, as declared in its Flow JSON."}},"additionalProperties":false,"description":"For templates with a WhatsApp Form (FLOW) button: the form token and prefill data."},"components":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["header"]},"parameters":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text","image","video","document","location","product"]},"text":{"type":"string"},"image":{"type":"object","properties":{"id":{"type":"string"},"link":{"type":"string"},"caption":{"type":"string"}},"additionalProperties":false},"video":{"type":"object","properties":{"id":{"type":"string"},"link":{"type":"string"},"caption":{"type":"string"}},"additionalProperties":false},"document":{"type":"object","properties":{"id":{"type":"string"},"link":{"type":"string"},"caption":{"type":"string"},"filename":{"type":"string"}},"additionalProperties":false},"location":{"type":"object","properties":{"latitude":{"type":"number","format":"float"},"longitude":{"type":"number","format":"float"},"name":{"type":"string"},"address":{"type":"string"}},"required":["latitude","longitude"],"additionalProperties":false},"product":{"type":"object","properties":{"product_retailer_id":{"type":"string"},"catalog_id":{"type":"string"}},"additionalProperties":false}},"required":["type"],"additionalProperties":false},"maxItems":1}},"required":["type","parameters"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["body"]},"parameters":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text","currency","date_time"]},"text":{"type":"string"},"parameter_name":{"type":"string"},"currency":{"type":"object","properties":{"fallback_value":{"type":"string"},"code":{"type":"string","minLength":3,"maxLength":3},"amount_1000":{"type":"integer"}},"required":["fallback_value","code","amount_1000"],"additionalProperties":false},"date_time":{"type":"object","properties":{"fallback_value":{"type":"string"},"day_of_week":{"type":"integer"},"year":{"type":"integer"},"month":{"type":"integer"},"day_of_month":{"type":"integer"},"hour":{"type":"integer"},"minute":{"type":"integer"},"calendar":{"type":"string"}},"required":["fallback_value"],"additionalProperties":false}},"required":["type"],"additionalProperties":false}}},"required":["type","parameters"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["button"]},"sub_type":{"type":"string","enum":["quick_reply","url","copy_code","CATALOG","MPM","flow"]},"index":{"type":"integer","minimum":0,"maximum":9},"parameters":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["payload","text","coupon_code","action"]},"payload":{"type":"string"},"text":{"type":"string"},"coupon_code":{"type":"string"},"action":{"type":"object","properties":{"flow_token":{"type":"string","maxLength":200},"flow_action_data":{"type":"object","properties":{},"additionalProperties":false},"thumbnail_product_retailer_id":{"type":"string"},"sections":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"product_items":{"type":"array","items":{"type":"object","properties":{"product_retailer_id":{"type":"string"}},"required":["product_retailer_id"],"additionalProperties":false}}},"additionalProperties":false}}},"additionalProperties":false}},"required":["type"],"additionalProperties":false},"maxItems":1}},"required":["type","sub_type","index","parameters"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["limited_time_offer"]},"parameters":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["limited_time_offer"]},"limited_time_offer":{"type":"object","properties":{"expiration_time_ms":{"type":"integer"}},"required":["expiration_time_ms"],"additionalProperties":false}},"required":["type","limited_time_offer"],"additionalProperties":false},"maxItems":1}},"required":["type","parameters"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["carousel"]},"cards":{"type":"array","items":{"type":"object","properties":{"card_index":{"type":"integer","minimum":0},"components":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["header"]},"parameters":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text","image","video","document","location","product"]},"text":{"type":"string"},"image":{"type":"object","properties":{"id":{"type":"string"},"link":{"type":"string"},"caption":{"type":"string"}},"additionalProperties":false},"video":{"type":"object","properties":{"id":{"type":"string"},"link":{"type":"string"},"caption":{"type":"string"}},"additionalProperties":false},"document":{"type":"object","properties":{"id":{"type":"string"},"link":{"type":"string"},"caption":{"type":"string"},"filename":{"type":"string"}},"additionalProperties":false},"location":{"type":"object","properties":{"latitude":{"type":"number","format":"float"},"longitude":{"type":"number","format":"float"},"name":{"type":"string"},"address":{"type":"string"}},"required":["latitude","longitude"],"additionalProperties":false},"product":{"type":"object","properties":{"product_retailer_id":{"type":"string"},"catalog_id":{"type":"string"}},"additionalProperties":false}},"required":["type"],"additionalProperties":false},"maxItems":1}},"required":["type","parameters"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["body"]},"parameters":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text","currency","date_time"]},"text":{"type":"string"},"parameter_name":{"type":"string"},"currency":{"type":"object","properties":{"fallback_value":{"type":"string"},"code":{"type":"string","minLength":3,"maxLength":3},"amount_1000":{"type":"integer"}},"required":["fallback_value","code","amount_1000"],"additionalProperties":false},"date_time":{"type":"object","properties":{"fallback_value":{"type":"string"},"day_of_week":{"type":"integer"},"year":{"type":"integer"},"month":{"type":"integer"},"day_of_month":{"type":"integer"},"hour":{"type":"integer"},"minute":{"type":"integer"},"calendar":{"type":"string"}},"required":["fallback_value"],"additionalProperties":false}},"required":["type"],"additionalProperties":false}}},"required":["type","parameters"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["button"]},"sub_type":{"type":"string","enum":["quick_reply","url","copy_code","CATALOG","MPM","flow"]},"index":{"type":"integer","minimum":0,"maximum":9},"parameters":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["payload","text","coupon_code","action"]},"payload":{"type":"string"},"text":{"type":"string"},"coupon_code":{"type":"string"},"action":{"type":"object","properties":{"flow_token":{"type":"string","maxLength":200},"flow_action_data":{"type":"object","properties":{},"additionalProperties":false},"thumbnail_product_retailer_id":{"type":"string"},"sections":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"product_items":{"type":"array","items":{"type":"object","properties":{"product_retailer_id":{"type":"string"}},"required":["product_retailer_id"],"additionalProperties":false}}},"additionalProperties":false}}},"additionalProperties":false}},"required":["type"],"additionalProperties":false},"maxItems":1}},"required":["type","sub_type","index","parameters"],"additionalProperties":false}]}}},"required":["card_index","components"],"additionalProperties":false},"minItems":1,"maxItems":10}},"required":["type","cards"],"additionalProperties":false}]},"minItems":1,"description":"Only required if fields `template.header`, `template.body`, `template.button` and `template.timeoffer` are empty.\nThis field accepts the same template components payload data schema as WhatsApp Business API for compatibility purposes. Use it for convenience in case you already have template components in the WABA compatible schema. [Learn more about template components](https://developers.facebook.com/documentation/business-messaging/whatsapp/templates/overview#parameter-formats)"}},"additionalProperties":false,"description":"Send a WhatsApp Template Message. Only applicable to WABA API numbers. Template messages must be pre-approved by WhatsApp. [Learn more here](/help/waba-templates)"},"deliverAt":{"type":"string","format":"date-time","description":"Custom date time in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format of when to deliver the message."},"schedule":{"type":"object","properties":{"delay":{"type":"number","format":"float","minimum":1,"maximum":63072000,"description":"Schedule message delivery after the given seconds. E.g: 300"},"delayTo":{"type":"string","pattern":"^([0-9]{1,8})([y|M|w|d|h|m|s]{1})$","minLength":2,"maxLength":5,"description":"Schedule message delivery using time duration syntax. Example valid values are: 1h, 15m, 12h, 1d. Read more about the duration syntax [here](https://momentjs.com/docs/#/durations/)."},"date":{"type":"string","format":"date-time","description":"Schedule message delivery after a custom [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format date time. E.g: 2019-01-23T23:22:59.776Z"}},"additionalProperties":false,"description":"Optional message schedule, one of the following fields must be present: `delay`, `delayTo` or `date`"},"typing":{"type":"integer","minimum":2,"maximum":30,"description":"Optional. Seconds to simulate the user is typing or recording status (only in audio messages) in the target chat before message delivery. The minimum typing status is 2 seconds, up to 30 seconds. If not specified, the system will automatically simuate it based on a random duration no longer than 3 seconds."},"contact":{"type":"object","properties":{"phone":{"type":"string","minLength":6,"maxLength":16,"description":"Contact international phone number in E164 format. Example: +1234567890"},"name":{"type":"string","minLength":1,"maxLength":40,"description":"Contact name alias or full name. Example: Michael Jordan"}},"required":["phone","name"],"additionalProperties":false,"description":"Send a single contact card"},"contacts":{"type":"array","items":{"type":"object","properties":{"phone":{"type":"string","minLength":6,"maxLength":16,"description":"Contact international phone number in E164 format. Example: +1234567890"},"name":{"type":"string","minLength":1,"maxLength":40,"description":"Contact name alias or full name. Example: Michael Jordan"}},"required":["phone","name"],"additionalProperties":false,"description":"Send a single contact card"},"minItems":1,"maxItems":10,"description":"Send multiple contact cards. Each contact entry is based on an E164 international phone number and contact name. Contact name can have spaces representing a person full name. You can send up to 10 contacts in a single message."},"quote":{"type":"string","minLength":18,"maxLength":200,"description":"Message ID to quote when sending the new message. The message ID can be a WhatsApp native ID (18, 20, 22 or 32 hexadecimal characters length, or a WABA ID) or a platform-specific outbound message ID (24 hexadecimal characters length). As per WhatsApp restriction, you can only quote messages within the same conversation. In case the quoted message ID is not found or no longer available within the chat, the new message will be always delivered without the quote annotation."},"selectId":{"type":"string","maxLength":50,"description":"Reply to buttons or list messages by selecting one of the available elements by its unique ID. \n**Important**: requires the `quote` field to be present referring to the original buttons or list message ID to be replied to."},"forward":{"type":"object","properties":{"message":{"type":"string","minLength":18,"maxLength":32,"description":"Message ID to forward. The message ID can be a WhatsApp native ID (18, 20, 22 or 32 hexadecimal characters length) or a platform-specific outbound message ID (24 hexadecimal characters length). As per WhatsApp restriction, you can only quote messages within the same conversation. In case the quoted message ID is not found or no longer available within the chat, the new message will be always delivered without the quote annotation."},"chat":{"type":"string","minLength":8,"maxLength":32,"description":"Source chat ID where the message to forward belongs to. The chat ID can be an E164 international phone number or a group chat ID. In case you cannot provide the chat ID or chat phone number, the system will try to discover the chat ID automatically. If the chat ID cannot be discovered, the API will return an `400` error. E.g: `+1234567890`, `123456789000000000@g.us`"}},"additionalProperties":false,"description":"Forward a message by source chat and message ID."},"media":{"type":"object","properties":{"file":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Uploaded file ID to send as media message content. The file must be previously uploaded by using the [Upload file API endpoint](#tag/Files/operation/uploadFile) and obtaning the unique file ID (24 length alphanumeric value)\n\n**Important**: you cannot put the file content here. Alternatively, you can send a media file using the `media.url` field specifying a publicly accessible file URL (see the `url` field below)."},"format":{"type":"string","enum":["gif","ptt","native"],"description":"Optional file display format when applicable for GIFs (videos) and Voice recording (audios)","default":"native"},"message":{"type":"string","minLength":0,"maxLength":15000,"description":"Optional media file text caption to use when deliverying the message - Only applicable to image and video media files, otherwise ignored. In case there is no message body field defined in the actual message to be delivered."},"viewOnce":{"type":"boolean","description":"Optional, only applicable to images and videos. If you set `viewMode` as `true`, the media content will disappear on WhatsApp after the recipient has opened it and exited the media viewer. Once they exit the media viewer, the media will no longer be visible in that chat and they can't view it again. View once photos and videos won't be saved to the recipient's Photos or Gallery, and they can't forward them."},"url":{"type":"string","minLength":10,"maxLength":1024,"description":"Internet reachable public URL to download the file content. If the URL returns an error, is not reachable from the Internet, or the file type is not valid, the API will return a `400 Bad Request` error."},"filename":{"type":"string","minLength":3,"maxLength":200,"description":"Optional file name. If not defined, it is taken from the file URL or form content, if available. Otherwise a random file name will be generated."},"reference":{"type":"string","minLength":2,"maxLength":150,"description":"Optional file reference user-defined identifier. This might be useful to identify files across systems, for instance, a CRM or storage system."},"permission":{"type":"string","enum":["public","readonly","private"],"description":"Optional file access permission. Defaults to `public`: all team members can access, download and send the file. If set to `private` only the file owner can access, download and send the file."},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":50},"minItems":1,"maxItems":10,"description":"Optional file tags, up to 10 tags per file. Each tag cannot have more than 50 characters."},"expiration":{"type":"string","minLength":2,"maxLength":5,"enum":["10m","30m","1h","6h","12h","1d","2d","3d","5d","6d","7d","15d","30d","60d","90d","120d","180d","360d","1y","2y"],"description":"File storage expiration time limit, after which the file will be deleted from the system. Defaults to 15 days.","default":"30d"}},"additionalProperties":false,"description":"Send media content as image (jpeg, png, webp), video (mp4), audio (mp3, ogg), document (pdf, docx, xlsx, csv, pptx) or binary file (zip, rar, 7z)."},"poll":{"type":"object","properties":{"name":{"type":"string","maxLength":255,"description":"Poll name or title."},"options":{"type":"array","items":{"type":"string","minLength":1,"maxLength":100,"description":"Poll option text. Up to 100 characters."},"minItems":2,"maxItems":12,"description":"Poll options to vote. Each option must have a text value. Up to 12 options are allowed."},"multiple":{"type":"boolean","description":"Allow multiple votes per user. Defaults to many votes per user.","default":true}},"additionalProperties":false},"vote":{"type":"object","properties":{"poll":{"type":"string","pattern":"[a-fA-F0-9]","minLength":18,"maxLength":32,"description":"Poll message ID to vote. The message ID can be a WhatsApp native ID (18, 20, 22 or 32 hexadecimal characters length) or platform-native message ID (24 hexadecimal characters length)."},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"number","format":"float","minimum":0,"maximum":11,"description":"Poll option ID to vote, from 0 to 11."},"value":{"type":"string","minLength":1,"maxLength":100,"description":"Poll option text value to vote."}},"additionalProperties":false},"minItems":0,"maxItems":12,"description":"Poll options to vote, or use an empty array to remove all votes. Each option must have an ID or value text. You can send multiple options to vote. Already voted options will be overwritten by the options defined."}},"additionalProperties":false,"description":"Send one or multiple votes on a existing poll by message ID. To remove all votes, send an empty array: `[]`."},"event":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"Event name or title. Up to 100 characters."},"description":{"type":"string","maxLength":2048,"description":"Optional event description message. Up to 2048 characters."},"date":{"type":"string","format":"date-time","description":"Event date and time in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. E.g: `2024-08-15T12:30:00:000Z`"},"location":{"type":"string","maxLength":255,"description":"Optional event location name. Up to 255 characters."},"latitude":{"type":"number","format":"float","minimum":-90,"maximum":90,"description":"Optional event location latitude. Must be a valid number between -90 and 90."},"longitude":{"type":"number","format":"float","minimum":-180,"maximum":180,"description":"Optional event location longitude. Must be a valid number between -180 and 180."},"call":{"type":"string","enum":["voice","video","none"],"description":"Optionally use or generate a WhatsApp meeting call to join the event. Default to no call. Available options are: `voice` or `video` call."},"code":{"type":"string","pattern":"[a-zA-Z0-9]/","minLength":21,"maxLength":22,"description":"Optional call link code to join the event. The code must be a valid alphanumeric string of 21 or 22 characters length. The code will be appended to the WhatsApp call link URL. E.g: `https://call.whatsapp.com/voice/$CODE`"}},"required":["date"],"additionalProperties":false,"description":"Send WhatsApp event message with a name, description, location, date and optional call link."},"attend":{"type":"object","properties":{"event":{"type":"string","pattern":"[a-fA-f0-9]","minLength":18,"maxLength":32,"description":"Event message ID to respond to. The message ID can be a WhatsApp native ID (18, 20, 22 or 32 hexadecimal characters length) or platform-native message ID (24 hexadecimal characters length)."},"confirm":{"type":"boolean","description":"Confirm the event attendance. Defaults to `true`. Use `false` to reject attending."}},"additionalProperties":false},"reference":{"type":"string","minLength":1,"maxLength":150,"description":"Optional user-defined message reference for easy traceability with existent systems. For instance, you can define as reference the ID of the customer in your CRM. The `reference` value will be provided in every webhook event."},"live":{"type":"boolean","description":"Send message in live mode without enqueuing it (also known as real-time). If `true`, this is equivalent to using `enqueue`=`never`. Note pnly Platform plan support live message delivery mode, otherwise the message will be queued or fail.","default":false},"enqueue":{"type":"string","enum":["never","always","opportunistic"],"description":"Defines the message delivery behavior. By default, messages are queued and processed asynchronously in background. For Platform plans, you can force message delivery in real time without queueing it and getting a synchronous response with the actual message delivery status (delivered, failed, not found, error).\n\n\nSupported queue modes:\n\n- **always** - Always enqueue the message to be processed in background by the queue system based on message priority and delivery date. **Default** mode in Gateway plans. Both Gateway and Platform plans support this mode.\n\n- **never** - Never enqueue the message and try to deliver it in real-time through the target WhatsApp number. In case the number session is not online or connection is not operative, it will return an error. API consumer should handle the error gracefully and retry the message delivery if needed. Gateway plans does not support this mode.\n\n- **opportunistic**: Try to deliver the message in real-time if the device is online and can accept messages. If message cannot deliver due to an error or full queue, message will be transparently enqueued and processed asynchronously later. **Default** mode in Platform plans. Gateway plans does not support this mode."},"previewUrl":{"type":"boolean","description":"Enable or disable URL image/title preview in the target message by using OpenGraph protocol. Enabled by default."},"location":{"type":"object","properties":{"request":{"type":"boolean","description":"If set to `true`, the message will be sent as a location request message, prompting the user to share their current location. If set to `false` or not defined, the message will be sent as a standard location message with the provided address or coordinates."},"address":{"type":"string","minLength":3,"maxLength":100,"description":"Location human-friendly address value. Cannot be used together with coordinates. The system will geocode the address in order to accurately locate it via coordinates."},"name":{"type":"string","maxLength":100,"description":"Optional location name if address is not defined. If empty, coordinates geo reverse will be used in order to infer the location name."},"coordinates":{"type":"array","items":{"type":"number","format":"double","minimum":-180,"maximum":180},"minItems":2,"maxItems":2,"description":"Location coordinates in latitude and longitude format. Cannot be used together with address. Use `name` field if you wish to provide a custom location description, otherwise the system will georeverse the location name."}},"additionalProperties":false},"product":{"type":"string","pattern":"[0-9]{14,18}","minLength":16,"maxLength":18,"description":"Send a product catalog message by product ID. This feature only available in WhatsApp Business numbers with an existing catalog available."},"order":{"type":"boolean","description":"Use this if you want to ensure all messages are sent to the target chat in strict order. If enabled, the system will ensure the message is delivered in the same order as it was sent. This feature is useful for chatbot automations and message sequences. This feature is not compatible with `live=true` nor `enqueue=never` options.","default":false},"reaction":{"type":"string","minLength":1,"maxLength":10,"description":"Send reaction emoji to an existing message. To remove a reaction, use `-` as reaction value. Requires `reactionMessage` field to be present with the WhatsApp message ID to react to. Single emoji character is supported. Available emojis can be obtained here: [getemoji.com](https://getemojis.com)"},"reactionMessage":{"type":"string","pattern":"[a-fA-F0-9]{18,32}|[A-Za-z0-9+/_\\-.=]{32,200}","maxLength":200,"description":"WhatsApp message unique ID to react or unreact (hexadecimal 18, 20, 22 or 32 characters length or WABA ID) E.g: `3EB029A0219B0037CA10`. Requires `reaction` field to be present."},"retries":{"type":"number","format":"float","minimum":0,"maximum":1000,"description":"Maximum message delivery retries.","default":25},"retryWait":{"type":"number","format":"float","minimum":0,"maximum":86400,"description":"Optional user defined wait time for every message retry attempt in seconds. Use 0 to disable it. If not defined, the default system exponential backoff will be used."},"expiration":{"type":"object","properties":{"seconds":{"type":"number","format":"float","minimum":5,"maximum":8035200,"description":"Make the message expire if delivery was not possible after the given seconds. E.g: 300"},"duration":{"type":"string","pattern":"^([0-9]{1,8})([y|M|w|d|h|m|s]{1})$","minLength":2,"maxLength":5,"description":"Make the message expires after a given time duration syntax. Example valid values are: 1h, 15m, 12h, 1d. Read more about the duration syntax [here](https://momentjs.com/docs/#/durations/)."},"date":{"type":"string","format":"date-time","description":"Make the message expire to specific date-hour by using a datetime [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601). E.g: 2019-01-23T23:22:59.776Z"}},"additionalProperties":false,"description":"Define a message time-to-live (ttl) expiration time. Use this if you want to automatically do not send a message if the delivery was not possible after a while. E.g: 1h"},"actions":{"type":"array","items":{"type":"object","properties":{"action":{"type":"string","maxLength":50,"enum":["chat:assign","chat:unassign","chat:resolve","chat:unresolve","chat:read","chat:unread","labels:add","labels:set","labels:remove","metadata:add","metadata:set","metadata:remove"],"description":"Action command. See above the supported commands and params"},"params":{"type":"object","properties":{},"description":"Optional param to use per action. See the documentation above for further details about supported params per specific action command."}},"required":["action"],"additionalProperties":false},"maxItems":10,"description":"Optional list of actions to perform after the message delivery.\n\n\n\nActions scope are limited to the chat/contact receiving the message.\n\n\n\nIf the message delivery fails, actions will be ignored.\n\n\n\n**Note**: this feature is only applicable to devices with multi-agent chat support.\n\n\n\n### Supported actions\n\n\n\n* **Action**: `chat:assign`\n* **Description**: Assign chat to an agent.\n* **Params**:\n  - **agent**: `string` (optional) - Required if `department` is not defined. Agent ID to assign the chat to after message delivery. You can retrieve the agents ID [from here](#operation/getDeviceAgents)\n  - **department**: `string` (optional) - Required if `agent` is not defined. Department ID to assign the chat to after message delivery. It can be together with `agent` field to assign a chat to both an agent and department. You can retrieve the department ID [from here](#operation/getDepartments)\n  - **assigner**: `string` (optional) - Optinoal. Agent ID who assigns the chat to the other agent\n----\n* **Action**: `chat:unassign`\n* **Description**: Unassign chat from existing agent\n* **Params**:\n  - **assigner**: `string` (optional) - Agent ID who assigns the chat to the other agent. You can retrieve the agents ID [from here](#operation/getDeviceAgents)\n----\n* **Action**: `chat:resolve`\n* **Description**: Resolve chat if not already resolved. Cannot be used along with `chat:unresolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `chat:unresolve`\n* **Description**: Unresolve chat if already resolved. Cannot be used along with `chat:resolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `chat:read`\n* **Description**: Mark the chat internally as read in the web chat interface after the message is delivered. Cannot be used along with `chat:resolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `chat:unread`\n* **Description**: Mark the chat internally as unread in the web chat interface after the message is delivered. Cannot be used along with `chat:resolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `labels:add`\n* **Description**: Add label(s) to the chat after the message is delivered\n* **Params**:\n  - **labels**: `array` (optional) - Label tags to add to the chat while keeping the existing ones. You can obtain a list of existing labels [querying this endpoint](#operation/getLabels)\n----\n* **Action**: `labels:remove`\n* **Description**: Remove label(s) from the chat, when already present, after the message is delivered\n* **Params**:\n  - **labels**: `array` (optional) - Label tags to remove from the chat. You can obtain a list of existing labels [querying this endpoint](#operation/getLabels)\n----\n* **Action**: `labels:set`\n* **Description**: Set and override label(s) in the chat after the message is delivered\n* **Params**:\n  - **labels**: `array` (optional) - Label tags to set and override in the chat. You can obtain a list of existing labels [querying this endpoint](#operation/getLabels)\n----\n* **Action**: `metadata:set`\n* **Description**: Set and override metadata key-value entries in the target chat's contact entity after the message is delivered\n* **Params**:\n  - **metadata**: `array` (optional) - Metadata entries with `key` and `value` properties to set and override in the chat's contact\n----\n* **Action**: `metadata:add`\n* **Description**: Add or override by `key` field existing metadata key-value entries in the target chat's contact entity after the message is delivered\n* **Params**:\n  - **metadata**: `array` (optional) - Metadata entries with `key` and `value` properties to append in the chat's contact\n----\n* **Action**: `metadata:remove`\n* **Description**: Remove existing metadata entries by `key` field in the target chat's contact entity after the message is delivered\n* **Params**:\n  - **keys**: `array` (optional) - Metadata entries to remove by `key` in the chat's contact"},"sendReadAck":{"type":"boolean","description":"Report unread chat messages after message delivery, simulating native user behavior.\n\nUse \"true\" in order to report to the target user/group members that received messages were readed by you with blue double-check.\n\nNote: in case you have disabled read confirmation in WhatsApp Settings > Account > Privacy, this configuration will have no effect.","default":false},"retentionPolicy":{"type":"string","enum":["plan_defaults","never","5m","15m","30m","1h","12h","24h","2d","3d","4d","5d","6d","7d","10d"],"description":"Optional message retention policy. By default, the current plan device data retention policy will be used.\n\nRetention policy defines the maximum allowed time in which the message should be stored in the system after it was delivered or failed.\n\nIf you want to enforce the system to do not to store any message after it is being proessed, use \"never\" as policy."},"priority":{"type":"string","enum":["low","normal","high","urgent"],"description":"Message priority. We recommend do not abusing of \"high\" or \"urgent\" priorities unless it is strictly sensitive to deliver the message as soon as possible. Otherwise, use just the default \"normal\" priority.","default":"normal"},"header":{"type":"string","maxLength":60,"description":"Optional message header text, up to 60 characters. Restricted to messages with reply buttons and list messages."},"footer":{"type":"string","maxLength":60,"description":"Optional message footer text, restricted to messages with reply buttons and list messages."},"buttons":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-zA-Z0-9_]*$","maxLength":256,"description":"User defined button unique identifier - only alphanumeric characters allowed. Helpful for chatbot automations. If not defined, a random alphanumeric ID of 6 characters length will be used instead."},"text":{"type":"string","minLength":1,"maxLength":20,"description":"Button text to displayed to the user, up to 20 characters, including emojis."},"kind":{"type":"string","enum":["reply","url","call"],"description":"Button kind, defaults to `reply` (displays text and replies to the message whe selected). Other valid options are: `url` for opening any URL and `call` for calling a phone number (E164 phone number compatible format).","default":"reply"},"value":{"type":"string","minLength":1,"maxLength":300,"description":"Required phone number or URL value for buttons with `kind` = `call` or `url`. Otherwise ignored."}},"additionalProperties":false},"maxItems":10,"description":"Send user-defined reply dynamic buttons, up to 10 button entries per message, with optional message `header` and `footer` text (see fields below).\n\n**This is how button messages will look like on WhatsApp**:\n![](/images/docs/buttons.webp)\n\nUseful for chatbot automations and more user-friendly reply interactions.\n\n**Certain restrictions apply**:\n\n1. Cannot send special buttons with link URL or phone number call actions to group chats, only individual user chats.\n2. Cannot send buttons as the first message that initiates a new conversation with a third-party user.\n3. Instead, use a text message as first message, then following by a second message that can be a buttons message."},"list":{"type":"object","properties":{"description":{"type":"string","maxLength":1024,"description":"**Required**: list message box level description message"},"button":{"type":"string","minLength":1,"maxLength":20,"description":"**Required**: button text to open the list displayed to the user, up to 20 characters, including emojis."},"title":{"type":"string","maxLength":60,"description":"**Optional**: list message box level title message"},"footer":{"type":"string","maxLength":60,"description":"**Optional**: list message box level footer message"},"sections":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string","maxLength":24,"description":"**Required** if the message has more than one section, otherwise **Optional**: section items title"},"rows":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string","maxLength":24,"description":"**Required**: row title"},"id":{"type":"string","maxLength":50,"description":"**Optional**: row entry ID, useful for user seleccion response handling. If not defined, a randomly generated hexadecimal ID will be used."},"description":{"type":"string","maxLength":72,"description":"**Optional**: row entry description to display to the user."}},"additionalProperties":false},"minItems":1,"maxItems":10}},"additionalProperties":false},"minItems":1,"maxItems":10,"description":"**Required**: list section composed of a title and a list of rows per section. Up to 10 sections with each section having up to 10 rows per message."}},"additionalProperties":false,"description":"Send user-defined dynamic selection lists, up to 10 sections, each section having up to 10 rows, per message.\n\nOptionally you can define a message `title`, `footer` and `description` message list (see fields below for more information).\n\nUseful for chatbot automations and more user-friendly reply interactions.\n\n**Certain restrictions apply**:\n\n1. You cannot send a list as the first message that initiates a new conversation with a third-party user.\n2. Instead, use a text message as first message, then following by a second message that can be a list message."},"flowMessage":{"type":"object","properties":{"flowId":{"type":"string","description":"WhatsApp Flow ID to send."},"flowCta":{"type":"string","minLength":1,"maxLength":30,"description":"Call-to-action button label, up to 30 characters."},"screen":{"type":"string","description":"Entry screen ID to open. Required for `navigate` flows (static flows)."},"action":{"type":"string","enum":["navigate","data_exchange"],"description":"Flow action. Static flows use `navigate`.","default":"navigate"},"data":{"type":"object","properties":{},"additionalProperties":false,"description":"Optional initial data passed to the entry screen."},"flowToken":{"type":"string","description":"Optional idempotency/session token. Auto-generated if omitted."},"mode":{"type":"string","enum":["published","draft"],"description":"Send a published or draft flow.","default":"published"}},"required":["flowId","flowCta"],"additionalProperties":false,"description":"Send a WhatsApp Flow as a native interactive message. The message text is taken from the `message` field, with optional `header`/`footer`."},"remove":{"type":"array","items":{"type":"string","enum":["reference","media","media.file","media.message","media.reference","location","location.address","location.coordinates"]}}},"additionalProperties":false}}],"responses":{"200":{"description":"Message model","schema":{"$ref":"#/definitions/message"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not found message","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Partially update message data\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/messages/{id} \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"phone\":\"+987654321\",\"message\":\"This is a new text message\",\"reference\":\"my-custom-id\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Partially update message data\necho '{\"phone\":\"+987654321\",\"message\":\"This is a new text message\",\"reference\":\"my-custom-id\"}' |  \\\n  http PATCH https://api.wassenger.com/v1/messages/{id} \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Partially update message data\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/messages/{id}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phone\":\"+987654321\",\"message\":\"This is a new text message\",\"reference\":\"my-custom-id\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Partially update message data\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/messages/{id}',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    phone: '+987654321',\n    message: 'This is a new text message',\n    reference: 'my-custom-id'\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Partially update message data\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/messages/{id}');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  phone: '+987654321',\n  message: 'This is a new text message',\n  reference: 'my-custom-id'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Partially update message data\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/messages/{id}', [\n  'body' => '{\"phone\":\"+987654321\",\"message\":\"This is a new text message\",\"reference\":\"my-custom-id\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Partially update message data\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'phone' => '+987654321',\n  'message' => 'This is a new text message',\n  'reference' => 'my-custom-id'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/messages/{id}');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Partially update message data\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/messages/{id}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'phone' => '+987654321',\n    'message' => 'This is a new text message',\n    'reference' => 'my-custom-id'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Partially update message data\nimport requests\n\nurl = \"https://api.wassenger.com/v1/messages/{id}\"\n\npayload = {\n    \"phone\": \"+987654321\",\n    \"message\": \"This is a new text message\",\n    \"reference\": \"my-custom-id\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Partially update message data\nconst url = 'https://api.wassenger.com/v1/messages/{id}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phone\":\"+987654321\",\"message\":\"This is a new text message\",\"reference\":\"my-custom-id\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Partially update message data\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/messages/{id}',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"phone\":\"+987654321\",\"message\":\"This is a new text message\",\"reference\":\"my-custom-id\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Partially update message data\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/messages/{id}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"phone\\\":\\\"+987654321\\\",\\\"message\\\":\\\"This is a new text message\\\",\\\"reference\\\":\\\"my-custom-id\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Partially update message data\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/messages/{id}\"\n\n\tpayload := strings.NewReader(\"{\\\"phone\\\":\\\"+987654321\\\",\\\"message\\\":\\\"This is a new text message\\\",\\\"reference\\\":\\\"my-custom-id\\\"}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Partially update message data\nvar client = new RestClient(\"https://api.wassenger.com/v1/messages/{id}\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"phone\\\":\\\"+987654321\\\",\\\"message\\\":\\\"This is a new text message\\\",\\\"reference\\\":\\\"my-custom-id\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Partially update message data\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/messages/{id}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"phone\\\":\\\"+987654321\\\",\\\"message\\\":\\\"This is a new text message\\\",\\\"reference\\\":\\\"my-custom-id\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Partially update message data\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/messages/{id}\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"phone\\\":\\\"+987654321\\\",\\\"message\\\":\\\"This is a new text message\\\",\\\"reference\\\":\\\"my-custom-id\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Partially update message data\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"phone\\\":\\\"+987654321\\\",\\\"message\\\":\\\"This is a new text message\\\",\\\"reference\\\":\\\"my-custom-id\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/messages/{id}\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Partially update message data\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/messages/{id}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"phone\\\":\\\"+987654321\\\",\\\"message\\\":\\\"This is a new text message\\\",\\\"reference\\\":\\\"my-custom-id\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Partially update message data\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/messages/{id}' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"phone\":\"+987654321\",\"message\":\"This is a new text message\",\"reference\":\"my-custom-id\"}'"},{"lang":"ObjC","source":"// Partially update message data\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"phone\": @\"+987654321\",\n                              @\"message\": @\"This is a new text message\",\n                              @\"reference\": @\"my-custom-id\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/messages/{id}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Partially update message data\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"phone\": \"+987654321\",\n  \"message\": \"This is a new text message\",\n  \"reference\": \"my-custom-id\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/messages/{id}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Delete message","description":"Deletes a message.\n\n**NOTE**: only messages with \"queued\" status can be removed. Already processing or delivered messages will return an `409 - Conflict` error response.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fmessages%2F%7Bid%7D&method=DELETE&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deleteMessage","security":[{"apiKey":[]}],"tags":["Messages"],"produces":["application/json"],"parameters":[{"in":"query","name":"force","type":"boolean","default":false,"description":"Force message deletion, even if the message has been already delivered or is still processing."}],"responses":{"200":{"description":"Message removed","schema":{"$ref":"#/definitions/message"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not found message","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Deletes a message\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/messages/{id} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Deletes a message\nhttp DELETE https://api.wassenger.com/v1/messages/{id} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Deletes a message\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/messages/{id}';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Deletes a message\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/messages/{id}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Deletes a message\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/messages/{id}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Deletes a message\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/messages/{id}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Deletes a message\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/messages/{id}');\n$request->setRequestMethod('DELETE');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Deletes a message\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/messages/{id}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Deletes a message\nimport requests\n\nurl = \"https://api.wassenger.com/v1/messages/{id}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.delete(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Deletes a message\nconst url = 'https://api.wassenger.com/v1/messages/{id}';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Deletes a message\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/messages/{id}',\n  method: 'DELETE',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Deletes a message\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/messages/{id}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Deletes a message\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/messages/{id}\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Deletes a message\nvar client = new RestClient(\"https://api.wassenger.com/v1/messages/{id}\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Deletes a message\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/messages/{id}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Deletes a message\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/messages/{id}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Deletes a message\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/messages/{id}\")\n  .delete(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Deletes a message\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/messages/{id}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Deletes a message\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/messages/{id}' -Method DELETE -Headers $headers"},{"lang":"ObjC","source":"// Deletes a message\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/messages/{id}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Deletes a message\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/messages/{id}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/typing":{"parameters":[],"post":{"summary":"Send typing status","description":"Send WhatsApp typing or recording status on a user chat or group chat.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Ftyping&method=POST&body=%7B%0A%20%20%22action%22%3A%20%22typing%22%2C%0A%20%20%22chat%22%3A%20%22%2B1234567890%22%2C%0A%20%20%22duration%22%3A%205%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"sendTypingStatus","security":[{"apiKey":[]}],"tags":["Chats"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"typing","description":"Update typing status","schema":{"type":"object","properties":{"action":{"type":"string","enum":["typing","recording","stop"],"description":"Typing status to be set in the target chat. Use `stop` to pause the previous typing status.","default":"typing"},"duration":{"type":"integer","minimum":2,"maximum":30,"description":"Duration in seconds for the typing / recording status to be active in the specific chat. Default to 2 seconds, maximum is 30 seconds."},"chat":{"type":"string","minLength":8,"maxLength":16,"description":"User chat phone number in [E.164](https://en.wikipedia.org/wiki/E.164) format, for example: `+1234567890`"},"group":{"type":"string","minLength":10,"maxLength":50,"description":"Group chat ID in the format. Example: `123456789000000000@g.us`"}},"required":["action"],"additionalProperties":false}}],"responses":{"200":{"description":"Typing status updated","schema":{"type":"object","properties":{"message":{"type":"string"},"chat":{"type":"string"},"group":{"type":"string"},"status":{"type":"string","enum":["typing","recording","stop"]}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Send typing status in a user chat\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/typing \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"action\":\"typing\",\"chat\":\"+1234567890\",\"duration\":5}'\n\n\n// Send typing status in a group chat\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/typing \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"action\":\"typing\",\"group\":\"123456789000000000@g.us\",\"duration\":5}'\n\n\n// Send recording status in a user chat\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/typing \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"action\":\"recording\",\"chat\":\"+1234567890\",\"duration\":15}'\n\n\n// Send recording status in a group chat\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/typing \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"action\":\"recording\",\"group\":\"123456789000000000@g.us\",\"duration\":10}'\n\n\n// Send stop typing/recording status in a user chat\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/typing \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"action\":\"stop\",\"chat\":\"+1234567890\"}'\n\n\n// Send stop typing/recording status in a group chat\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/typing \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"action\":\"stop\",\"group\":\"123456789000000000@g.us\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Send typing status in a user chat\necho '{\"action\":\"typing\",\"chat\":\"+1234567890\",\"duration\":5}' |  \\\n  http POST https://api.wassenger.com/v1/chat/{deviceId}/typing \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Send typing status in a group chat\necho '{\"action\":\"typing\",\"group\":\"123456789000000000@g.us\",\"duration\":5}' |  \\\n  http POST https://api.wassenger.com/v1/chat/{deviceId}/typing \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Send recording status in a user chat\necho '{\"action\":\"recording\",\"chat\":\"+1234567890\",\"duration\":15}' |  \\\n  http POST https://api.wassenger.com/v1/chat/{deviceId}/typing \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Send recording status in a group chat\necho '{\"action\":\"recording\",\"group\":\"123456789000000000@g.us\",\"duration\":10}' |  \\\n  http POST https://api.wassenger.com/v1/chat/{deviceId}/typing \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Send stop typing/recording status in a user chat\necho '{\"action\":\"stop\",\"chat\":\"+1234567890\"}' |  \\\n  http POST https://api.wassenger.com/v1/chat/{deviceId}/typing \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Send stop typing/recording status in a group chat\necho '{\"action\":\"stop\",\"group\":\"123456789000000000@g.us\"}' |  \\\n  http POST https://api.wassenger.com/v1/chat/{deviceId}/typing \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Send typing status in a user chat\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/typing';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"typing\",\"chat\":\"+1234567890\",\"duration\":5}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send typing status in a group chat\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/typing';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"typing\",\"group\":\"123456789000000000@g.us\",\"duration\":5}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send recording status in a user chat\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/typing';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"recording\",\"chat\":\"+1234567890\",\"duration\":15}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send recording status in a group chat\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/typing';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"recording\",\"group\":\"123456789000000000@g.us\",\"duration\":10}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send stop typing/recording status in a user chat\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/typing';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"stop\",\"chat\":\"+1234567890\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send stop typing/recording status in a group chat\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/typing';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"stop\",\"group\":\"123456789000000000@g.us\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Send typing status in a user chat\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/typing',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {action: 'typing', chat: '+1234567890', duration: 5}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send typing status in a group chat\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/typing',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {action: 'typing', group: '123456789000000000@g.us', duration: 5}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send recording status in a user chat\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/typing',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {action: 'recording', chat: '+1234567890', duration: 15}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send recording status in a group chat\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/typing',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {action: 'recording', group: '123456789000000000@g.us', duration: 10}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send stop typing/recording status in a user chat\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/typing',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {action: 'stop', chat: '+1234567890'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send stop typing/recording status in a group chat\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/typing',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {action: 'stop', group: '123456789000000000@g.us'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Send typing status in a user chat\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/typing');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  action: 'typing',\n  chat: '+1234567890',\n  duration: 5\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Send typing status in a group chat\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/typing');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  action: 'typing',\n  group: '123456789000000000@g.us',\n  duration: 5\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Send recording status in a user chat\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/typing');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  action: 'recording',\n  chat: '+1234567890',\n  duration: 15\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Send recording status in a group chat\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/typing');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  action: 'recording',\n  group: '123456789000000000@g.us',\n  duration: 10\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Send stop typing/recording status in a user chat\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/typing');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  action: 'stop',\n  chat: '+1234567890'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Send stop typing/recording status in a group chat\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/typing');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  action: 'stop',\n  group: '123456789000000000@g.us'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Send typing status in a user chat\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/typing', [\n  'body' => '{\"action\":\"typing\",\"chat\":\"+1234567890\",\"duration\":5}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Send typing status in a group chat\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/typing', [\n  'body' => '{\"action\":\"typing\",\"group\":\"123456789000000000@g.us\",\"duration\":5}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Send recording status in a user chat\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/typing', [\n  'body' => '{\"action\":\"recording\",\"chat\":\"+1234567890\",\"duration\":15}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Send recording status in a group chat\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/typing', [\n  'body' => '{\"action\":\"recording\",\"group\":\"123456789000000000@g.us\",\"duration\":10}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Send stop typing/recording status in a user chat\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/typing', [\n  'body' => '{\"action\":\"stop\",\"chat\":\"+1234567890\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Send stop typing/recording status in a group chat\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/typing', [\n  'body' => '{\"action\":\"stop\",\"group\":\"123456789000000000@g.us\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Send typing status in a user chat\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'action' => 'typing',\n  'chat' => '+1234567890',\n  'duration' => 5\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/typing');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Send typing status in a group chat\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'action' => 'typing',\n  'group' => '123456789000000000@g.us',\n  'duration' => 5\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/typing');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Send recording status in a user chat\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'action' => 'recording',\n  'chat' => '+1234567890',\n  'duration' => 15\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/typing');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Send recording status in a group chat\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'action' => 'recording',\n  'group' => '123456789000000000@g.us',\n  'duration' => 10\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/typing');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Send stop typing/recording status in a user chat\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'action' => 'stop',\n  'chat' => '+1234567890'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/typing');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Send stop typing/recording status in a group chat\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'action' => 'stop',\n  'group' => '123456789000000000@g.us'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/typing');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Send typing status in a user chat\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/typing\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'action' => 'typing',\n    'chat' => '+1234567890',\n    'duration' => 5\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Send typing status in a group chat\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/typing\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'action' => 'typing',\n    'group' => '123456789000000000@g.us',\n    'duration' => 5\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Send recording status in a user chat\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/typing\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'action' => 'recording',\n    'chat' => '+1234567890',\n    'duration' => 15\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Send recording status in a group chat\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/typing\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'action' => 'recording',\n    'group' => '123456789000000000@g.us',\n    'duration' => 10\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Send stop typing/recording status in a user chat\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/typing\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'action' => 'stop',\n    'chat' => '+1234567890'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Send stop typing/recording status in a group chat\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/typing\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'action' => 'stop',\n    'group' => '123456789000000000@g.us'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Send typing status in a user chat\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/typing\"\n\npayload = {\n    \"action\": \"typing\",\n    \"chat\": \"+1234567890\",\n    \"duration\": 5\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Send typing status in a group chat\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/typing\"\n\npayload = {\n    \"action\": \"typing\",\n    \"group\": \"123456789000000000@g.us\",\n    \"duration\": 5\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Send recording status in a user chat\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/typing\"\n\npayload = {\n    \"action\": \"recording\",\n    \"chat\": \"+1234567890\",\n    \"duration\": 15\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Send recording status in a group chat\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/typing\"\n\npayload = {\n    \"action\": \"recording\",\n    \"group\": \"123456789000000000@g.us\",\n    \"duration\": 10\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Send stop typing/recording status in a user chat\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/typing\"\n\npayload = {\n    \"action\": \"stop\",\n    \"chat\": \"+1234567890\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Send stop typing/recording status in a group chat\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/typing\"\n\npayload = {\n    \"action\": \"stop\",\n    \"group\": \"123456789000000000@g.us\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Send typing status in a user chat\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/typing';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"typing\",\"chat\":\"+1234567890\",\"duration\":5}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send typing status in a group chat\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/typing';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"typing\",\"group\":\"123456789000000000@g.us\",\"duration\":5}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send recording status in a user chat\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/typing';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"recording\",\"chat\":\"+1234567890\",\"duration\":15}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send recording status in a group chat\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/typing';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"recording\",\"group\":\"123456789000000000@g.us\",\"duration\":10}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send stop typing/recording status in a user chat\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/typing';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"stop\",\"chat\":\"+1234567890\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Send stop typing/recording status in a group chat\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/typing';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"stop\",\"group\":\"123456789000000000@g.us\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Send typing status in a user chat\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/typing',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"action\":\"typing\",\"chat\":\"+1234567890\",\"duration\":5}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Send typing status in a group chat\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/typing',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"action\":\"typing\",\"group\":\"123456789000000000@g.us\",\"duration\":5}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Send recording status in a user chat\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/typing',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"action\":\"recording\",\"chat\":\"+1234567890\",\"duration\":15}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Send recording status in a group chat\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/typing',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"action\":\"recording\",\"group\":\"123456789000000000@g.us\",\"duration\":10}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Send stop typing/recording status in a user chat\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/typing',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"action\":\"stop\",\"chat\":\"+1234567890\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Send stop typing/recording status in a group chat\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/typing',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"action\":\"stop\",\"group\":\"123456789000000000@g.us\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Send typing status in a user chat\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"action\\\":\\\"typing\\\",\\\"chat\\\":\\\"+1234567890\\\",\\\"duration\\\":5}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Send typing status in a group chat\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"action\\\":\\\"typing\\\",\\\"group\\\":\\\"123456789000000000@g.us\\\",\\\"duration\\\":5}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Send recording status in a user chat\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"action\\\":\\\"recording\\\",\\\"chat\\\":\\\"+1234567890\\\",\\\"duration\\\":15}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Send recording status in a group chat\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"action\\\":\\\"recording\\\",\\\"group\\\":\\\"123456789000000000@g.us\\\",\\\"duration\\\":10}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Send stop typing/recording status in a user chat\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"action\\\":\\\"stop\\\",\\\"chat\\\":\\\"+1234567890\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Send stop typing/recording status in a group chat\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"action\\\":\\\"stop\\\",\\\"group\\\":\\\"123456789000000000@g.us\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Send typing status in a user chat\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/typing\"\n\n\tpayload := strings.NewReader(\"{\\\"action\\\":\\\"typing\\\",\\\"chat\\\":\\\"+1234567890\\\",\\\"duration\\\":5}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Send typing status in a group chat\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/typing\"\n\n\tpayload := strings.NewReader(\"{\\\"action\\\":\\\"typing\\\",\\\"group\\\":\\\"123456789000000000@g.us\\\",\\\"duration\\\":5}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Send recording status in a user chat\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/typing\"\n\n\tpayload := strings.NewReader(\"{\\\"action\\\":\\\"recording\\\",\\\"chat\\\":\\\"+1234567890\\\",\\\"duration\\\":15}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Send recording status in a group chat\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/typing\"\n\n\tpayload := strings.NewReader(\"{\\\"action\\\":\\\"recording\\\",\\\"group\\\":\\\"123456789000000000@g.us\\\",\\\"duration\\\":10}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Send stop typing/recording status in a user chat\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/typing\"\n\n\tpayload := strings.NewReader(\"{\\\"action\\\":\\\"stop\\\",\\\"chat\\\":\\\"+1234567890\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Send stop typing/recording status in a group chat\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/typing\"\n\n\tpayload := strings.NewReader(\"{\\\"action\\\":\\\"stop\\\",\\\"group\\\":\\\"123456789000000000@g.us\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Send typing status in a user chat\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"action\\\":\\\"typing\\\",\\\"chat\\\":\\\"+1234567890\\\",\\\"duration\\\":5}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Send typing status in a group chat\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"action\\\":\\\"typing\\\",\\\"group\\\":\\\"123456789000000000@g.us\\\",\\\"duration\\\":5}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Send recording status in a user chat\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"action\\\":\\\"recording\\\",\\\"chat\\\":\\\"+1234567890\\\",\\\"duration\\\":15}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Send recording status in a group chat\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"action\\\":\\\"recording\\\",\\\"group\\\":\\\"123456789000000000@g.us\\\",\\\"duration\\\":10}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Send stop typing/recording status in a user chat\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"action\\\":\\\"stop\\\",\\\"chat\\\":\\\"+1234567890\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Send stop typing/recording status in a group chat\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"action\\\":\\\"stop\\\",\\\"group\\\":\\\"123456789000000000@g.us\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Send typing status in a user chat\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"action\\\":\\\"typing\\\",\\\"chat\\\":\\\"+1234567890\\\",\\\"duration\\\":5}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Send typing status in a group chat\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"action\\\":\\\"typing\\\",\\\"group\\\":\\\"123456789000000000@g.us\\\",\\\"duration\\\":5}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Send recording status in a user chat\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"action\\\":\\\"recording\\\",\\\"chat\\\":\\\"+1234567890\\\",\\\"duration\\\":15}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Send recording status in a group chat\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"action\\\":\\\"recording\\\",\\\"group\\\":\\\"123456789000000000@g.us\\\",\\\"duration\\\":10}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Send stop typing/recording status in a user chat\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"action\\\":\\\"stop\\\",\\\"chat\\\":\\\"+1234567890\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Send stop typing/recording status in a group chat\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"action\\\":\\\"stop\\\",\\\"group\\\":\\\"123456789000000000@g.us\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Send typing status in a user chat\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"action\\\":\\\"typing\\\",\\\"chat\\\":\\\"+1234567890\\\",\\\"duration\\\":5}\")\n  .asString();\n\n\n// Send typing status in a group chat\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"action\\\":\\\"typing\\\",\\\"group\\\":\\\"123456789000000000@g.us\\\",\\\"duration\\\":5}\")\n  .asString();\n\n\n// Send recording status in a user chat\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"action\\\":\\\"recording\\\",\\\"chat\\\":\\\"+1234567890\\\",\\\"duration\\\":15}\")\n  .asString();\n\n\n// Send recording status in a group chat\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"action\\\":\\\"recording\\\",\\\"group\\\":\\\"123456789000000000@g.us\\\",\\\"duration\\\":10}\")\n  .asString();\n\n\n// Send stop typing/recording status in a user chat\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"action\\\":\\\"stop\\\",\\\"chat\\\":\\\"+1234567890\\\"}\")\n  .asString();\n\n\n// Send stop typing/recording status in a group chat\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"action\\\":\\\"stop\\\",\\\"group\\\":\\\"123456789000000000@g.us\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Send typing status in a user chat\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"action\\\":\\\"typing\\\",\\\"chat\\\":\\\"+1234567890\\\",\\\"duration\\\":5}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Send typing status in a group chat\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"action\\\":\\\"typing\\\",\\\"group\\\":\\\"123456789000000000@g.us\\\",\\\"duration\\\":5}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Send recording status in a user chat\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"action\\\":\\\"recording\\\",\\\"chat\\\":\\\"+1234567890\\\",\\\"duration\\\":15}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Send recording status in a group chat\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"action\\\":\\\"recording\\\",\\\"group\\\":\\\"123456789000000000@g.us\\\",\\\"duration\\\":10}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Send stop typing/recording status in a user chat\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"action\\\":\\\"stop\\\",\\\"chat\\\":\\\"+1234567890\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Send stop typing/recording status in a group chat\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"action\\\":\\\"stop\\\",\\\"group\\\":\\\"123456789000000000@g.us\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/typing\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Send typing status in a user chat\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/typing\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"action\\\":\\\"typing\\\",\\\"chat\\\":\\\"+1234567890\\\",\\\"duration\\\":5}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Send typing status in a group chat\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/typing\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"action\\\":\\\"typing\\\",\\\"group\\\":\\\"123456789000000000@g.us\\\",\\\"duration\\\":5}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Send recording status in a user chat\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/typing\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"action\\\":\\\"recording\\\",\\\"chat\\\":\\\"+1234567890\\\",\\\"duration\\\":15}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Send recording status in a group chat\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/typing\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"action\\\":\\\"recording\\\",\\\"group\\\":\\\"123456789000000000@g.us\\\",\\\"duration\\\":10}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Send stop typing/recording status in a user chat\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/typing\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"action\\\":\\\"stop\\\",\\\"chat\\\":\\\"+1234567890\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Send stop typing/recording status in a group chat\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/typing\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"action\\\":\\\"stop\\\",\\\"group\\\":\\\"123456789000000000@g.us\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Send typing status in a user chat\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/typing' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"action\":\"typing\",\"chat\":\"+1234567890\",\"duration\":5}'\n\n\n# Send typing status in a group chat\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/typing' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"action\":\"typing\",\"group\":\"123456789000000000@g.us\",\"duration\":5}'\n\n\n# Send recording status in a user chat\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/typing' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"action\":\"recording\",\"chat\":\"+1234567890\",\"duration\":15}'\n\n\n# Send recording status in a group chat\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/typing' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"action\":\"recording\",\"group\":\"123456789000000000@g.us\",\"duration\":10}'\n\n\n# Send stop typing/recording status in a user chat\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/typing' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"action\":\"stop\",\"chat\":\"+1234567890\"}'\n\n\n# Send stop typing/recording status in a group chat\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/typing' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"action\":\"stop\",\"group\":\"123456789000000000@g.us\"}'"},{"lang":"ObjC","source":"// Send typing status in a user chat\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"action\": @\"typing\",\n                              @\"chat\": @\"+1234567890\",\n                              @\"duration\": @5 };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/typing\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Send typing status in a group chat\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"action\": @\"typing\",\n                              @\"group\": @\"123456789000000000@g.us\",\n                              @\"duration\": @5 };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/typing\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Send recording status in a user chat\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"action\": @\"recording\",\n                              @\"chat\": @\"+1234567890\",\n                              @\"duration\": @15 };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/typing\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Send recording status in a group chat\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"action\": @\"recording\",\n                              @\"group\": @\"123456789000000000@g.us\",\n                              @\"duration\": @10 };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/typing\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Send stop typing/recording status in a user chat\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"action\": @\"stop\",\n                              @\"chat\": @\"+1234567890\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/typing\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Send stop typing/recording status in a group chat\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"action\": @\"stop\",\n                              @\"group\": @\"123456789000000000@g.us\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/typing\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Send typing status in a user chat\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"action\": \"typing\",\n  \"chat\": \"+1234567890\",\n  \"duration\": 5\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/typing\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Send typing status in a group chat\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"action\": \"typing\",\n  \"group\": \"123456789000000000@g.us\",\n  \"duration\": 5\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/typing\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Send recording status in a user chat\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"action\": \"recording\",\n  \"chat\": \"+1234567890\",\n  \"duration\": 15\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/typing\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Send recording status in a group chat\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"action\": \"recording\",\n  \"group\": \"123456789000000000@g.us\",\n  \"duration\": 10\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/typing\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Send stop typing/recording status in a user chat\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"action\": \"stop\",\n  \"chat\": \"+1234567890\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/typing\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Send stop typing/recording status in a group chat\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"action\": \"stop\",\n  \"group\": \"123456789000000000@g.us\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/typing\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/sync":{"parameters":[],"post":{"summary":"Sync chats","description":"Synchronizes device messages across chats, default the most recent 50 chats, 50 most recent messages first.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fsync&params=%5B%7B%22key%22%3A%22size%22%2C%22value%22%3A100%7D%2C%7B%22key%22%3A%22messages%22%2C%22value%22%3A100%7D%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"syncDeviceChats","security":[{"apiKey":[]}],"tags":["Chats"],"produces":["application/json"],"parameters":[{"in":"query","name":"size","description":"Maximum most recent chats to sync","type":"number","format":"integer","default":20,"minimum":20,"maximum":500},{"in":"query","name":"messages","description":"Maximum messages to sync per chat","type":"number","format":"integer","default":50,"minimum":50,"maximum":500}],"responses":{"200":{"description":"Messages","schema":{"type":"array","items":{"$ref":"#/definitions/ioMessage"}}},"400":{"description":"Bad request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation not available due to invalid device session or unexpected error","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Sync most recent 100 chats with 100 max messages per chat\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/sync?size=100&messages=100' \\\n  --header 'Token: <api token goes here>'\n\n\n// Sync most recent 100 chats with 300 max messages per chat\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/sync?size=200&messages=100' \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Sync most recent 100 chats with 100 max messages per chat\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/sync?size=100&messages=100' \\\n  Token:'<api token goes here>'\n\n\n// Sync most recent 100 chats with 300 max messages per chat\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/sync?size=200&messages=100' \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Sync most recent 100 chats with 100 max messages per chat\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/sync?size=100&messages=100';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Sync most recent 100 chats with 300 max messages per chat\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/sync?size=200&messages=100';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Sync most recent 100 chats with 100 max messages per chat\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/sync',\n  params: {size: '100', messages: '100'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Sync most recent 100 chats with 300 max messages per chat\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/sync',\n  params: {size: '200', messages: '100'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Sync most recent 100 chats with 100 max messages per chat\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/sync');\n\nreq.query({\n  size: '100',\n  messages: '100'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Sync most recent 100 chats with 300 max messages per chat\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/sync');\n\nreq.query({\n  size: '200',\n  messages: '100'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Sync most recent 100 chats with 100 max messages per chat\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/sync?size=100&messages=100', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Sync most recent 100 chats with 300 max messages per chat\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/sync?size=200&messages=100', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Sync most recent 100 chats with 100 max messages per chat\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/sync');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'size' => '100',\n  'messages' => '100'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Sync most recent 100 chats with 300 max messages per chat\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/sync');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'size' => '200',\n  'messages' => '100'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Sync most recent 100 chats with 100 max messages per chat\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/sync?size=100&messages=100\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Sync most recent 100 chats with 300 max messages per chat\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/sync?size=200&messages=100\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Sync most recent 100 chats with 100 max messages per chat\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/sync\"\n\nquerystring = {\"size\":\"100\",\"messages\":\"100\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Sync most recent 100 chats with 300 max messages per chat\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/sync\"\n\nquerystring = {\"size\":\"200\",\"messages\":\"100\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Sync most recent 100 chats with 100 max messages per chat\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/sync?size=100&messages=100';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Sync most recent 100 chats with 300 max messages per chat\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/sync?size=200&messages=100';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Sync most recent 100 chats with 100 max messages per chat\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/sync?size=100&messages=100',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Sync most recent 100 chats with 300 max messages per chat\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/sync?size=200&messages=100',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Sync most recent 100 chats with 100 max messages per chat\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/sync?size=100&messages=100\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Sync most recent 100 chats with 300 max messages per chat\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/sync?size=200&messages=100\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Sync most recent 100 chats with 100 max messages per chat\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/sync?size=100&messages=100\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Sync most recent 100 chats with 300 max messages per chat\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/sync?size=200&messages=100\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Sync most recent 100 chats with 100 max messages per chat\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/sync?size=100&messages=100\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Sync most recent 100 chats with 300 max messages per chat\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/sync?size=200&messages=100\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Sync most recent 100 chats with 100 max messages per chat\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/sync?size=100&messages=100\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Sync most recent 100 chats with 300 max messages per chat\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/sync?size=200&messages=100\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Sync most recent 100 chats with 100 max messages per chat\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/sync?size=100&messages=100\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Sync most recent 100 chats with 300 max messages per chat\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/sync?size=200&messages=100\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Sync most recent 100 chats with 100 max messages per chat\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/sync?size=100&messages=100\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Sync most recent 100 chats with 300 max messages per chat\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/sync?size=200&messages=100\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Sync most recent 100 chats with 100 max messages per chat\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/sync?size=100&messages=100\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Sync most recent 100 chats with 300 max messages per chat\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/sync?size=200&messages=100\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Sync most recent 100 chats with 100 max messages per chat\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/sync?size=100&messages=100' -Method GET -Headers $headers\n\n\n# Sync most recent 100 chats with 300 max messages per chat\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/sync?size=200&messages=100' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Sync most recent 100 chats with 100 max messages per chat\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/sync?size=100&messages=100\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Sync most recent 100 chats with 300 max messages per chat\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/sync?size=200&messages=100\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Sync most recent 100 chats with 100 max messages per chat\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/sync?size=100&messages=100\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Sync most recent 100 chats with 300 max messages per chat\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/sync?size=200&messages=100\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/stream":{"parameters":[]},"/io/{deviceId}/status/{statusId}":{"parameters":[],"get":{"summary":"Get status by ID","description":"Retrieve user status story by WhatsApp ID (20-22 hexadecimal length value) or platform ID (24-length hexadecimal value), optionally filtered by search params.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fstatus%2F%7BstatusWid%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getUserStatusById","security":[{"apiKey":[]}],"tags":["User Status"],"produces":["application/json"],"responses":{"200":{"description":"User Status","schema":{"$ref":"#/definitions/ioMessage"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get most recent user statuses\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/status/{statusWid} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get most recent user statuses\nhttp GET https://api.wassenger.com/v1/chat/{deviceId}/status/{statusWid} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get most recent user statuses\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/status/{statusWid}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get most recent user statuses\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/status/{statusWid}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get most recent user statuses\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/status/{statusWid}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get most recent user statuses\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/status/{statusWid}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get most recent user statuses\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/status/{statusWid}');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get most recent user statuses\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/status/{statusWid}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get most recent user statuses\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/status/{statusWid}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get most recent user statuses\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/status/{statusWid}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get most recent user statuses\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/status/{statusWid}',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get most recent user statuses\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/status/{statusWid}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get most recent user statuses\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/status/{statusWid}\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get most recent user statuses\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/status/{statusWid}\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get most recent user statuses\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/status/{statusWid}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get most recent user statuses\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/status/{statusWid}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get most recent user statuses\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/status/{statusWid}\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get most recent user statuses\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/status/{statusWid}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get most recent user statuses\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/status/{statusWid}' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get most recent user statuses\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/status/{statusWid}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get most recent user statuses\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/status/{statusWid}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/status":{"parameters":[],"get":{"summary":"Search status","description":"Search user status story historical updates, optionally filtered by search params. You can browse user status historical updates from past publications as long as they were synced with the platform, even when they have expired after 24 hours of publication.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fstatus&params=%5B%7B%22key%22%3A%22size%22%2C%22value%22%3A20%7D%2C%7B%22key%22%3A%22page%22%2C%22value%22%3A0%7D%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getUserStatus","security":[{"apiKey":[]}],"tags":["User Status"],"produces":["application/json"],"parameters":[{"in":"query","name":"flow","type":"string","enum":["in","out"],"description":"Filter by inbound or outbound messages"},{"in":"query","name":"mine","type":"boolean","default":false,"description":"Set `true` to return statuses published by your own WhatsApp number"},{"in":"query","name":"scheduled","type":"boolean","default":false,"description":"Return only scheduled status to be published in the future. Note: the returned data structure is different from the regular status response that have been already processed by WhatsApp"},{"in":"query","name":"ack","type":"array","collectionFormat":"csv","description":"Filter messages by delivery ACK status","maximum":8,"items":{"type":"string","enum":["failed","sent","read","readed","played","error","pending","delivered"]}},{"in":"query","name":"wid","type":"array","collectionFormat":"csv","description":"Filter status by WID (WhatsApp ID). Multiple values allowed separated by commas.","minimum":1,"maximum":50,"items":{"type":"string","minLength":18,"maxLength":40}},{"in":"query","name":"search","type":"string","description":"Search status by partial text content, contact name or media filename","maxLength":100},{"in":"query","name":"chat","type":"string","description":"Filter status by chat WhatsApp ID. This filter works for user chats, groups and channels. E.g: `1234567890@c.us`, `123456789000000000@g.us`, `123000098765421000@newsletter`","minLength":9,"maxLength":40},{"name":"phone","description":"Return status sent from a given phone number or WhatsApp WID","in":"query","type":"string","minLength":9,"maxLength":32},{"in":"query","name":"type","type":"array","collectionFormat":"csv","description":"Filter status updates by message type","items":{"type":"string","enum":["text","image","video"]}},{"name":"reference","description":"Filter messages by reference field exact match","in":"query","type":"string","maxLength":150,"minLength":1},{"in":"query","name":"kind","type":"array","collectionFormat":"csv","description":"Filter message by entry kind","items":{"type":"string","enum":["note","event","status","message"]}},{"name":"begin","description":"Return newest messages starting from the given message ID and excluding it in the results. Note that by default messages are sorted in descending order by creation date, unless you explicitly pass the `sort=date:asc` query param.","in":"query","type":"string","maxLength":50,"minLength":18},{"name":"end","description":"Return oldest messages starting from the given message ID and excluding it in the results.","in":"query","type":"string","maxLength":50,"minLength":18},{"name":"after","description":"Messages created after the given date","in":"query","type":"string","format":"date-time"},{"name":"before","description":"Messages created before the given date","in":"query","type":"string","format":"date-time"},{"in":"query","name":"sort","type":"array","collectionFormat":"csv","description":"Messages sorting: recent first or oldest first","items":{"type":"string","default":"date:desc","enum":["date:asc","date:desc"]}},{"in":"query","name":"page","description":"Results page number (starting from 0)","type":"number","format":"integer","default":0,"minimum":0,"maximum":500},{"in":"query","name":"size","description":"Results page size","type":"number","format":"integer","default":20,"minimum":1,"maximum":50}],"responses":{"200":{"description":"User Statuses","schema":{"type":"array","items":{"$ref":"#/definitions/ioMessage"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get most recent user statuses\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/status?size=20&page=0' \\\n  --header 'Token: <api token goes here>'\n\n\n// Get my own statuses\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/status?mine=true' \\\n  --header 'Token: <api token goes here>'\n\n\n// Get statuses send from a phone number \ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/status?from=1234567890' \\\n  --header 'Token: <api token goes here>'\n\n\n// Get scheduled user statuses\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/status?scheduled=true&size=50' \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get most recent user statuses\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/status?size=20&page=0' \\\n  Token:'<api token goes here>'\n\n\n// Get my own statuses\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/status?mine=true' \\\n  Token:'<api token goes here>'\n\n\n// Get statuses send from a phone number \nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/status?from=1234567890' \\\n  Token:'<api token goes here>'\n\n\n// Get scheduled user statuses\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/status?scheduled=true&size=50' \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get most recent user statuses\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/status?size=20&page=0';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get my own statuses\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/status?mine=true';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get statuses send from a phone number \nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/status?from=1234567890';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get scheduled user statuses\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/status?scheduled=true&size=50';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get most recent user statuses\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/status',\n  params: {size: '20', page: '0'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get my own statuses\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/status',\n  params: {mine: 'true'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get statuses send from a phone number \nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/status',\n  params: {from: '1234567890'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get scheduled user statuses\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/status',\n  params: {scheduled: 'true', size: '50'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get most recent user statuses\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/status');\n\nreq.query({\n  size: '20',\n  page: '0'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get my own statuses\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/status');\n\nreq.query({\n  mine: 'true'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get statuses send from a phone number \nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/status');\n\nreq.query({\n  from: '1234567890'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get scheduled user statuses\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/status');\n\nreq.query({\n  scheduled: 'true',\n  size: '50'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get most recent user statuses\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/status?size=20&page=0', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get my own statuses\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/status?mine=true', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get statuses send from a phone number \n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/status?from=1234567890', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get scheduled user statuses\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/status?scheduled=true&size=50', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get most recent user statuses\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/status');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'size' => '20',\n  'page' => '0'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get my own statuses\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/status');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'mine' => 'true'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get statuses send from a phone number \n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/status');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'from' => '1234567890'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get scheduled user statuses\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/status');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'scheduled' => 'true',\n  'size' => '50'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get most recent user statuses\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/status?size=20&page=0\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get my own statuses\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/status?mine=true\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get statuses send from a phone number \n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/status?from=1234567890\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get scheduled user statuses\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/status?scheduled=true&size=50\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get most recent user statuses\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/status\"\n\nquerystring = {\"size\":\"20\",\"page\":\"0\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Get my own statuses\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/status\"\n\nquerystring = {\"mine\":\"true\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Get statuses send from a phone number \nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/status\"\n\nquerystring = {\"from\":\"1234567890\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Get scheduled user statuses\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/status\"\n\nquerystring = {\"scheduled\":\"true\",\"size\":\"50\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get most recent user statuses\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/status?size=20&page=0';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get my own statuses\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/status?mine=true';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get statuses send from a phone number \nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/status?from=1234567890';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get scheduled user statuses\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/status?scheduled=true&size=50';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get most recent user statuses\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/status?size=20&page=0',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get my own statuses\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/status?mine=true',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get statuses send from a phone number \nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/status?from=1234567890',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get scheduled user statuses\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/status?scheduled=true&size=50',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get most recent user statuses\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/status?size=20&page=0\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get my own statuses\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/status?mine=true\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get statuses send from a phone number \nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/status?from=1234567890\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get scheduled user statuses\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/status?scheduled=true&size=50\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get most recent user statuses\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/status?size=20&page=0\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get my own statuses\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/status?mine=true\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get statuses send from a phone number \npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/status?from=1234567890\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get scheduled user statuses\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/status?scheduled=true&size=50\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get most recent user statuses\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/status?size=20&page=0\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Get my own statuses\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/status?mine=true\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Get statuses send from a phone number \nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/status?from=1234567890\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Get scheduled user statuses\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/status?scheduled=true&size=50\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get most recent user statuses\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/status?size=20&page=0\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get my own statuses\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/status?mine=true\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get statuses send from a phone number \nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/status?from=1234567890\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get scheduled user statuses\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/status?scheduled=true&size=50\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get most recent user statuses\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/status?size=20&page=0\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Get my own statuses\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/status?mine=true\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Get statuses send from a phone number \nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/status?from=1234567890\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Get scheduled user statuses\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/status?scheduled=true&size=50\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get most recent user statuses\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/status?size=20&page=0\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get my own statuses\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/status?mine=true\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get statuses send from a phone number \nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/status?from=1234567890\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get scheduled user statuses\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/status?scheduled=true&size=50\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get most recent user statuses\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/status?size=20&page=0\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get my own statuses\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/status?mine=true\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get statuses send from a phone number \nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/status?from=1234567890\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get scheduled user statuses\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/status?scheduled=true&size=50\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get most recent user statuses\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/status?size=20&page=0' -Method GET -Headers $headers\n\n\n# Get my own statuses\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/status?mine=true' -Method GET -Headers $headers\n\n\n# Get statuses send from a phone number \n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/status?from=1234567890' -Method GET -Headers $headers\n\n\n# Get scheduled user statuses\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/status?scheduled=true&size=50' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get most recent user statuses\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/status?size=20&page=0\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get my own statuses\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/status?mine=true\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get statuses send from a phone number \n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/status?from=1234567890\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get scheduled user statuses\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/status?scheduled=true&size=50\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get most recent user statuses\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/status?size=20&page=0\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get my own statuses\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/status?mine=true\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get statuses send from a phone number \nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/status?from=1234567890\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get scheduled user statuses\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/status?scheduled=true&size=50\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"post":{"summary":"Publish new status","description":"Publish a new WhatsApp Status (also known as User Story or WhatsApp Story) using text, links, image or video for the specific WhatsApp number.\n\n\n\nOptionally you can schedule the user status update at a specific ISO date or using a delay in seconds or time notation, e.g: `2h`, `1d`, `7d`.\n\n\n\n**Note**: WhatsApp status API feature is only available in the Platform plans. If you want to use it, please [upgrade your plan](/number/plan?product=io).\n\n\n\n### How status update processing works\n\n\n\n- By default WhatsApp status updates are processed in real-time, unless it is specificed as a scheduled or delayed update.\n\n- When status updates are scheduled, they are store in a queue in a non-strict first-in-first-out (FIFO) order.\n\n- Strict order can be enforced by specifying the `order` = `true` field in JSON payload ([example](/help/api-tester?example=send-status-ordered)).\n\n\n\n### Can you use template variables in status messages?\n\n\n\nNo, template variables syntax is not supported in user status messages.\n\n\n\n### I have multiple numbers connected: how to send messages through a specific number?\n\n\n\nIf you have multiple numbers connected to your account, you need to specify the `device` field in the JSON body with the target WhatsApp number device ID (24 characters hexadecimal value) you want to send the messages through.\n\nIf the `device` field is not specified, messages will be sent through the first connected WhatsApp number in your account.\n\n\n\n[Here is an example on how to send a message through a specific WhatsApp number](/help/api-tester?example=device-routing)\n\n\n\n### Live API testing with examples\n\n\n\n[Go to the API live tester with dozens of examples](/help/api-tester)\n\n\n\n- 💬 [Update WhatsApp status with text](/help/api-tester?example=send-status)\n\n- 💬 [Update WhatsApp status with an image](/help/api-tester?example=send-status-image)\n\n- 💬 [Update WhatsApp status with a video](/help/api-tester?example=send-status-video)\n\n- 💬 [Schedule WhatsApp status update](/help/api-tester?example=send-status-scheduled)\n\n- 💬 [Schedule a delayed WhatsApp status update](/help/api-tester?example=send-status-delay)\n\n- 💬 [Schedule WhatsApp status update in strict publication order](/help/api-tester?example=send-status-ordered)\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7Bdevice.id%7D%2Fstatus&method=POST&body=%7B%0A%20%20%22message%22%3A%20%22This%20is%20an%20automated%20WhatsApp%20status%20update%3A%20https%3A%2F%2Fyoutube.com%22%2C%0A%20%20%22font%22%3A%20%22helvetica%22%2C%0A%20%20%22color%22%3A%20%22olive_green%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateUserStatus","tags":["User Status"],"produces":["application/json"],"consumes":["application/json"],"security":[{"apiKey":[]}],"parameters":[{"in":"body","name":"status","description":"Publish a new WhatsApp status","schema":{"type":"object","properties":{"message":{"type":"string","minLength":0,"maxLength":650,"description":"Text to be sent. WhatsApp rich text syntax allowed. [Read more about the syntax here](https://bit.ly/whatsapp-format-text). In group chats you can also mention participants using the following syntax: `@1234567890` where `1234567890` is the [E.164](https://en.wikipedia.org/wiki/E.164) phone number of the participant user."},"font":{"type":"string","enum":["helvetica","serif","norican"],"description":"Font style to be used in the message. Defaults to `helvetica`."},"color":{"type":"string","enum":["red_purple","moss_green","dark_khaki","wine_red","light_taupe","goldenrod","olive_green","light_plum","dark_purple","light_coral","medium_sea_green","salmon","sky_blue","light_sky_blue","dark_taupe","slate_gray","dodger_blue","dark_magenta","seafoam_green","charcoal","periwinkle"],"description":"Background color to be used in the message.\n\n**Available colors**:\n\n- `red_purple`\n- `moss_green`\n- `dark_khaki`\n- `wine_red`\n- `light_taupe`\n- `goldenrod`\n- `olive_green`\n- `light_plum`\n- `dark_purple`\n- `light_coral`\n- `medium_sea_green`\n- `salmon`\n- `sky_blue`\n- `light_sky_blue`\n- `dark_taupe`\n- `slate_gray`\n- `dodger_blue`\n- `dark_magenta`\n- `seafoam_green`\n- `charcoal`\n- `periwinkle`"},"schedule":{"type":"object","properties":{"delay":{"type":"number","format":"float","minimum":1,"maximum":63072000,"description":"Schedule message delivery after the given seconds. E.g: 300"},"delayTo":{"type":"string","pattern":"^([0-9]{1,8})([y|M|w|d|h|m|s]{1})$","minLength":2,"maxLength":5,"description":"Schedule message delivery using time duration syntax. Example valid values are: 1h, 15m, 12h, 1d. Read more about the duration syntax [here](https://momentjs.com/docs/#/durations/)."},"date":{"type":"string","format":"date-time","description":"Schedule message delivery after a custom [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format date time. E.g: 2019-01-23T23:22:59.776Z"}},"additionalProperties":false,"description":"Optional update scheduling, one of the following fields must be present: `delay`, `delayTo` or `date`"},"reference":{"type":"string","minLength":1,"maxLength":150,"description":"Optional user-defined message reference for easy traceability with existent systems. For instance, you can define as reference the ID of the customer in your CRM. The `reference` value will be provided in every webhook event."},"media":{"type":"object","properties":{"file":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Uploaded file ID to send as media message content. The file must be previously uploaded by using the [Upload file API endpoint](#tag/Files/operation/uploadFile) and obtaning the unique file ID (24 length alphanumeric value)\n\n**Important**: you cannot put the file content here. Alternatively, you can send a media file using the `media.url` field specifying a publicly accessible file URL (see the `url` field below)."},"url":{"type":"string","minLength":10,"maxLength":1024,"description":"Internet reachable public URL to download the file content. If the URL returns an error, is not reachable from the Internet, or the file type is not valid, the API will return a `400 Bad Request` error."},"message":{"type":"string","minLength":0,"maxLength":15000,"description":"Optional media file text caption to use when deliverying the message - Only applicable to image and video media files, otherwise ignored. In case there is no message body field defined in the actual message to be delivered."},"filename":{"type":"string","minLength":3,"maxLength":200,"description":"Optional file name. If not defined, it is taken from the file URL or form content, if available. Otherwise a random file name will be generated."},"reference":{"type":"string","minLength":2,"maxLength":150,"description":"Optional file reference user-defined identifier. This might be useful to identify files across systems, for instance, a CRM or storage system."},"format":{"type":"string","enum":["gif","ptt","native"],"description":"Optional file display format when applicable for GIFs (videos) and Voice recording (audios)","default":"native"},"permission":{"type":"string","enum":["public","readonly","private"],"description":"Optional file access permission. Defaults to `public`: all team members can access, download and send the file. If set to `private` only the file owner can access, download and send the file."},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":50},"minItems":1,"maxItems":10,"description":"Optional file tags, up to 10 tags per file. Each tag cannot have more than 50 characters."},"expiration":{"type":"string","minLength":2,"maxLength":5,"enum":["10m","30m","1h","6h","12h","1d","2d","3d","5d","6d","7d","15d","30d","60d","90d","120d","180d","360d","1y","2y"],"description":"File storage expiration time limit, after which the file will be deleted from the system. Defaults to 15 days.","default":"30d"}},"additionalProperties":false,"description":"Update user status with an image or video (jpeg, png, webp, mp4)"}},"additionalProperties":false}},{"name":"Idempotency-Key","in":"header","required":false,"type":"string","minimum":6,"maximum":36,"description":"Optional header. The idempotency key is a unique value generated by the API client which the server uses to recognize subsequent retries of the same request. How you create unique keys is up to you, but we suggest using [V4 UUIDs](https://en.wikipedia.org/wiki/Universally_unique_identifier), or another random string with enough entropy to avoid collisions. If a message with the same idempotency key already exists, the server will reply with a `409 Conflict` status, referencing the existing message ID in the JSON response error at `meta.message` field."}],"responses":{"201":{"description":"Message created","schema":{"$ref":"#/definitions/message"},"headers":{"Device-ID":{"type":"string","description":"Device ID used for message delivery"},"Device-Phone":{"type":"string","description":"Device phone number used for message delivery"},"Queue-Status":{"type":"string","enum":["pause","active","reject","freeze"],"description":"Current device messages queue status"},"Queue-Limit":{"type":"number","format":"integer","description":"Maximum allowed messages queue size in the current device"},"Queue-Size":{"type":"number","format":"integer","description":"Total messages waiting in the device's queue currently"},"Queue-Available":{"type":"number","format":"integer","description":"Available free message slots in the device's queue"}}},"400":{"description":"Bad request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Queue status does not allow to enqueue or deliver new messages","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Phone number does not exists in WhatsApp","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict - Message already exists","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Server error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service unavailable","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Publish a new WhatsApp status with a text message and background color\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/chat/{device.id}/status \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"message\":\"This is an automated WhatsApp status update: https://youtube.com\",\"font\":\"helvetica\",\"color\":\"olive_green\"}'\n\n\n// Publish a new WhatsApp status with an image and caption\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/chat/{device.id}/status \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"message\":\"This is an automated WhatsApp status with image\",\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}'\n\n\n// Publish a new WhatsApp status with an video and caption\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/chat/{device.id}/status \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"message\":\"This is an automated WhatsApp status with video\",\"media\":{\"url\":\"https://download.samplelib.com/mp4/sample-5s.mp4\"}}'\n\n\n// Publish a new WhatsApp status with a scheduled delivery based on time unit\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/chat/{device.id}/status \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"message\":\"This is an scheduled WhatsApp status update for tomorrow\",\"schedule\":{\"delayTo\":\"1h\"},\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}'\n\n\n// Publish a new WhatsApp status with a scheduled delivery\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/chat/{device.id}/status \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"message\":\"This is an scheduled WhatsApp status update using an ISO date\",\"schedule\":{\"date\":\"2026-11-07T09:42:46.664Z\"},\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}'\n\n\n// Publish a new WhatsApp status with a scheduled delivery in strict order\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/chat/{device.id}/status \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"message\":\"This is an scheduled WhatsApp status update using an ISO date\",\"order\":true,\"schedule\":{\"date\":\"2026-11-07T09:42:46.664Z\"},\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Publish a new WhatsApp status with a text message and background color\necho '{\"message\":\"This is an automated WhatsApp status update: https://youtube.com\",\"font\":\"helvetica\",\"color\":\"olive_green\"}' |  \\\n  http POST https://api.wassenger.com/v1/chat/{device.id}/status \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Publish a new WhatsApp status with an image and caption\necho '{\"message\":\"This is an automated WhatsApp status with image\",\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}' |  \\\n  http POST https://api.wassenger.com/v1/chat/{device.id}/status \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Publish a new WhatsApp status with an video and caption\necho '{\"message\":\"This is an automated WhatsApp status with video\",\"media\":{\"url\":\"https://download.samplelib.com/mp4/sample-5s.mp4\"}}' |  \\\n  http POST https://api.wassenger.com/v1/chat/{device.id}/status \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Publish a new WhatsApp status with a scheduled delivery based on time unit\necho '{\"message\":\"This is an scheduled WhatsApp status update for tomorrow\",\"schedule\":{\"delayTo\":\"1h\"},\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}' |  \\\n  http POST https://api.wassenger.com/v1/chat/{device.id}/status \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Publish a new WhatsApp status with a scheduled delivery\necho '{\"message\":\"This is an scheduled WhatsApp status update using an ISO date\",\"schedule\":{\"date\":\"2026-11-07T09:42:46.664Z\"},\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}' |  \\\n  http POST https://api.wassenger.com/v1/chat/{device.id}/status \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Publish a new WhatsApp status with a scheduled delivery in strict order\necho '{\"message\":\"This is an scheduled WhatsApp status update using an ISO date\",\"order\":true,\"schedule\":{\"date\":\"2026-11-07T09:42:46.664Z\"},\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}' |  \\\n  http POST https://api.wassenger.com/v1/chat/{device.id}/status \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Publish a new WhatsApp status with a text message and background color\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{device.id}/status';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"message\":\"This is an automated WhatsApp status update: https://youtube.com\",\"font\":\"helvetica\",\"color\":\"olive_green\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Publish a new WhatsApp status with an image and caption\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{device.id}/status';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"message\":\"This is an automated WhatsApp status with image\",\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Publish a new WhatsApp status with an video and caption\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{device.id}/status';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"message\":\"This is an automated WhatsApp status with video\",\"media\":{\"url\":\"https://download.samplelib.com/mp4/sample-5s.mp4\"}}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Publish a new WhatsApp status with a scheduled delivery based on time unit\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{device.id}/status';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"message\":\"This is an scheduled WhatsApp status update for tomorrow\",\"schedule\":{\"delayTo\":\"1h\"},\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Publish a new WhatsApp status with a scheduled delivery\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{device.id}/status';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"message\":\"This is an scheduled WhatsApp status update using an ISO date\",\"schedule\":{\"date\":\"2026-11-07T09:42:46.664Z\"},\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Publish a new WhatsApp status with a scheduled delivery in strict order\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{device.id}/status';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"message\":\"This is an scheduled WhatsApp status update using an ISO date\",\"order\":true,\"schedule\":{\"date\":\"2026-11-07T09:42:46.664Z\"},\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Publish a new WhatsApp status with a text message and background color\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/chat/{device.id}/status',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    message: 'This is an automated WhatsApp status update: https://youtube.com',\n    font: 'helvetica',\n    color: 'olive_green'\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Publish a new WhatsApp status with an image and caption\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/chat/{device.id}/status',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    message: 'This is an automated WhatsApp status with image',\n    media: {url: 'https://picsum.photos/seed/picsum/600/400'}\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Publish a new WhatsApp status with an video and caption\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/chat/{device.id}/status',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    message: 'This is an automated WhatsApp status with video',\n    media: {url: 'https://download.samplelib.com/mp4/sample-5s.mp4'}\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Publish a new WhatsApp status with a scheduled delivery based on time unit\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/chat/{device.id}/status',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    message: 'This is an scheduled WhatsApp status update for tomorrow',\n    schedule: {delayTo: '1h'},\n    media: {url: 'https://picsum.photos/seed/picsum/600/400'}\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Publish a new WhatsApp status with a scheduled delivery\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/chat/{device.id}/status',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    message: 'This is an scheduled WhatsApp status update using an ISO date',\n    schedule: {date: '2026-11-07T09:42:46.664Z'},\n    media: {url: 'https://picsum.photos/seed/picsum/600/400'}\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Publish a new WhatsApp status with a scheduled delivery in strict order\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/chat/{device.id}/status',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    message: 'This is an scheduled WhatsApp status update using an ISO date',\n    order: true,\n    schedule: {date: '2026-11-07T09:42:46.664Z'},\n    media: {url: 'https://picsum.photos/seed/picsum/600/400'}\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Publish a new WhatsApp status with a text message and background color\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/chat/{device.id}/status');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  message: 'This is an automated WhatsApp status update: https://youtube.com',\n  font: 'helvetica',\n  color: 'olive_green'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Publish a new WhatsApp status with an image and caption\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/chat/{device.id}/status');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  message: 'This is an automated WhatsApp status with image',\n  media: {\n    url: 'https://picsum.photos/seed/picsum/600/400'\n  }\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Publish a new WhatsApp status with an video and caption\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/chat/{device.id}/status');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  message: 'This is an automated WhatsApp status with video',\n  media: {\n    url: 'https://download.samplelib.com/mp4/sample-5s.mp4'\n  }\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Publish a new WhatsApp status with a scheduled delivery based on time unit\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/chat/{device.id}/status');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  message: 'This is an scheduled WhatsApp status update for tomorrow',\n  schedule: {\n    delayTo: '1h'\n  },\n  media: {\n    url: 'https://picsum.photos/seed/picsum/600/400'\n  }\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Publish a new WhatsApp status with a scheduled delivery\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/chat/{device.id}/status');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  message: 'This is an scheduled WhatsApp status update using an ISO date',\n  schedule: {\n    date: '2026-11-07T09:42:46.664Z'\n  },\n  media: {\n    url: 'https://picsum.photos/seed/picsum/600/400'\n  }\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Publish a new WhatsApp status with a scheduled delivery in strict order\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/chat/{device.id}/status');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  message: 'This is an scheduled WhatsApp status update using an ISO date',\n  order: true,\n  schedule: {\n    date: '2026-11-07T09:42:46.664Z'\n  },\n  media: {\n    url: 'https://picsum.photos/seed/picsum/600/400'\n  }\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Publish a new WhatsApp status with a text message and background color\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/chat/{device.id}/status', [\n  'body' => '{\"message\":\"This is an automated WhatsApp status update: https://youtube.com\",\"font\":\"helvetica\",\"color\":\"olive_green\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Publish a new WhatsApp status with an image and caption\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/chat/{device.id}/status', [\n  'body' => '{\"message\":\"This is an automated WhatsApp status with image\",\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Publish a new WhatsApp status with an video and caption\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/chat/{device.id}/status', [\n  'body' => '{\"message\":\"This is an automated WhatsApp status with video\",\"media\":{\"url\":\"https://download.samplelib.com/mp4/sample-5s.mp4\"}}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Publish a new WhatsApp status with a scheduled delivery based on time unit\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/chat/{device.id}/status', [\n  'body' => '{\"message\":\"This is an scheduled WhatsApp status update for tomorrow\",\"schedule\":{\"delayTo\":\"1h\"},\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Publish a new WhatsApp status with a scheduled delivery\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/chat/{device.id}/status', [\n  'body' => '{\"message\":\"This is an scheduled WhatsApp status update using an ISO date\",\"schedule\":{\"date\":\"2026-11-07T09:42:46.664Z\"},\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Publish a new WhatsApp status with a scheduled delivery in strict order\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/chat/{device.id}/status', [\n  'body' => '{\"message\":\"This is an scheduled WhatsApp status update using an ISO date\",\"order\":true,\"schedule\":{\"date\":\"2026-11-07T09:42:46.664Z\"},\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Publish a new WhatsApp status with a text message and background color\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'message' => 'This is an automated WhatsApp status update: https://youtube.com',\n  'font' => 'helvetica',\n  'color' => 'olive_green'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{device.id}/status');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Publish a new WhatsApp status with an image and caption\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'message' => 'This is an automated WhatsApp status with image',\n  'media' => [\n    'url' => 'https://picsum.photos/seed/picsum/600/400'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{device.id}/status');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Publish a new WhatsApp status with an video and caption\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'message' => 'This is an automated WhatsApp status with video',\n  'media' => [\n    'url' => 'https://download.samplelib.com/mp4/sample-5s.mp4'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{device.id}/status');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Publish a new WhatsApp status with a scheduled delivery based on time unit\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'message' => 'This is an scheduled WhatsApp status update for tomorrow',\n  'schedule' => [\n    'delayTo' => '1h'\n  ],\n  'media' => [\n    'url' => 'https://picsum.photos/seed/picsum/600/400'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{device.id}/status');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Publish a new WhatsApp status with a scheduled delivery\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'message' => 'This is an scheduled WhatsApp status update using an ISO date',\n  'schedule' => [\n    'date' => '2026-11-07T09:42:46.664Z'\n  ],\n  'media' => [\n    'url' => 'https://picsum.photos/seed/picsum/600/400'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{device.id}/status');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Publish a new WhatsApp status with a scheduled delivery in strict order\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'message' => 'This is an scheduled WhatsApp status update using an ISO date',\n  'order' => null,\n  'schedule' => [\n    'date' => '2026-11-07T09:42:46.664Z'\n  ],\n  'media' => [\n    'url' => 'https://picsum.photos/seed/picsum/600/400'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{device.id}/status');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Publish a new WhatsApp status with a text message and background color\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{device.id}/status\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'message' => 'This is an automated WhatsApp status update: https://youtube.com',\n    'font' => 'helvetica',\n    'color' => 'olive_green'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Publish a new WhatsApp status with an image and caption\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{device.id}/status\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'message' => 'This is an automated WhatsApp status with image',\n    'media' => [\n        'url' => 'https://picsum.photos/seed/picsum/600/400'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Publish a new WhatsApp status with an video and caption\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{device.id}/status\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'message' => 'This is an automated WhatsApp status with video',\n    'media' => [\n        'url' => 'https://download.samplelib.com/mp4/sample-5s.mp4'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Publish a new WhatsApp status with a scheduled delivery based on time unit\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{device.id}/status\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'message' => 'This is an scheduled WhatsApp status update for tomorrow',\n    'schedule' => [\n        'delayTo' => '1h'\n    ],\n    'media' => [\n        'url' => 'https://picsum.photos/seed/picsum/600/400'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Publish a new WhatsApp status with a scheduled delivery\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{device.id}/status\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'message' => 'This is an scheduled WhatsApp status update using an ISO date',\n    'schedule' => [\n        'date' => '2026-11-07T09:42:46.664Z'\n    ],\n    'media' => [\n        'url' => 'https://picsum.photos/seed/picsum/600/400'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Publish a new WhatsApp status with a scheduled delivery in strict order\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{device.id}/status\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'message' => 'This is an scheduled WhatsApp status update using an ISO date',\n    'order' => null,\n    'schedule' => [\n        'date' => '2026-11-07T09:42:46.664Z'\n    ],\n    'media' => [\n        'url' => 'https://picsum.photos/seed/picsum/600/400'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Publish a new WhatsApp status with a text message and background color\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{device.id}/status\"\n\npayload = {\n    \"message\": \"This is an automated WhatsApp status update: https://youtube.com\",\n    \"font\": \"helvetica\",\n    \"color\": \"olive_green\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Publish a new WhatsApp status with an image and caption\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{device.id}/status\"\n\npayload = {\n    \"message\": \"This is an automated WhatsApp status with image\",\n    \"media\": { \"url\": \"https://picsum.photos/seed/picsum/600/400\" }\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Publish a new WhatsApp status with an video and caption\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{device.id}/status\"\n\npayload = {\n    \"message\": \"This is an automated WhatsApp status with video\",\n    \"media\": { \"url\": \"https://download.samplelib.com/mp4/sample-5s.mp4\" }\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Publish a new WhatsApp status with a scheduled delivery based on time unit\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{device.id}/status\"\n\npayload = {\n    \"message\": \"This is an scheduled WhatsApp status update for tomorrow\",\n    \"schedule\": { \"delayTo\": \"1h\" },\n    \"media\": { \"url\": \"https://picsum.photos/seed/picsum/600/400\" }\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Publish a new WhatsApp status with a scheduled delivery\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{device.id}/status\"\n\npayload = {\n    \"message\": \"This is an scheduled WhatsApp status update using an ISO date\",\n    \"schedule\": { \"date\": \"2026-11-07T09:42:46.664Z\" },\n    \"media\": { \"url\": \"https://picsum.photos/seed/picsum/600/400\" }\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Publish a new WhatsApp status with a scheduled delivery in strict order\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{device.id}/status\"\n\npayload = {\n    \"message\": \"This is an scheduled WhatsApp status update using an ISO date\",\n    \"order\": True,\n    \"schedule\": { \"date\": \"2026-11-07T09:42:46.664Z\" },\n    \"media\": { \"url\": \"https://picsum.photos/seed/picsum/600/400\" }\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Publish a new WhatsApp status with a text message and background color\nconst url = 'https://api.wassenger.com/v1/chat/{device.id}/status';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"message\":\"This is an automated WhatsApp status update: https://youtube.com\",\"font\":\"helvetica\",\"color\":\"olive_green\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Publish a new WhatsApp status with an image and caption\nconst url = 'https://api.wassenger.com/v1/chat/{device.id}/status';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"message\":\"This is an automated WhatsApp status with image\",\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Publish a new WhatsApp status with an video and caption\nconst url = 'https://api.wassenger.com/v1/chat/{device.id}/status';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"message\":\"This is an automated WhatsApp status with video\",\"media\":{\"url\":\"https://download.samplelib.com/mp4/sample-5s.mp4\"}}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Publish a new WhatsApp status with a scheduled delivery based on time unit\nconst url = 'https://api.wassenger.com/v1/chat/{device.id}/status';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"message\":\"This is an scheduled WhatsApp status update for tomorrow\",\"schedule\":{\"delayTo\":\"1h\"},\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Publish a new WhatsApp status with a scheduled delivery\nconst url = 'https://api.wassenger.com/v1/chat/{device.id}/status';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"message\":\"This is an scheduled WhatsApp status update using an ISO date\",\"schedule\":{\"date\":\"2026-11-07T09:42:46.664Z\"},\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Publish a new WhatsApp status with a scheduled delivery in strict order\nconst url = 'https://api.wassenger.com/v1/chat/{device.id}/status';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"message\":\"This is an scheduled WhatsApp status update using an ISO date\",\"order\":true,\"schedule\":{\"date\":\"2026-11-07T09:42:46.664Z\"},\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Publish a new WhatsApp status with a text message and background color\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{device.id}/status',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"message\":\"This is an automated WhatsApp status update: https://youtube.com\",\"font\":\"helvetica\",\"color\":\"olive_green\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Publish a new WhatsApp status with an image and caption\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{device.id}/status',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"message\":\"This is an automated WhatsApp status with image\",\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Publish a new WhatsApp status with an video and caption\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{device.id}/status',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"message\":\"This is an automated WhatsApp status with video\",\"media\":{\"url\":\"https://download.samplelib.com/mp4/sample-5s.mp4\"}}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Publish a new WhatsApp status with a scheduled delivery based on time unit\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{device.id}/status',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"message\":\"This is an scheduled WhatsApp status update for tomorrow\",\"schedule\":{\"delayTo\":\"1h\"},\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Publish a new WhatsApp status with a scheduled delivery\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{device.id}/status',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"message\":\"This is an scheduled WhatsApp status update using an ISO date\",\"schedule\":{\"date\":\"2026-11-07T09:42:46.664Z\"},\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Publish a new WhatsApp status with a scheduled delivery in strict order\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{device.id}/status',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"message\":\"This is an scheduled WhatsApp status update using an ISO date\",\"order\":true,\"schedule\":{\"date\":\"2026-11-07T09:42:46.664Z\"},\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Publish a new WhatsApp status with a text message and background color\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{device.id}/status\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"message\\\":\\\"This is an automated WhatsApp status update: https://youtube.com\\\",\\\"font\\\":\\\"helvetica\\\",\\\"color\\\":\\\"olive_green\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Publish a new WhatsApp status with an image and caption\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{device.id}/status\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"message\\\":\\\"This is an automated WhatsApp status with image\\\",\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Publish a new WhatsApp status with an video and caption\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{device.id}/status\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"message\\\":\\\"This is an automated WhatsApp status with video\\\",\\\"media\\\":{\\\"url\\\":\\\"https://download.samplelib.com/mp4/sample-5s.mp4\\\"}}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Publish a new WhatsApp status with a scheduled delivery based on time unit\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{device.id}/status\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"message\\\":\\\"This is an scheduled WhatsApp status update for tomorrow\\\",\\\"schedule\\\":{\\\"delayTo\\\":\\\"1h\\\"},\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Publish a new WhatsApp status with a scheduled delivery\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{device.id}/status\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"message\\\":\\\"This is an scheduled WhatsApp status update using an ISO date\\\",\\\"schedule\\\":{\\\"date\\\":\\\"2026-11-07T09:42:46.664Z\\\"},\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Publish a new WhatsApp status with a scheduled delivery in strict order\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{device.id}/status\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"message\\\":\\\"This is an scheduled WhatsApp status update using an ISO date\\\",\\\"order\\\":true,\\\"schedule\\\":{\\\"date\\\":\\\"2026-11-07T09:42:46.664Z\\\"},\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Publish a new WhatsApp status with a text message and background color\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{device.id}/status\"\n\n\tpayload := strings.NewReader(\"{\\\"message\\\":\\\"This is an automated WhatsApp status update: https://youtube.com\\\",\\\"font\\\":\\\"helvetica\\\",\\\"color\\\":\\\"olive_green\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Publish a new WhatsApp status with an image and caption\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{device.id}/status\"\n\n\tpayload := strings.NewReader(\"{\\\"message\\\":\\\"This is an automated WhatsApp status with image\\\",\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Publish a new WhatsApp status with an video and caption\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{device.id}/status\"\n\n\tpayload := strings.NewReader(\"{\\\"message\\\":\\\"This is an automated WhatsApp status with video\\\",\\\"media\\\":{\\\"url\\\":\\\"https://download.samplelib.com/mp4/sample-5s.mp4\\\"}}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Publish a new WhatsApp status with a scheduled delivery based on time unit\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{device.id}/status\"\n\n\tpayload := strings.NewReader(\"{\\\"message\\\":\\\"This is an scheduled WhatsApp status update for tomorrow\\\",\\\"schedule\\\":{\\\"delayTo\\\":\\\"1h\\\"},\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Publish a new WhatsApp status with a scheduled delivery\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{device.id}/status\"\n\n\tpayload := strings.NewReader(\"{\\\"message\\\":\\\"This is an scheduled WhatsApp status update using an ISO date\\\",\\\"schedule\\\":{\\\"date\\\":\\\"2026-11-07T09:42:46.664Z\\\"},\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Publish a new WhatsApp status with a scheduled delivery in strict order\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{device.id}/status\"\n\n\tpayload := strings.NewReader(\"{\\\"message\\\":\\\"This is an scheduled WhatsApp status update using an ISO date\\\",\\\"order\\\":true,\\\"schedule\\\":{\\\"date\\\":\\\"2026-11-07T09:42:46.664Z\\\"},\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Publish a new WhatsApp status with a text message and background color\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{device.id}/status\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"message\\\":\\\"This is an automated WhatsApp status update: https://youtube.com\\\",\\\"font\\\":\\\"helvetica\\\",\\\"color\\\":\\\"olive_green\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Publish a new WhatsApp status with an image and caption\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{device.id}/status\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"message\\\":\\\"This is an automated WhatsApp status with image\\\",\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Publish a new WhatsApp status with an video and caption\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{device.id}/status\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"message\\\":\\\"This is an automated WhatsApp status with video\\\",\\\"media\\\":{\\\"url\\\":\\\"https://download.samplelib.com/mp4/sample-5s.mp4\\\"}}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Publish a new WhatsApp status with a scheduled delivery based on time unit\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{device.id}/status\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"message\\\":\\\"This is an scheduled WhatsApp status update for tomorrow\\\",\\\"schedule\\\":{\\\"delayTo\\\":\\\"1h\\\"},\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Publish a new WhatsApp status with a scheduled delivery\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{device.id}/status\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"message\\\":\\\"This is an scheduled WhatsApp status update using an ISO date\\\",\\\"schedule\\\":{\\\"date\\\":\\\"2026-11-07T09:42:46.664Z\\\"},\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Publish a new WhatsApp status with a scheduled delivery in strict order\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{device.id}/status\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"message\\\":\\\"This is an scheduled WhatsApp status update using an ISO date\\\",\\\"order\\\":true,\\\"schedule\\\":{\\\"date\\\":\\\"2026-11-07T09:42:46.664Z\\\"},\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Publish a new WhatsApp status with a text message and background color\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{device.id}/status\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"message\\\":\\\"This is an automated WhatsApp status update: https://youtube.com\\\",\\\"font\\\":\\\"helvetica\\\",\\\"color\\\":\\\"olive_green\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Publish a new WhatsApp status with an image and caption\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{device.id}/status\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"message\\\":\\\"This is an automated WhatsApp status with image\\\",\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Publish a new WhatsApp status with an video and caption\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{device.id}/status\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"message\\\":\\\"This is an automated WhatsApp status with video\\\",\\\"media\\\":{\\\"url\\\":\\\"https://download.samplelib.com/mp4/sample-5s.mp4\\\"}}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Publish a new WhatsApp status with a scheduled delivery based on time unit\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{device.id}/status\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"message\\\":\\\"This is an scheduled WhatsApp status update for tomorrow\\\",\\\"schedule\\\":{\\\"delayTo\\\":\\\"1h\\\"},\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Publish a new WhatsApp status with a scheduled delivery\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{device.id}/status\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"message\\\":\\\"This is an scheduled WhatsApp status update using an ISO date\\\",\\\"schedule\\\":{\\\"date\\\":\\\"2026-11-07T09:42:46.664Z\\\"},\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Publish a new WhatsApp status with a scheduled delivery in strict order\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{device.id}/status\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"message\\\":\\\"This is an scheduled WhatsApp status update using an ISO date\\\",\\\"order\\\":true,\\\"schedule\\\":{\\\"date\\\":\\\"2026-11-07T09:42:46.664Z\\\"},\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Publish a new WhatsApp status with a text message and background color\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/chat/{device.id}/status\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"message\\\":\\\"This is an automated WhatsApp status update: https://youtube.com\\\",\\\"font\\\":\\\"helvetica\\\",\\\"color\\\":\\\"olive_green\\\"}\")\n  .asString();\n\n\n// Publish a new WhatsApp status with an image and caption\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/chat/{device.id}/status\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"message\\\":\\\"This is an automated WhatsApp status with image\\\",\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\")\n  .asString();\n\n\n// Publish a new WhatsApp status with an video and caption\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/chat/{device.id}/status\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"message\\\":\\\"This is an automated WhatsApp status with video\\\",\\\"media\\\":{\\\"url\\\":\\\"https://download.samplelib.com/mp4/sample-5s.mp4\\\"}}\")\n  .asString();\n\n\n// Publish a new WhatsApp status with a scheduled delivery based on time unit\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/chat/{device.id}/status\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"message\\\":\\\"This is an scheduled WhatsApp status update for tomorrow\\\",\\\"schedule\\\":{\\\"delayTo\\\":\\\"1h\\\"},\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\")\n  .asString();\n\n\n// Publish a new WhatsApp status with a scheduled delivery\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/chat/{device.id}/status\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"message\\\":\\\"This is an scheduled WhatsApp status update using an ISO date\\\",\\\"schedule\\\":{\\\"date\\\":\\\"2026-11-07T09:42:46.664Z\\\"},\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\")\n  .asString();\n\n\n// Publish a new WhatsApp status with a scheduled delivery in strict order\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/chat/{device.id}/status\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"message\\\":\\\"This is an scheduled WhatsApp status update using an ISO date\\\",\\\"order\\\":true,\\\"schedule\\\":{\\\"date\\\":\\\"2026-11-07T09:42:46.664Z\\\"},\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Publish a new WhatsApp status with a text message and background color\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"message\\\":\\\"This is an automated WhatsApp status update: https://youtube.com\\\",\\\"font\\\":\\\"helvetica\\\",\\\"color\\\":\\\"olive_green\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{device.id}/status\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Publish a new WhatsApp status with an image and caption\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"message\\\":\\\"This is an automated WhatsApp status with image\\\",\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{device.id}/status\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Publish a new WhatsApp status with an video and caption\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"message\\\":\\\"This is an automated WhatsApp status with video\\\",\\\"media\\\":{\\\"url\\\":\\\"https://download.samplelib.com/mp4/sample-5s.mp4\\\"}}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{device.id}/status\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Publish a new WhatsApp status with a scheduled delivery based on time unit\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"message\\\":\\\"This is an scheduled WhatsApp status update for tomorrow\\\",\\\"schedule\\\":{\\\"delayTo\\\":\\\"1h\\\"},\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{device.id}/status\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Publish a new WhatsApp status with a scheduled delivery\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"message\\\":\\\"This is an scheduled WhatsApp status update using an ISO date\\\",\\\"schedule\\\":{\\\"date\\\":\\\"2026-11-07T09:42:46.664Z\\\"},\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{device.id}/status\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Publish a new WhatsApp status with a scheduled delivery in strict order\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"message\\\":\\\"This is an scheduled WhatsApp status update using an ISO date\\\",\\\"order\\\":true,\\\"schedule\\\":{\\\"date\\\":\\\"2026-11-07T09:42:46.664Z\\\"},\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{device.id}/status\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Publish a new WhatsApp status with a text message and background color\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{device.id}/status\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"message\\\":\\\"This is an automated WhatsApp status update: https://youtube.com\\\",\\\"font\\\":\\\"helvetica\\\",\\\"color\\\":\\\"olive_green\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Publish a new WhatsApp status with an image and caption\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{device.id}/status\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"message\\\":\\\"This is an automated WhatsApp status with image\\\",\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Publish a new WhatsApp status with an video and caption\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{device.id}/status\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"message\\\":\\\"This is an automated WhatsApp status with video\\\",\\\"media\\\":{\\\"url\\\":\\\"https://download.samplelib.com/mp4/sample-5s.mp4\\\"}}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Publish a new WhatsApp status with a scheduled delivery based on time unit\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{device.id}/status\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"message\\\":\\\"This is an scheduled WhatsApp status update for tomorrow\\\",\\\"schedule\\\":{\\\"delayTo\\\":\\\"1h\\\"},\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Publish a new WhatsApp status with a scheduled delivery\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{device.id}/status\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"message\\\":\\\"This is an scheduled WhatsApp status update using an ISO date\\\",\\\"schedule\\\":{\\\"date\\\":\\\"2026-11-07T09:42:46.664Z\\\"},\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Publish a new WhatsApp status with a scheduled delivery in strict order\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{device.id}/status\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"message\\\":\\\"This is an scheduled WhatsApp status update using an ISO date\\\",\\\"order\\\":true,\\\"schedule\\\":{\\\"date\\\":\\\"2026-11-07T09:42:46.664Z\\\"},\\\"media\\\":{\\\"url\\\":\\\"https://picsum.photos/seed/picsum/600/400\\\"}}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Publish a new WhatsApp status with a text message and background color\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{device.id}/status' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"message\":\"This is an automated WhatsApp status update: https://youtube.com\",\"font\":\"helvetica\",\"color\":\"olive_green\"}'\n\n\n# Publish a new WhatsApp status with an image and caption\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{device.id}/status' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"message\":\"This is an automated WhatsApp status with image\",\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}'\n\n\n# Publish a new WhatsApp status with an video and caption\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{device.id}/status' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"message\":\"This is an automated WhatsApp status with video\",\"media\":{\"url\":\"https://download.samplelib.com/mp4/sample-5s.mp4\"}}'\n\n\n# Publish a new WhatsApp status with a scheduled delivery based on time unit\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{device.id}/status' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"message\":\"This is an scheduled WhatsApp status update for tomorrow\",\"schedule\":{\"delayTo\":\"1h\"},\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}'\n\n\n# Publish a new WhatsApp status with a scheduled delivery\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{device.id}/status' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"message\":\"This is an scheduled WhatsApp status update using an ISO date\",\"schedule\":{\"date\":\"2026-11-07T09:42:46.664Z\"},\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}'\n\n\n# Publish a new WhatsApp status with a scheduled delivery in strict order\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{device.id}/status' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"message\":\"This is an scheduled WhatsApp status update using an ISO date\",\"order\":true,\"schedule\":{\"date\":\"2026-11-07T09:42:46.664Z\"},\"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}'"},{"lang":"ObjC","source":"// Publish a new WhatsApp status with a text message and background color\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"message\": @\"This is an automated WhatsApp status update: https://youtube.com\",\n                              @\"font\": @\"helvetica\",\n                              @\"color\": @\"olive_green\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{device.id}/status\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Publish a new WhatsApp status with an image and caption\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"message\": @\"This is an automated WhatsApp status with image\",\n                              @\"media\": @{ @\"url\": @\"https://picsum.photos/seed/picsum/600/400\" } };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{device.id}/status\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Publish a new WhatsApp status with an video and caption\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"message\": @\"This is an automated WhatsApp status with video\",\n                              @\"media\": @{ @\"url\": @\"https://download.samplelib.com/mp4/sample-5s.mp4\" } };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{device.id}/status\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Publish a new WhatsApp status with a scheduled delivery based on time unit\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"message\": @\"This is an scheduled WhatsApp status update for tomorrow\",\n                              @\"schedule\": @{ @\"delayTo\": @\"1h\" },\n                              @\"media\": @{ @\"url\": @\"https://picsum.photos/seed/picsum/600/400\" } };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{device.id}/status\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Publish a new WhatsApp status with a scheduled delivery\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"message\": @\"This is an scheduled WhatsApp status update using an ISO date\",\n                              @\"schedule\": @{ @\"date\": @\"2026-11-07T09:42:46.664Z\" },\n                              @\"media\": @{ @\"url\": @\"https://picsum.photos/seed/picsum/600/400\" } };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{device.id}/status\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Publish a new WhatsApp status with a scheduled delivery in strict order\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"message\": @\"This is an scheduled WhatsApp status update using an ISO date\",\n                              @\"order\": @YES,\n                              @\"schedule\": @{ @\"date\": @\"2026-11-07T09:42:46.664Z\" },\n                              @\"media\": @{ @\"url\": @\"https://picsum.photos/seed/picsum/600/400\" } };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{device.id}/status\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Publish a new WhatsApp status with a text message and background color\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"message\": \"This is an automated WhatsApp status update: https://youtube.com\",\n  \"font\": \"helvetica\",\n  \"color\": \"olive_green\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{device.id}/status\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Publish a new WhatsApp status with an image and caption\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"message\": \"This is an automated WhatsApp status with image\",\n  \"media\": [\"url\": \"https://picsum.photos/seed/picsum/600/400\"]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{device.id}/status\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Publish a new WhatsApp status with an video and caption\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"message\": \"This is an automated WhatsApp status with video\",\n  \"media\": [\"url\": \"https://download.samplelib.com/mp4/sample-5s.mp4\"]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{device.id}/status\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Publish a new WhatsApp status with a scheduled delivery based on time unit\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"message\": \"This is an scheduled WhatsApp status update for tomorrow\",\n  \"schedule\": [\"delayTo\": \"1h\"],\n  \"media\": [\"url\": \"https://picsum.photos/seed/picsum/600/400\"]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{device.id}/status\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Publish a new WhatsApp status with a scheduled delivery\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"message\": \"This is an scheduled WhatsApp status update using an ISO date\",\n  \"schedule\": [\"date\": \"2026-11-07T09:42:46.664Z\"],\n  \"media\": [\"url\": \"https://picsum.photos/seed/picsum/600/400\"]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{device.id}/status\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Publish a new WhatsApp status with a scheduled delivery in strict order\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"message\": \"This is an scheduled WhatsApp status update using an ISO date\",\n  \"order\": true,\n  \"schedule\": [\"date\": \"2026-11-07T09:42:46.664Z\"],\n  \"media\": [\"url\": \"https://picsum.photos/seed/picsum/600/400\"]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{device.id}/status\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Delete user status","description":"Delete user status story historical updates, optionally filtered by params. You can delete all user status updates published or specific messages by providing the `ids` or `wids` fields with an array of message IDs (24-length or 20-22-length hexadecimal values).\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7Bdevice.id%7D%2Fstatus&method=DELETE&body=%7B%0A%20%20%22all%22%3A%20true%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deleteUserStatus","security":[{"apiKey":[]}],"tags":["User Status"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"status","description":"Delete all or specific WhatsApp status updates","schema":{"type":"object","properties":{"all":{"type":"boolean","description":"Delete all published user status stories in your connected WhatsApp number. If `true`, the `wids` field will be ignored.","default":false},"scheduled":{"type":"array","items":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24},"maxItems":20,"description":"Delete scheduled user status stories by IDs (24 length alphanumeric value) in your connected WhatsApp number. If `all` is `true`, this field will be ignored."},"status":{"type":"array","items":{"type":"string","pattern":"^3[0-9a-fA-F]{19,31}$","minLength":18,"maxLength":32},"maxItems":20,"description":"List of specific WhatsApp IDs (WID) status story to delete in your WhatsApp number. If `all` is `true`, this field will be ignored. You can retrieve the specific WIDs using [this API endpoint](#operation/getUserStatus)."}},"additionalProperties":false}}],"responses":{"200":{"description":"Status deleted successfully","schema":{"type":"object","properties":{"message":{"type":"string"},"count":{"type":"number"},"status":{"type":"array","items":{"type":"string"}}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Delete number WhatsApp status\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/chat/{device.id}/status \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"all\":true}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Delete number WhatsApp status\necho '{\"all\":true}' |  \\\n  http DELETE https://api.wassenger.com/v1/chat/{device.id}/status \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Delete number WhatsApp status\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{device.id}/status';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"all\":true}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Delete number WhatsApp status\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/chat/{device.id}/status',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {all: true}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Delete number WhatsApp status\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/chat/{device.id}/status');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  all: true\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Delete number WhatsApp status\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/chat/{device.id}/status', [\n  'body' => '{\"all\":true}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Delete number WhatsApp status\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'all' => null\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{device.id}/status');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Delete number WhatsApp status\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{device.id}/status\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'all' => null\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Delete number WhatsApp status\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{device.id}/status\"\n\npayload = { \"all\": True }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete number WhatsApp status\nconst url = 'https://api.wassenger.com/v1/chat/{device.id}/status';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"all\":true}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete number WhatsApp status\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{device.id}/status',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"all\":true}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Delete number WhatsApp status\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{device.id}/status\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"all\\\":true}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Delete number WhatsApp status\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{device.id}/status\"\n\n\tpayload := strings.NewReader(\"{\\\"all\\\":true}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Delete number WhatsApp status\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{device.id}/status\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"all\\\":true}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Delete number WhatsApp status\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{device.id}/status\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"all\\\":true}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Delete number WhatsApp status\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/chat/{device.id}/status\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"all\\\":true}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Delete number WhatsApp status\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"all\\\":true}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{device.id}/status\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Delete number WhatsApp status\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{device.id}/status\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"all\\\":true}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Delete number WhatsApp status\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{device.id}/status' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"all\":true}'"},{"lang":"ObjC","source":"// Delete number WhatsApp status\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"all\": @YES };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{device.id}/status\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Delete number WhatsApp status\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"all\": true] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{device.id}/status\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/messages/{messageWid}/ackinfo":{"parameters":[],"get":{"summary":"Get message delivery info","operationId":"getMessageAckInfo","description":"Get outbound message delivery information for a given message ID for both user and group chats messages.\n\n\n\nThis endpoint will returns who received, read or played the specific outbound message.\n\n\n\n**Note:** only applies to outbound messages sent from your WhatsApp number no older than 30 days.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fmessages%2F%7BmessageWid%7D%2Fackinfo)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","security":[{"apiKey":[]}],"tags":["Chat Messages"],"produces":["application/json"],"parameters":[],"responses":{"200":{"description":"Message delivery information","schema":{"type":"object","properties":{"delivery":{"type":"array","description":"Message delivery status for each recipient","items":{"type":"object","properties":{"wid":{"type":"string","description":"WhatsApp contact ID"},"phone":{"type":"string","description":"WhatsApp number in E164 format. Not present when WhatsApp hides the number: `wid` is then a private LID"},"timestamp":{"type":"number","description":"Message delivery timestamp"},"date":{"type":"string","format":"date-time","description":"Message delivery date"}}}},"deliveryRemaining":{"type":"number","description":"Remaining user or participants that can receive the message"},"read":{"type":"array","description":"Message read status for each recipient","items":{"type":"object","properties":{"wid":{"type":"string","description":"WhatsApp contact ID"},"phone":{"type":"string","description":"WhatsApp number in E164 format. Not present when WhatsApp hides the number: `wid` is then a private LID"},"timestamp":{"type":"number","description":"Message read timestamp"},"date":{"type":"string","format":"date-time","description":"Message read date"}}}},"readRemaining":{"type":"number","description":"Remaining user or participants that can read the message"},"played":{"type":"array","description":"Message played status for each recipient: only applies to audio messages","items":{"type":"object","properties":{"wid":{"type":"string","description":"WhatsApp contact ID"},"phone":{"type":"string","description":"WhatsApp number in E164 format. Not present when WhatsApp hides the number: `wid` is then a private LID"},"timestamp":{"type":"number","description":"Message played timestamp"},"date":{"type":"string","format":"date-time","description":"Message played date"}}}},"playedRemaining":{"type":"number","description":"Remaining user or participants that can play the message: only applies to audio messages"}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get device message delivery information\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}/ackinfo \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get device message delivery information\nhttp GET https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}/ackinfo \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get device message delivery information\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}/ackinfo';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get device message delivery information\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}/ackinfo',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get device message delivery information\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}/ackinfo');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get device message delivery information\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}/ackinfo', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get device message delivery information\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}/ackinfo');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get device message delivery information\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}/ackinfo\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get device message delivery information\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}/ackinfo\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get device message delivery information\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}/ackinfo';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get device message delivery information\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}/ackinfo',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get device message delivery information\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}/ackinfo\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get device message delivery information\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}/ackinfo\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get device message delivery information\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}/ackinfo\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get device message delivery information\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}/ackinfo\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get device message delivery information\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}/ackinfo\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get device message delivery information\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}/ackinfo\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get device message delivery information\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}/ackinfo\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get device message delivery information\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}/ackinfo' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get device message delivery information\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}/ackinfo\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get device message delivery information\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}/ackinfo\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/messages/{messageWid}":{"parameters":[],"get":{"summary":"Get message details","description":"Get device message details by ID.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fmessages%2F%7BmessageWid%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getDeviceMessageDetails","security":[{"apiKey":[]}],"tags":["Chat Messages"],"parameters":[{"name":"download","in":"query","description":"Download message media content if available","required":false,"default":false,"type":"boolean"}],"produces":["application/json"],"responses":{"200":{"description":"Message details","schema":{"$ref":"#/definitions/ioMessage"}},"400":{"description":"Invalid request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Message not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get device message details\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get device message details\nhttp GET https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get device message details\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get device message details\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get device message details\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get device message details\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get device message details\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get device message details\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get device message details\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get device message details\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get device message details\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get device message details\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get device message details\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get device message details\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get device message details\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get device message details\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get device message details\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get device message details\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get device message details\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get device message details\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get device message details\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Edit message","description":"Edit an already sent message by ID (WhatsApp hexadecimal ID of 20-22 characters) in the WhatsApp linked number.\n\nOnly text, image and video messages can be edited.\n\n\n\n**Note**: you can only edit messages sent from the platform chat and API within 15 minutes after the message delivery. Messages sent from the mobile app or another linked device session cannot be edited at any time.\n\n\n\nIn case you cannot edit a message, you can alternatively delete it using the [Delete Message endpoint](#operation/deleteDeviceMessage).\n\n\n\nThis endpoint requires the WhatsApp number session to be online, otherwise it will return an error.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fmessages%2F%7BmessageWid%7D&method=PATCH&body=%7B%0A%20%20%22message%22%3A%20%22This%20is%20the%20new%20message%20body%20text%20content%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"editMessage","security":[{"apiKey":[]}],"tags":["Chat Messages"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"edit","description":"Edit message","schema":{"type":"object","properties":{"message":{"type":"string","minLength":1,"maxLength":6000}},"required":["message"],"additionalProperties":false}}],"responses":{"200":{"description":"Updated message","schema":{"$ref":"#/definitions/ioMessage"}},"400":{"description":"Invalid request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Message not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Message cannot be edited","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Number session is not online","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Edit message\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid} \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"message\":\"This is the new message body text content\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Edit message\necho '{\"message\":\"This is the new message body text content\"}' |  \\\n  http PATCH https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid} \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Edit message\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"message\":\"This is the new message body text content\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Edit message\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {message: 'This is the new message body text content'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Edit message\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  message: 'This is the new message body text content'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Edit message\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}', [\n  'body' => '{\"message\":\"This is the new message body text content\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Edit message\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'message' => 'This is the new message body text content'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Edit message\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'message' => 'This is the new message body text content'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Edit message\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\"\n\npayload = { \"message\": \"This is the new message body text content\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Edit message\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"message\":\"This is the new message body text content\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Edit message\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"message\":\"This is the new message body text content\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Edit message\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"message\\\":\\\"This is the new message body text content\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Edit message\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\"\n\n\tpayload := strings.NewReader(\"{\\\"message\\\":\\\"This is the new message body text content\\\"}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Edit message\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"message\\\":\\\"This is the new message body text content\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Edit message\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"message\\\":\\\"This is the new message body text content\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Edit message\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"message\\\":\\\"This is the new message body text content\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Edit message\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"message\\\":\\\"This is the new message body text content\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Edit message\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"message\\\":\\\"This is the new message body text content\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Edit message\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"message\":\"This is the new message body text content\"}'"},{"lang":"ObjC","source":"// Edit message\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"message\": @\"This is the new message body text content\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Edit message\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"message\": \"This is the new message body text content\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Delete message","description":"Delete a sent or received message by ID in the WhatsApp linked device session.\n\n\n\n\n\n**Note**: by default the message is only deleted locally in your WhatsApp number.\n\n\n\nIf you wish to revoke and delete the message in the receiver's WhatsApp number, you should specify `revoke=true` as URL query param.\n\n\n\nOnly outbound messages can be revoked within 1 week after being delivered.\n\n\n\n\n\nOtherwise, the revokation will fail, unless you specify `force=true` URL query param in order to delete the message only for you.\n\n\n\nAlthough, the message's receiver will still have access to it.\n\n\n\n\n\nThis endpoint requires the WhatsApp number session to be online, otherwise it will return an error.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fmessages%2F%7BmessageWid%7D&method=DELETE&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deleteDeviceMessage","security":[{"apiKey":[]}],"tags":["Chat Messages"],"produces":["application/json"],"parameters":[{"in":"query","name":"clean","type":"boolean","default":false,"description":"Delete the message deletion information box from the chat list. This only affects locally in the WhatsApp account of the sender, not the receiver."},{"in":"query","name":"force","type":"boolean","default":false,"description":"Force message deletion locally even if the message cannot be revoked on the receiver side. A message can be deleted on the receiver side within 1 hour after it was delivered."},{"in":"query","name":"revoke","type":"boolean","default":false,"description":"Revoke and delete message to everyone else who received it. Note that a message can only be revoked during the first 60 minutes after its creation. Otherwise, the message will only deleted locally in your WhatsApp number, but not on the receiver side."}],"responses":{"200":{"description":"Deleted message","schema":{"$ref":"#/definitions/ioMessage"}},"400":{"description":"Invalid request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Message not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Already deleted or cannot revoke message","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Number session is not online","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Delete device message\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Delete device message\nhttp DELETE https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Delete device message\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Delete device message\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Delete device message\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Delete device message\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Delete device message\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}');\n$request->setRequestMethod('DELETE');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Delete device message\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Delete device message\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.delete(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete device message\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete device message\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}',\n  method: 'DELETE',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Delete device message\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Delete device message\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Delete device message\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Delete device message\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Delete device message\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Delete device message\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\")\n  .delete(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Delete device message\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Delete device message\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}' -Method DELETE -Headers $headers"},{"lang":"ObjC","source":"// Delete device message\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Delete device message\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/messages/{messageWid}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/messages":{"parameters":[],"get":{"summary":"Search messages","description":"Retrieve chat messages across chats or within a specific chat, optionally filtered by search params (see accepted parameters below)\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fmessages&params=%5B%7B%22key%22%3A%22size%22%2C%22value%22%3A20%7D%2C%7B%22key%22%3A%22page%22%2C%22value%22%3A0%7D%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getChatMessages","security":[{"apiKey":[]}],"tags":["Chat Messages"],"produces":["application/json"],"parameters":[{"in":"query","name":"flow","type":"string","enum":["in","out"],"description":"Filter by inbound or outbound messages"},{"in":"query","name":"ack","type":"array","collectionFormat":"csv","description":"Filter messages by delivery ACK status","maximum":8,"items":{"type":"string","enum":["failed","sent","read","readed","played","error","pending","delivered"]}},{"in":"query","name":"wid","type":"array","collectionFormat":"csv","description":"Filter messages by WID (WhatsApp ID). Multiple values allowed separated by commas.","minimum":1,"maximum":50,"items":{"type":"string","minLength":18,"maxLength":40}},{"in":"query","name":"search","type":"string","description":"Search messages by partial text content, contact name or media filename","maxLength":100},{"in":"query","name":"chat","type":"array","collectionFormat":"csv","description":"Filter messages by chat WhatsApp ID. This filter works for user chats, groups and channels. E.g: `1234567890@c.us`, `123456789000000000@g.us`, `123000098765421000@newsletter`","maxItems":25,"items":{"type":"string","minLength":9,"maxLength":50}},{"name":"from","description":"Return messages sent from a given phone number or WhatsApp WID","in":"query","type":"string","minLength":9,"maxLength":32},{"name":"to","description":"Return messages received to the given phone number or WhatsApp WID","in":"query","type":"string","minLength":9,"maxLength":32},{"in":"query","name":"type","type":"array","collectionFormat":"csv","description":"Filter messages by message type. Accepts the same `type` values that messages are returned with. To only retrieve messages from a group or a channel, use the `chat` filter with the target chat WhatsApp ID instead","items":{"type":"string","enum":["template","text","notification","notification_template","group_notification","gp2","broadcast_notification","e2e_notification","call_log","protocol","chat","location","payment","vcard","ciphertext","multi_vcard","revoked","oversized","groups_v4_invite","hsm","template_button_reply","image","video","audio","ptt","sticker","document","product","order","list","button","buttons_response","list_response","reaction","interactive","flow","reaction_enc","poll","poll_creation","poll_update","request_phone_number","biz-cover-photo","keep_in_chat","native_flow","event","event_creation","event_update","unknown","unsupported","ad","contacts"]}},{"name":"reference","description":"Filter messages by reference field exact match","in":"query","type":"string","maxLength":150,"minLength":1},{"in":"query","name":"kind","type":"array","collectionFormat":"csv","description":"Filter message by entry kind","default":"message,note","items":{"type":"string","enum":["note","event","status","message"],"maxItems":5}},{"name":"sync","description":"If no available messages yet, sync messages from the WhatsApp session. The session must be online in order to sync messages, otherwise the API will return a `503` service not available error","in":"query","type":"boolean","default":false},{"name":"begin","description":"Return newest messages starting from the given message ID and excluding it in the results. Note that by default messages are sorted in descending order by creation date, unless you explicitly pass the `sort=date:asc` query param.","in":"query","type":"string","maxLength":50,"minLength":18},{"name":"end","description":"Return oldest messages starting from the given message ID and excluding it in the results.","in":"query","type":"string","maxLength":50,"minLength":18},{"name":"after","description":"Messages created after the given date","in":"query","type":"string","format":"date-time"},{"name":"before","description":"Messages created before the given date","in":"query","type":"string","format":"date-time"},{"in":"query","name":"include","type":"array","collectionFormat":"csv","description":"Include nested related documents per message","items":{"type":"string","default":"chat","enum":["chat","chat.participants","quoted.message","webhook.events"]}},{"in":"query","name":"sort","type":"array","collectionFormat":"csv","description":"Messages sorting: recent first or oldest first","items":{"type":"string","default":"date:desc","enum":["date:asc","date:desc"]}},{"in":"query","name":"page","description":"Results page number (starting from 0)","type":"number","format":"integer","default":0,"minimum":0,"maximum":500},{"in":"query","name":"size","description":"Results page size","type":"number","format":"integer","default":20,"minimum":1,"maximum":50},{"in":"query","name":"skip","description":"Only applicable if `sync=true`. Skip previous messages. For results pagination use `page` param.","type":"number","format":"integer","default":0,"minimum":0,"maximum":2000}],"responses":{"200":{"description":"Messages","schema":{"type":"array","items":{"$ref":"#/definitions/ioMessage"}},"headers":{"Chat-Sync-Status":{"type":"string","description":"If `sync` param is `true`, provides the WhatsApp messages syncing status for a specific chat. Requires `chat` filter param to be present.","enum":["failed","synced","unavailable"]}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get most recent messages\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/messages?size=20&page=0' \\\n  --header 'Token: <api token goes here>'\n\n\n// Get image and video messages only\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/messages?type=image%2Cvideo' \\\n  --header 'Token: <api token goes here>'\n\n\n// Get messages for a specific channel\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123000098765421000%40newsletter&size=50' \\\n  --header 'Token: <api token goes here>'\n\n\n// Get messages send from a phone number \ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/messages?from=1234567890' \\\n  --header 'Token: <api token goes here>'\n\n\n// Get messages for a specific user chat\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50' \\\n  --header 'Token: <api token goes here>'\n\n\n// Get messages for a specific group\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123456789000000000%40g.us&size=50' \\\n  --header 'Token: <api token goes here>'\n\n\n// Get new messages after the given message ID\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/messages?begin=3EB0F404610000EAE10E&chat=1234567890&size=50' \\\n  --header 'Token: <api token goes here>'\n\n\n// Sync old messages, if required, from WhatsApp live session (requires chat param to be present)\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50&sync=true' \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get most recent messages\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/messages?size=20&page=0' \\\n  Token:'<api token goes here>'\n\n\n// Get image and video messages only\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/messages?type=image%2Cvideo' \\\n  Token:'<api token goes here>'\n\n\n// Get messages for a specific channel\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123000098765421000%40newsletter&size=50' \\\n  Token:'<api token goes here>'\n\n\n// Get messages send from a phone number \nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/messages?from=1234567890' \\\n  Token:'<api token goes here>'\n\n\n// Get messages for a specific user chat\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50' \\\n  Token:'<api token goes here>'\n\n\n// Get messages for a specific group\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123456789000000000%40g.us&size=50' \\\n  Token:'<api token goes here>'\n\n\n// Get new messages after the given message ID\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/messages?begin=3EB0F404610000EAE10E&chat=1234567890&size=50' \\\n  Token:'<api token goes here>'\n\n\n// Sync old messages, if required, from WhatsApp live session (requires chat param to be present)\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50&sync=true' \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get most recent messages\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages?size=20&page=0';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get image and video messages only\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages?type=image%2Cvideo';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get messages for a specific channel\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123000098765421000%40newsletter&size=50';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get messages send from a phone number \nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages?from=1234567890';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get messages for a specific user chat\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get messages for a specific group\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123456789000000000%40g.us&size=50';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get new messages after the given message ID\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages?begin=3EB0F404610000EAE10E&chat=1234567890&size=50';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Sync old messages, if required, from WhatsApp live session (requires chat param to be present)\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50&sync=true';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get most recent messages\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages',\n  params: {size: '20', page: '0'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get image and video messages only\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages',\n  params: {type: 'image,video'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get messages for a specific channel\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages',\n  params: {chat: '123000098765421000@newsletter', size: '50'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get messages send from a phone number \nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages',\n  params: {from: '1234567890'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get messages for a specific user chat\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages',\n  params: {chat: '1234567890', size: '50'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get messages for a specific group\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages',\n  params: {chat: '123456789000000000@g.us', size: '50'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get new messages after the given message ID\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages',\n  params: {begin: '3EB0F404610000EAE10E', chat: '1234567890', size: '50'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Sync old messages, if required, from WhatsApp live session (requires chat param to be present)\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages',\n  params: {chat: '1234567890', size: '50', sync: 'true'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get most recent messages\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/messages');\n\nreq.query({\n  size: '20',\n  page: '0'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get image and video messages only\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/messages');\n\nreq.query({\n  type: 'image,video'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get messages for a specific channel\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/messages');\n\nreq.query({\n  chat: '123000098765421000@newsletter',\n  size: '50'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get messages send from a phone number \nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/messages');\n\nreq.query({\n  from: '1234567890'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get messages for a specific user chat\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/messages');\n\nreq.query({\n  chat: '1234567890',\n  size: '50'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get messages for a specific group\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/messages');\n\nreq.query({\n  chat: '123456789000000000@g.us',\n  size: '50'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get new messages after the given message ID\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/messages');\n\nreq.query({\n  begin: '3EB0F404610000EAE10E',\n  chat: '1234567890',\n  size: '50'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Sync old messages, if required, from WhatsApp live session (requires chat param to be present)\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/messages');\n\nreq.query({\n  chat: '1234567890',\n  size: '50',\n  sync: 'true'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get most recent messages\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/messages?size=20&page=0', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get image and video messages only\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/messages?type=image%2Cvideo', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get messages for a specific channel\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123000098765421000%40newsletter&size=50', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get messages send from a phone number \n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/messages?from=1234567890', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get messages for a specific user chat\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get messages for a specific group\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123456789000000000%40g.us&size=50', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get new messages after the given message ID\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/messages?begin=3EB0F404610000EAE10E&chat=1234567890&size=50', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Sync old messages, if required, from WhatsApp live session (requires chat param to be present)\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50&sync=true', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get most recent messages\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/messages');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'size' => '20',\n  'page' => '0'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get image and video messages only\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/messages');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'type' => 'image,video'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get messages for a specific channel\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/messages');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'chat' => '123000098765421000@newsletter',\n  'size' => '50'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get messages send from a phone number \n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/messages');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'from' => '1234567890'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get messages for a specific user chat\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/messages');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'chat' => '1234567890',\n  'size' => '50'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get messages for a specific group\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/messages');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'chat' => '123456789000000000@g.us',\n  'size' => '50'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get new messages after the given message ID\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/messages');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'begin' => '3EB0F404610000EAE10E',\n  'chat' => '1234567890',\n  'size' => '50'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Sync old messages, if required, from WhatsApp live session (requires chat param to be present)\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/messages');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'chat' => '1234567890',\n  'size' => '50',\n  'sync' => 'true'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get most recent messages\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/messages?size=20&page=0\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get image and video messages only\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/messages?type=image%2Cvideo\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get messages for a specific channel\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123000098765421000%40newsletter&size=50\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get messages send from a phone number \n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/messages?from=1234567890\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get messages for a specific user chat\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get messages for a specific group\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123456789000000000%40g.us&size=50\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get new messages after the given message ID\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/messages?begin=3EB0F404610000EAE10E&chat=1234567890&size=50\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Sync old messages, if required, from WhatsApp live session (requires chat param to be present)\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50&sync=true\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get most recent messages\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/messages\"\n\nquerystring = {\"size\":\"20\",\"page\":\"0\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Get image and video messages only\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/messages\"\n\nquerystring = {\"type\":\"image,video\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Get messages for a specific channel\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/messages\"\n\nquerystring = {\"chat\":\"123000098765421000@newsletter\",\"size\":\"50\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Get messages send from a phone number \nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/messages\"\n\nquerystring = {\"from\":\"1234567890\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Get messages for a specific user chat\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/messages\"\n\nquerystring = {\"chat\":\"1234567890\",\"size\":\"50\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Get messages for a specific group\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/messages\"\n\nquerystring = {\"chat\":\"123456789000000000@g.us\",\"size\":\"50\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Get new messages after the given message ID\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/messages\"\n\nquerystring = {\"begin\":\"3EB0F404610000EAE10E\",\"chat\":\"1234567890\",\"size\":\"50\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Sync old messages, if required, from WhatsApp live session (requires chat param to be present)\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/messages\"\n\nquerystring = {\"chat\":\"1234567890\",\"size\":\"50\",\"sync\":\"true\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get most recent messages\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages?size=20&page=0';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get image and video messages only\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages?type=image%2Cvideo';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get messages for a specific channel\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123000098765421000%40newsletter&size=50';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get messages send from a phone number \nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages?from=1234567890';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get messages for a specific user chat\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get messages for a specific group\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123456789000000000%40g.us&size=50';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get new messages after the given message ID\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages?begin=3EB0F404610000EAE10E&chat=1234567890&size=50';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Sync old messages, if required, from WhatsApp live session (requires chat param to be present)\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50&sync=true';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get most recent messages\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages?size=20&page=0',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get image and video messages only\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages?type=image%2Cvideo',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get messages for a specific channel\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123000098765421000%40newsletter&size=50',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get messages send from a phone number \nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages?from=1234567890',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get messages for a specific user chat\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get messages for a specific group\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123456789000000000%40g.us&size=50',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get new messages after the given message ID\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages?begin=3EB0F404610000EAE10E&chat=1234567890&size=50',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Sync old messages, if required, from WhatsApp live session (requires chat param to be present)\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50&sync=true',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get most recent messages\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?size=20&page=0\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get image and video messages only\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?type=image%2Cvideo\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get messages for a specific channel\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123000098765421000%40newsletter&size=50\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get messages send from a phone number \nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?from=1234567890\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get messages for a specific user chat\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get messages for a specific group\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123456789000000000%40g.us&size=50\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get new messages after the given message ID\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?begin=3EB0F404610000EAE10E&chat=1234567890&size=50\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Sync old messages, if required, from WhatsApp live session (requires chat param to be present)\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50&sync=true\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get most recent messages\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/messages?size=20&page=0\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get image and video messages only\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/messages?type=image%2Cvideo\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get messages for a specific channel\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123000098765421000%40newsletter&size=50\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get messages send from a phone number \npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/messages?from=1234567890\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get messages for a specific user chat\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get messages for a specific group\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123456789000000000%40g.us&size=50\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get new messages after the given message ID\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/messages?begin=3EB0F404610000EAE10E&chat=1234567890&size=50\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Sync old messages, if required, from WhatsApp live session (requires chat param to be present)\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50&sync=true\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get most recent messages\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?size=20&page=0\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Get image and video messages only\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?type=image%2Cvideo\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Get messages for a specific channel\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123000098765421000%40newsletter&size=50\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Get messages send from a phone number \nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?from=1234567890\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Get messages for a specific user chat\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Get messages for a specific group\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123456789000000000%40g.us&size=50\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Get new messages after the given message ID\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?begin=3EB0F404610000EAE10E&chat=1234567890&size=50\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Sync old messages, if required, from WhatsApp live session (requires chat param to be present)\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50&sync=true\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get most recent messages\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?size=20&page=0\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get image and video messages only\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?type=image%2Cvideo\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get messages for a specific channel\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123000098765421000%40newsletter&size=50\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get messages send from a phone number \nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?from=1234567890\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get messages for a specific user chat\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get messages for a specific group\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123456789000000000%40g.us&size=50\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get new messages after the given message ID\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?begin=3EB0F404610000EAE10E&chat=1234567890&size=50\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Sync old messages, if required, from WhatsApp live session (requires chat param to be present)\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50&sync=true\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get most recent messages\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?size=20&page=0\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Get image and video messages only\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?type=image%2Cvideo\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Get messages for a specific channel\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123000098765421000%40newsletter&size=50\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Get messages send from a phone number \nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?from=1234567890\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Get messages for a specific user chat\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Get messages for a specific group\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123456789000000000%40g.us&size=50\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Get new messages after the given message ID\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?begin=3EB0F404610000EAE10E&chat=1234567890&size=50\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Sync old messages, if required, from WhatsApp live session (requires chat param to be present)\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50&sync=true\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get most recent messages\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?size=20&page=0\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get image and video messages only\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?type=image%2Cvideo\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get messages for a specific channel\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123000098765421000%40newsletter&size=50\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get messages send from a phone number \nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?from=1234567890\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get messages for a specific user chat\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get messages for a specific group\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123456789000000000%40g.us&size=50\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get new messages after the given message ID\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?begin=3EB0F404610000EAE10E&chat=1234567890&size=50\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Sync old messages, if required, from WhatsApp live session (requires chat param to be present)\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50&sync=true\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get most recent messages\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/messages?size=20&page=0\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get image and video messages only\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/messages?type=image%2Cvideo\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get messages for a specific channel\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123000098765421000%40newsletter&size=50\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get messages send from a phone number \nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/messages?from=1234567890\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get messages for a specific user chat\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get messages for a specific group\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123456789000000000%40g.us&size=50\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get new messages after the given message ID\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/messages?begin=3EB0F404610000EAE10E&chat=1234567890&size=50\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Sync old messages, if required, from WhatsApp live session (requires chat param to be present)\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50&sync=true\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get most recent messages\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/messages?size=20&page=0' -Method GET -Headers $headers\n\n\n# Get image and video messages only\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/messages?type=image%2Cvideo' -Method GET -Headers $headers\n\n\n# Get messages for a specific channel\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123000098765421000%40newsletter&size=50' -Method GET -Headers $headers\n\n\n# Get messages send from a phone number \n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/messages?from=1234567890' -Method GET -Headers $headers\n\n\n# Get messages for a specific user chat\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50' -Method GET -Headers $headers\n\n\n# Get messages for a specific group\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123456789000000000%40g.us&size=50' -Method GET -Headers $headers\n\n\n# Get new messages after the given message ID\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/messages?begin=3EB0F404610000EAE10E&chat=1234567890&size=50' -Method GET -Headers $headers\n\n\n# Sync old messages, if required, from WhatsApp live session (requires chat param to be present)\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50&sync=true' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get most recent messages\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/messages?size=20&page=0\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get image and video messages only\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/messages?type=image%2Cvideo\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get messages for a specific channel\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123000098765421000%40newsletter&size=50\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get messages send from a phone number \n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/messages?from=1234567890\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get messages for a specific user chat\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get messages for a specific group\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123456789000000000%40g.us&size=50\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get new messages after the given message ID\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/messages?begin=3EB0F404610000EAE10E&chat=1234567890&size=50\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Sync old messages, if required, from WhatsApp live session (requires chat param to be present)\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50&sync=true\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get most recent messages\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/messages?size=20&page=0\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get image and video messages only\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/messages?type=image%2Cvideo\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get messages for a specific channel\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123000098765421000%40newsletter&size=50\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get messages send from a phone number \nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/messages?from=1234567890\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get messages for a specific user chat\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get messages for a specific group\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=123456789000000000%40g.us&size=50\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get new messages after the given message ID\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/messages?begin=3EB0F404610000EAE10E&chat=1234567890&size=50\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Sync old messages, if required, from WhatsApp live session (requires chat param to be present)\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/messages?chat=1234567890&size=50&sync=true\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/files/{fileId}/download":{"parameters":[],"get":{"summary":"Download file","description":"Download device file contents by ID.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Ffiles%2F%7BfileId%7D%2Fdownload)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"downloadDeviceFileDetails","security":[{"apiKey":[]}],"tags":["Chat Files"],"produces":["application/octec-stream","image/jpeg","image/webp","image/png","audio/ogg","video/mp4","application/pdf"],"responses":{"200":{"description":"File contents","schema":{"$ref":"#/definitions/ioFile"}},"400":{"description":"Invalid request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"File not found or expired","schema":{"$ref":"#/definitions/error"}},"409":{"description":"File is not available yet","schema":{"$ref":"#/definitions/error"}},"410":{"description":"File content is no longer available","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"File is not available due to invalid or unsupported type","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Download device file details\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}/download \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Download device file details\nhttp GET https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}/download \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Download device file details\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}/download';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Download device file details\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}/download',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Download device file details\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}/download');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Download device file details\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}/download', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Download device file details\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}/download');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Download device file details\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}/download\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Download device file details\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}/download\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Download device file details\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}/download';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Download device file details\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}/download',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Download device file details\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}/download\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Download device file details\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}/download\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Download device file details\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}/download\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Download device file details\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}/download\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Download device file details\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}/download\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Download device file details\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}/download\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Download device file details\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}/download\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Download device file details\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}/download' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Download device file details\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}/download\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Download device file details\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}/download\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/files/{fileId}":{"parameters":[],"get":{"summary":"Get file details","description":"Get device file details by ID.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Ffiles%2F%7BfileId%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getDeviceFileDetails","security":[{"apiKey":[]}],"tags":["Chat Files"],"produces":["application/json"],"responses":{"200":{"description":"File details","schema":{"$ref":"#/definitions/ioFile"}},"400":{"description":"Invalid request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"File not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get device file details\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get device file details\nhttp GET https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get device file details\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get device file details\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get device file details\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get device file details\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get device file details\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get device file details\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get device file details\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get device file details\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get device file details\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get device file details\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get device file details\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get device file details\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get device file details\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get device file details\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get device file details\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get device file details\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get device file details\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get device file details\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get device file details\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/files/{fileId}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/files":{"parameters":[],"get":{"summary":"Files","description":"Search inbound files in current device\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Ffiles&params=%5B%7B%22key%22%3A%22size%22%2C%22value%22%3A20%7D%2C%7B%22key%22%3A%22page%22%2C%22value%22%3A0%7D%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getDeviceFiles","security":[{"apiKey":[]}],"tags":["Chat Files"],"produces":["application/json"],"parameters":[{"in":"query","name":"type","type":"array","collectionFormat":"csv","description":"Filter files by media type","items":{"type":"string","enum":["image","video","audio","document"]},"maxItems":5},{"in":"query","name":"search","type":"string","maxLength":100,"description":"Search files by filename, caption, message ID or chat ID"},{"in":"query","name":"chat","type":"array","collectionFormat":"csv","description":"Filter files by chat(s) WhatsApp IDs. Multiple chats IDs allowed comma-separated. Example WhatsApp ID: `1234567890@c.us`","maxItems":20,"items":{"type":"string","minLength":8,"maxLength":32}},{"in":"query","name":"ids","type":"array","collectionFormat":"csv","description":"Filter files by IDs","maxItems":20,"items":{"type":"string","minLength":24,"maxLength":24,"pattern":"^[a-f0-9]{24}"}},{"in":"query","name":"message","type":"array","collectionFormat":"csv","description":"Filter files by origin message WhatsApp IDs. Multiple IDs can be defined comma-separated. Example WhatsApp ID: `3EB02B134C4F0CA8D148`","maxItems":30,"items":{"type":"string","minLength":20,"maxLength":32,"pattern":"^[a-fA-F0-9]{20,32}"}},{"in":"query","name":"flow","type":"string","enum":["in","out"],"description":"Filter media message flow that contains the file: use `in` for inbound and `out` for outbound messages"},{"name":"after","description":"Files created after the given date in ISO 8601 format: `2023-10-01T00:00:00.000Z`","in":"query","type":"string","format":"date-time"},{"name":"before","description":"Files created before the given date in ISO 8601 format: `2023-10-15T12:00:00.000Z`","in":"query","type":"string","format":"date-time"},{"in":"query","name":"page","description":"Results page number (starting from 0)","type":"number","format":"integer","default":0,"minimum":0,"maximum":300},{"in":"query","name":"size","description":"Results page size","type":"number","format":"integer","default":20,"minimum":1,"maximum":50},{"in":"query","name":"sort","description":"Files sorting criteria","type":"string","enum":["date:asc","date:desc"],"default":"date:desc"}],"responses":{"200":{"description":"File","schema":{"type":"array","items":{"$ref":"#/definitions/ioFile"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Search most recent files\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/files?size=20&page=0' \\\n  --header 'Token: <api token goes here>'\n\n\n// Search group only files\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/files?type=group' \\\n  --header 'Token: <api token goes here>'\n\n\n// Get files by chat WID\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/files?chat=1234567890%40c.us' \\\n  --header 'Token: <api token goes here>'\n\n\n// Get inbound files only\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/files?flow=in&size=20' \\\n  --header 'Token: <api token goes here>'\n\n\n// Get files by specific type\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/files?type=image%2Cvideo%2Cdocument&size=20' \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Search most recent files\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/files?size=20&page=0' \\\n  Token:'<api token goes here>'\n\n\n// Search group only files\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/files?type=group' \\\n  Token:'<api token goes here>'\n\n\n// Get files by chat WID\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/files?chat=1234567890%40c.us' \\\n  Token:'<api token goes here>'\n\n\n// Get inbound files only\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/files?flow=in&size=20' \\\n  Token:'<api token goes here>'\n\n\n// Get files by specific type\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/files?type=image%2Cvideo%2Cdocument&size=20' \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Search most recent files\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/files?size=20&page=0';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Search group only files\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/files?type=group';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get files by chat WID\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/files?chat=1234567890%40c.us';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get inbound files only\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/files?flow=in&size=20';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get files by specific type\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/files?type=image%2Cvideo%2Cdocument&size=20';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Search most recent files\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/files',\n  params: {size: '20', page: '0'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Search group only files\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/files',\n  params: {type: 'group'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get files by chat WID\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/files',\n  params: {chat: '1234567890@c.us'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get inbound files only\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/files',\n  params: {flow: 'in', size: '20'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get files by specific type\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/files',\n  params: {type: 'image,video,document', size: '20'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Search most recent files\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/files');\n\nreq.query({\n  size: '20',\n  page: '0'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Search group only files\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/files');\n\nreq.query({\n  type: 'group'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get files by chat WID\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/files');\n\nreq.query({\n  chat: '1234567890@c.us'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get inbound files only\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/files');\n\nreq.query({\n  flow: 'in',\n  size: '20'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get files by specific type\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/files');\n\nreq.query({\n  type: 'image,video,document',\n  size: '20'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Search most recent files\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/files?size=20&page=0', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Search group only files\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/files?type=group', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get files by chat WID\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/files?chat=1234567890%40c.us', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get inbound files only\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/files?flow=in&size=20', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get files by specific type\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/files?type=image%2Cvideo%2Cdocument&size=20', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Search most recent files\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/files');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'size' => '20',\n  'page' => '0'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Search group only files\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/files');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'type' => 'group'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get files by chat WID\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/files');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'chat' => '1234567890@c.us'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get inbound files only\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/files');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'flow' => 'in',\n  'size' => '20'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get files by specific type\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/files');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'type' => 'image,video,document',\n  'size' => '20'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Search most recent files\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/files?size=20&page=0\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Search group only files\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/files?type=group\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get files by chat WID\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/files?chat=1234567890%40c.us\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get inbound files only\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/files?flow=in&size=20\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get files by specific type\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/files?type=image%2Cvideo%2Cdocument&size=20\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Search most recent files\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/files\"\n\nquerystring = {\"size\":\"20\",\"page\":\"0\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Search group only files\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/files\"\n\nquerystring = {\"type\":\"group\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Get files by chat WID\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/files\"\n\nquerystring = {\"chat\":\"1234567890@c.us\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Get inbound files only\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/files\"\n\nquerystring = {\"flow\":\"in\",\"size\":\"20\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Get files by specific type\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/files\"\n\nquerystring = {\"type\":\"image,video,document\",\"size\":\"20\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Search most recent files\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/files?size=20&page=0';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Search group only files\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/files?type=group';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get files by chat WID\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/files?chat=1234567890%40c.us';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get inbound files only\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/files?flow=in&size=20';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get files by specific type\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/files?type=image%2Cvideo%2Cdocument&size=20';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Search most recent files\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/files?size=20&page=0',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Search group only files\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/files?type=group',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get files by chat WID\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/files?chat=1234567890%40c.us',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get inbound files only\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/files?flow=in&size=20',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get files by specific type\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/files?type=image%2Cvideo%2Cdocument&size=20',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Search most recent files\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/files?size=20&page=0\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Search group only files\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/files?type=group\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get files by chat WID\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/files?chat=1234567890%40c.us\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get inbound files only\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/files?flow=in&size=20\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get files by specific type\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/files?type=image%2Cvideo%2Cdocument&size=20\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Search most recent files\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/files?size=20&page=0\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Search group only files\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/files?type=group\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get files by chat WID\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/files?chat=1234567890%40c.us\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get inbound files only\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/files?flow=in&size=20\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get files by specific type\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/files?type=image%2Cvideo%2Cdocument&size=20\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Search most recent files\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/files?size=20&page=0\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Search group only files\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/files?type=group\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Get files by chat WID\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/files?chat=1234567890%40c.us\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Get inbound files only\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/files?flow=in&size=20\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Get files by specific type\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/files?type=image%2Cvideo%2Cdocument&size=20\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Search most recent files\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/files?size=20&page=0\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Search group only files\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/files?type=group\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get files by chat WID\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/files?chat=1234567890%40c.us\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get inbound files only\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/files?flow=in&size=20\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get files by specific type\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/files?type=image%2Cvideo%2Cdocument&size=20\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Search most recent files\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/files?size=20&page=0\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Search group only files\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/files?type=group\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Get files by chat WID\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/files?chat=1234567890%40c.us\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Get inbound files only\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/files?flow=in&size=20\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Get files by specific type\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/files?type=image%2Cvideo%2Cdocument&size=20\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Search most recent files\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/files?size=20&page=0\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Search group only files\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/files?type=group\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get files by chat WID\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/files?chat=1234567890%40c.us\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get inbound files only\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/files?flow=in&size=20\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get files by specific type\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/files?type=image%2Cvideo%2Cdocument&size=20\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Search most recent files\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/files?size=20&page=0\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Search group only files\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/files?type=group\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get files by chat WID\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/files?chat=1234567890%40c.us\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get inbound files only\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/files?flow=in&size=20\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get files by specific type\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/files?type=image%2Cvideo%2Cdocument&size=20\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Search most recent files\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/files?size=20&page=0' -Method GET -Headers $headers\n\n\n# Search group only files\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/files?type=group' -Method GET -Headers $headers\n\n\n# Get files by chat WID\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/files?chat=1234567890%40c.us' -Method GET -Headers $headers\n\n\n# Get inbound files only\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/files?flow=in&size=20' -Method GET -Headers $headers\n\n\n# Get files by specific type\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/files?type=image%2Cvideo%2Cdocument&size=20' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Search most recent files\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/files?size=20&page=0\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Search group only files\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/files?type=group\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get files by chat WID\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/files?chat=1234567890%40c.us\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get inbound files only\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/files?flow=in&size=20\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get files by specific type\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/files?type=image%2Cvideo%2Cdocument&size=20\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Search most recent files\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/files?size=20&page=0\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Search group only files\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/files?type=group\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get files by chat WID\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/files?chat=1234567890%40c.us\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get inbound files only\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/files?flow=in&size=20\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get files by specific type\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/files?type=image%2Cvideo%2Cdocument&size=20\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/contacts/{contactWid}/metadata":{"parameters":[],"put":{"summary":"Set metadata","description":"Update and override all contact metadata entries with key-value pairs given the WhatsApp contact ID or phone number. Only metadata information of a user contact can be updated.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fcontacts%2F%7BcontactWid%7D&method=PATCH&body=%5B%0A%20%20%7B%0A%20%20%20%20%22key%22%3A%20%22foo%22%2C%0A%20%20%20%20%22value%22%3A%20%22bar%22%0A%20%20%7D%2C%0A%20%20%7B%0A%20%20%20%20%22key%22%3A%20%22CRM_ID%22%2C%0A%20%20%20%20%22value%22%3A%20%22123456%22%0A%20%20%7D%0A%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateContactMetadata","security":[{"apiKey":[]}],"parameters":[{"in":"body","name":"metadata","schema":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-zA-Z0-9_]*$","minLength":1,"maxLength":30,"description":"Metadata entry key that can only contain alphanumeric (`a-z`, `A-Z`, `0-9`), or underscore (`_`) characters."},"value":{"type":"string","minLength":0,"maxLength":300,"description":"Metadata entry value can contain any text up to 300 characters."}},"additionalProperties":false},"maxItems":30}}],"tags":["Chat Contacts"],"consumes":["application/json"],"produces":["application/json"],"responses":{"200":{"description":"Updated contact metadata","schema":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Metadata entry key"},"value":{"type":"string","description":"Metadata entry value"}}}}},"400":{"description":"Invalid request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Contact not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Update contact metadata\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid} \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '[{\"key\":\"foo\",\"value\":\"bar\"},{\"key\":\"CRM_ID\",\"value\":\"123456\"}]'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Update contact metadata\necho '[{\"key\":\"foo\",\"value\":\"bar\"},{\"key\":\"CRM_ID\",\"value\":\"123456\"}]' |  \\\n  http PATCH https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid} \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Update contact metadata\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"key\":\"foo\",\"value\":\"bar\"},{\"key\":\"CRM_ID\",\"value\":\"123456\"}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Update contact metadata\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: [{key: 'foo', value: 'bar'}, {key: 'CRM_ID', value: '123456'}]\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Update contact metadata\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send([\n  {\n    key: 'foo',\n    value: 'bar'\n  },\n  {\n    key: 'CRM_ID',\n    value: '123456'\n  }\n]);\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Update contact metadata\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}', [\n  'body' => '[{\"key\":\"foo\",\"value\":\"bar\"},{\"key\":\"CRM_ID\",\"value\":\"123456\"}]',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Update contact metadata\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  [\n    'key' => 'foo',\n    'value' => 'bar'\n  ],\n  [\n    'key' => 'CRM_ID',\n    'value' => '123456'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Update contact metadata\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    [\n        'key' => 'foo',\n        'value' => 'bar'\n    ],\n    [\n        'key' => 'CRM_ID',\n        'value' => '123456'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Update contact metadata\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"\n\npayload = [\n    {\n        \"key\": \"foo\",\n        \"value\": \"bar\"\n    },\n    {\n        \"key\": \"CRM_ID\",\n        \"value\": \"123456\"\n    }\n]\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update contact metadata\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"key\":\"foo\",\"value\":\"bar\"},{\"key\":\"CRM_ID\",\"value\":\"123456\"}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update contact metadata\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '[{\"key\":\"foo\",\"value\":\"bar\"},{\"key\":\"CRM_ID\",\"value\":\"123456\"}]'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Update contact metadata\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"[{\\\"key\\\":\\\"foo\\\",\\\"value\\\":\\\"bar\\\"},{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"123456\\\"}]\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Update contact metadata\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"\n\n\tpayload := strings.NewReader(\"[{\\\"key\\\":\\\"foo\\\",\\\"value\\\":\\\"bar\\\"},{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"123456\\\"}]\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Update contact metadata\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"[{\\\"key\\\":\\\"foo\\\",\\\"value\\\":\\\"bar\\\"},{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"123456\\\"}]\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Update contact metadata\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"[{\\\"key\\\":\\\"foo\\\",\\\"value\\\":\\\"bar\\\"},{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"123456\\\"}]\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Update contact metadata\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"[{\\\"key\\\":\\\"foo\\\",\\\"value\\\":\\\"bar\\\"},{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"123456\\\"}]\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Update contact metadata\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"[{\\\"key\\\":\\\"foo\\\",\\\"value\\\":\\\"bar\\\"},{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"123456\\\"}]\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Update contact metadata\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"[{\\\"key\\\":\\\"foo\\\",\\\"value\\\":\\\"bar\\\"},{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"123456\\\"}]\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Update contact metadata\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '[{\"key\":\"foo\",\"value\":\"bar\"},{\"key\":\"CRM_ID\",\"value\":\"123456\"}]'"},{"lang":"ObjC","source":"// Update contact metadata\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @[ @{ @\"key\": @\"foo\", @\"value\": @\"bar\" },\n                              @{ @\"key\": @\"CRM_ID\", @\"value\": @\"123456\" } ];\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Update contact metadata\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  [\n    \"key\": \"foo\",\n    \"value\": \"bar\"\n  ],\n  [\n    \"key\": \"CRM_ID\",\n    \"value\": \"123456\"\n  ]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Update metadata","description":"Partially update without deleting existing metadata entries for the given contact using key-value pairs by WhatsApp contact ID or phone number. Only metadata information of a user contact can be updated.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fcontacts%2F%7BcontactWid%7D&method=PATCH&body=%5B%0A%20%20%7B%0A%20%20%20%20%22key%22%3A%20%22foo%22%2C%0A%20%20%20%20%22value%22%3A%20%22bar%22%0A%20%20%7D%2C%0A%20%20%7B%0A%20%20%20%20%22key%22%3A%20%22baz%22%2C%0A%20%20%20%20%22value%22%3A%20%22bar%22%0A%20%20%7D%0A%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"upsertContactMetadata","security":[{"apiKey":[]}],"parameters":[{"in":"body","name":"metadata","schema":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-zA-Z0-9_]*$","minLength":1,"maxLength":30,"description":"Metadata entry key that can only contain alphanumeric (`a-z`, `A-Z`, `0-9`), or underscore (`_`) characters."},"value":{"type":"string","minLength":0,"maxLength":300,"description":"Metadata entry value can contain any text up to 300 characters."}},"additionalProperties":false},"maxItems":30}}],"tags":["Chat Contacts"],"consumes":["application/json"],"produces":["application/json"],"responses":{"200":{"description":"Updated contact metadata","schema":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Metadata entry key"},"value":{"type":"string","description":"Metadata entry value"}}}}},"400":{"description":"Invalid request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Contact not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Update contact information\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid} \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '[{\"key\":\"foo\",\"value\":\"bar\"},{\"key\":\"baz\",\"value\":\"bar\"}]'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Update contact information\necho '[{\"key\":\"foo\",\"value\":\"bar\"},{\"key\":\"baz\",\"value\":\"bar\"}]' |  \\\n  http PATCH https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid} \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Update contact information\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"key\":\"foo\",\"value\":\"bar\"},{\"key\":\"baz\",\"value\":\"bar\"}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Update contact information\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: [{key: 'foo', value: 'bar'}, {key: 'baz', value: 'bar'}]\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Update contact information\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send([\n  {\n    key: 'foo',\n    value: 'bar'\n  },\n  {\n    key: 'baz',\n    value: 'bar'\n  }\n]);\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Update contact information\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}', [\n  'body' => '[{\"key\":\"foo\",\"value\":\"bar\"},{\"key\":\"baz\",\"value\":\"bar\"}]',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Update contact information\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  [\n    'key' => 'foo',\n    'value' => 'bar'\n  ],\n  [\n    'key' => 'baz',\n    'value' => 'bar'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Update contact information\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    [\n        'key' => 'foo',\n        'value' => 'bar'\n    ],\n    [\n        'key' => 'baz',\n        'value' => 'bar'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Update contact information\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"\n\npayload = [\n    {\n        \"key\": \"foo\",\n        \"value\": \"bar\"\n    },\n    {\n        \"key\": \"baz\",\n        \"value\": \"bar\"\n    }\n]\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update contact information\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"key\":\"foo\",\"value\":\"bar\"},{\"key\":\"baz\",\"value\":\"bar\"}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update contact information\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '[{\"key\":\"foo\",\"value\":\"bar\"},{\"key\":\"baz\",\"value\":\"bar\"}]'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Update contact information\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"[{\\\"key\\\":\\\"foo\\\",\\\"value\\\":\\\"bar\\\"},{\\\"key\\\":\\\"baz\\\",\\\"value\\\":\\\"bar\\\"}]\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Update contact information\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"\n\n\tpayload := strings.NewReader(\"[{\\\"key\\\":\\\"foo\\\",\\\"value\\\":\\\"bar\\\"},{\\\"key\\\":\\\"baz\\\",\\\"value\\\":\\\"bar\\\"}]\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Update contact information\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"[{\\\"key\\\":\\\"foo\\\",\\\"value\\\":\\\"bar\\\"},{\\\"key\\\":\\\"baz\\\",\\\"value\\\":\\\"bar\\\"}]\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Update contact information\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"[{\\\"key\\\":\\\"foo\\\",\\\"value\\\":\\\"bar\\\"},{\\\"key\\\":\\\"baz\\\",\\\"value\\\":\\\"bar\\\"}]\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Update contact information\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"[{\\\"key\\\":\\\"foo\\\",\\\"value\\\":\\\"bar\\\"},{\\\"key\\\":\\\"baz\\\",\\\"value\\\":\\\"bar\\\"}]\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Update contact information\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"[{\\\"key\\\":\\\"foo\\\",\\\"value\\\":\\\"bar\\\"},{\\\"key\\\":\\\"baz\\\",\\\"value\\\":\\\"bar\\\"}]\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Update contact information\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"[{\\\"key\\\":\\\"foo\\\",\\\"value\\\":\\\"bar\\\"},{\\\"key\\\":\\\"baz\\\",\\\"value\\\":\\\"bar\\\"}]\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Update contact information\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '[{\"key\":\"foo\",\"value\":\"bar\"},{\"key\":\"baz\",\"value\":\"bar\"}]'"},{"lang":"ObjC","source":"// Update contact information\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @[ @{ @\"key\": @\"foo\", @\"value\": @\"bar\" },\n                              @{ @\"key\": @\"baz\", @\"value\": @\"bar\" } ];\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Update contact information\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  [\n    \"key\": \"foo\",\n    \"value\": \"bar\"\n  ],\n  [\n    \"key\": \"baz\",\n    \"value\": \"bar\"\n  ]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/contacts/{contactWid}":{"parameters":[],"get":{"summary":"Get contact","description":"Get contact details by WhatsApp ID or phone number. You can retrieve information from users and groups.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fcontacts%2F%7BcontactWid%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getDeviceContactDetails","security":[{"apiKey":[]}],"parameters":[{"in":"query","name":"include","type":"array","collectionFormat":"csv","description":"Include related entities of the contact","items":{"type":"string","enum":["chat","campaigns"]}}],"tags":["Chat Contacts"],"produces":["application/json"],"responses":{"200":{"description":"Contact details","schema":{"$ref":"#/definitions/ioContact"}},"400":{"description":"Invalid request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Contact not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get device contact details\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get device contact details\nhttp GET https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get device contact details\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get device contact details\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get device contact details\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get device contact details\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get device contact details\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get device contact details\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get device contact details\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get device contact details\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get device contact details\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get device contact details\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get device contact details\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get device contact details\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get device contact details\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get device contact details\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get device contact details\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get device contact details\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get device contact details\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get device contact details\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get device contact details\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Update contact","description":"Update contact information by WhatsApp contact ID.\n\n\n\nExample WhatsApp ID: `123456789@c.us` where `123456789` represents the international phone number.\n\n\n\n**Note**: in order to remove/unset one or multiple fields, use the `$remove` field setting as value an array of field names (string) with the ones you want to remove/unset.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fcontacts%2F%7BcontactWid%7D&method=PATCH&body=%7B%0A%20%20%22name%22%3A%20%22John%22%2C%0A%20%20%22surname%22%3A%20%22Doe%22%2C%0A%20%20%22email%22%3A%20%22john%40domain.com%22%2C%0A%20%20%22country%22%3A%20%22US%22%2C%0A%20%20%22city%22%3A%20%22Ney%20York%22%2C%0A%20%20%22postalCode%22%3A%20%221234%22%2C%0A%20%20%22kind%22%3A%20%22personal%22%2C%0A%20%20%22metadata%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22key%22%3A%20%22CRM_ID%22%2C%0A%20%20%20%20%20%20%22value%22%3A%20%2212345678%22%0A%20%20%20%20%7D%0A%20%20%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateContact","security":[{"apiKey":[]}],"parameters":[{"in":"body","name":"info","schema":{"type":"object","properties":{"$remove":{"type":"array","items":{"type":"string","enum":["name","surname","altPhone","email","companyName","timezone","companyCode","companyTaxId","companyWebsite","companyRole","title","companyEmail","companyPhone","country","companyCountry","address","city","crm","crmRef","postalCode","notes","gender","currency","birthday","description","languages","links","sync"],"description":"Field name to set as removed (`null`)"},"maxItems":30,"description":"Remove one or multiple data fields setting the value as `null`. Useful to wipe informtion of the contact when an empty string is not accepted."},"name":{"type":"string","maxLength":30},"surname":{"type":"string","maxLength":50},"title":{"type":"string","maxLength":15},"kind":{"type":"string","enum":["personal","business"]},"gender":{"type":"string","enum":["male","female","other"]},"altPhone":{"type":"string","minLength":6,"maxLength":20,"description":"Secondary phone number in E164 compatible format. E.g: +1234567890"},"email":{"type":"string","format":"email","minLength":5,"maxLength":100},"description":{"type":"string","maxLength":100},"languages":{"type":"array","items":{"type":"string","minLength":2,"maxLength":2},"minItems":0,"maxItems":3},"companyName":{"type":"string","maxLength":50},"companyCode":{"type":"string","maxLength":50},"companyTaxId":{"type":"string","maxLength":30},"companyRole":{"type":"string","maxLength":30},"companyWebsite":{"type":"string","minLength":6,"maxLength":100},"companyEmail":{"type":"string","format":"email","minLength":5,"maxLength":100},"companyPhone":{"type":"string","minLength":2,"maxLength":18,"description":"Company phone number in E164 compatible format. E.g: +1234567890"},"companyCountry":{"type":"string","minLength":2,"maxLength":2,"description":"Company country alpha-2 ISO 3166 code. [More information](https://www.iban.com/country-codes)"},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"Currency alpha-3 ISO code. [More information](https://www.iban.com/currency-codes)"},"address":{"type":"string","maxLength":100},"city":{"type":"string","maxLength":30},"postalCode":{"type":"string","maxLength":20},"country":{"type":"string","minLength":2,"maxLength":2,"description":"Country alpha-2 ISO 3166 code. [More information](https://www.iban.com/country-codes)"},"notes":{"type":"string","minLength":0,"maxLength":3000,"description":"Internal plain text notes about this contact. Setting this field will overwrite the existing notes text."},"birthday":{"type":"string","format":"date-time"},"notifications":{"type":"string","enum":["on","mute","ignore"]},"timezone":{"type":"string","minLength":2,"maxLength":40,"description":"Contact location time zone. [List of supported values](https://bit.ly/3Ci2Ac1)"},"crm":{"type":"string","minLength":2,"maxLength":50,"description":"Optional external CRM source name. E.g: `hubspot`, `dynamics`, `zoho`, `bitrix`, `salesforce`..."},"crmRef":{"type":"string","minLength":2,"maxLength":500,"description":"Optional external CRM user reference, such as an ID, email or URL to the contact in an external CRM system."},"sync":{"type":"boolean","description":"Enable contact automatic synchronization across **all** WhatsApp numbers connected in your account. This option is disabled by default. To synchronize a contact only in specific WhatsApp numbers, use `syncNumbers` field instead.","default":false},"syncNumbers":{"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Synchronize this contact in specific WhatsApp numbers in your account by entering the the WhatsApp number IDs (24 characters hexadecimal value)."},"maxItems":30,"description":"Enable contact automatic synchronization across multiple WhatsApp numbers connected in your account. Use `all` to synchronize the contact across all connected numbers in your account, or use the target number ID (24 characters hexadecimal) to select the target numbers you want to synchronize the contact with. This option is disabled by default."},"metadata":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-zA-Z0-9_]*$","minLength":1,"maxLength":30,"description":"Metadata entry key that can only contain alphanumeric (`a-z`, `A-Z`, `0-9`), or underscore (`_`) characters."},"value":{"type":"string","minLength":0,"maxLength":300,"description":"Metadata entry value can contain any text up to 300 characters."}},"additionalProperties":false},"maxItems":30},"links":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["url","token","text"],"default":"text"},"platform":{"type":"string","minLength":30},"value":{"type":"string","minLength":2,"maxLength":200}},"additionalProperties":false},"maxItems":10},"subscription":{"type":"object","properties":{"status":{"type":"string","enum":["subscribed","active","exclude","unsubscribed"],"description":"Set subscription status for this contact"}},"additionalProperties":false,"description":"Update campaigns subscription settings for this contact"}},"additionalProperties":false}}],"tags":["Chat Contacts"],"consumes":["application/json"],"produces":["application/json"],"responses":{"200":{"description":"Updated contact","schema":{"$ref":"#/definitions/ioContact"}},"400":{"description":"Invalid request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Contact not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Update contact information\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid} \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"name\":\"John\",\"surname\":\"Doe\",\"email\":\"john@domain.com\",\"country\":\"US\",\"city\":\"Ney York\",\"postalCode\":\"1234\",\"kind\":\"personal\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"12345678\"}]}'\n\n\n// Update and remove multiple fields\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid} \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"$remove\":[\"city\",\"postalCode\",\"surname\"],\"email\":\"john@new-domain.com\",\"country\":\"GB\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Update contact information\necho '{\"name\":\"John\",\"surname\":\"Doe\",\"email\":\"john@domain.com\",\"country\":\"US\",\"city\":\"Ney York\",\"postalCode\":\"1234\",\"kind\":\"personal\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"12345678\"}]}' |  \\\n  http PATCH https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid} \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Update and remove multiple fields\necho '{\"$remove\":[\"city\",\"postalCode\",\"surname\"],\"email\":\"john@new-domain.com\",\"country\":\"GB\"}' |  \\\n  http PATCH https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid} \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Update contact information\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"John\",\"surname\":\"Doe\",\"email\":\"john@domain.com\",\"country\":\"US\",\"city\":\"Ney York\",\"postalCode\":\"1234\",\"kind\":\"personal\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"12345678\"}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Update and remove multiple fields\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"$remove\":[\"city\",\"postalCode\",\"surname\"],\"email\":\"john@new-domain.com\",\"country\":\"GB\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Update contact information\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    name: 'John',\n    surname: 'Doe',\n    email: 'john@domain.com',\n    country: 'US',\n    city: 'Ney York',\n    postalCode: '1234',\n    kind: 'personal',\n    metadata: [{key: 'CRM_ID', value: '12345678'}]\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Update and remove multiple fields\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    $remove: ['city', 'postalCode', 'surname'],\n    email: 'john@new-domain.com',\n    country: 'GB'\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Update contact information\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  name: 'John',\n  surname: 'Doe',\n  email: 'john@domain.com',\n  country: 'US',\n  city: 'Ney York',\n  postalCode: '1234',\n  kind: 'personal',\n  metadata: [\n    {\n      key: 'CRM_ID',\n      value: '12345678'\n    }\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Update and remove multiple fields\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  $remove: [\n    'city',\n    'postalCode',\n    'surname'\n  ],\n  email: 'john@new-domain.com',\n  country: 'GB'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Update contact information\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}', [\n  'body' => '{\"name\":\"John\",\"surname\":\"Doe\",\"email\":\"john@domain.com\",\"country\":\"US\",\"city\":\"Ney York\",\"postalCode\":\"1234\",\"kind\":\"personal\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"12345678\"}]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Update and remove multiple fields\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}', [\n  'body' => '{\"$remove\":[\"city\",\"postalCode\",\"surname\"],\"email\":\"john@new-domain.com\",\"country\":\"GB\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Update contact information\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'name' => 'John',\n  'surname' => 'Doe',\n  'email' => 'john@domain.com',\n  'country' => 'US',\n  'city' => 'Ney York',\n  'postalCode' => '1234',\n  'kind' => 'personal',\n  'metadata' => [\n    [\n        'key' => 'CRM_ID',\n        'value' => '12345678'\n    ]\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Update and remove multiple fields\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  '$remove' => [\n    'city',\n    'postalCode',\n    'surname'\n  ],\n  'email' => 'john@new-domain.com',\n  'country' => 'GB'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Update contact information\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'name' => 'John',\n    'surname' => 'Doe',\n    'email' => 'john@domain.com',\n    'country' => 'US',\n    'city' => 'Ney York',\n    'postalCode' => '1234',\n    'kind' => 'personal',\n    'metadata' => [\n        [\n                'key' => 'CRM_ID',\n                'value' => '12345678'\n        ]\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Update and remove multiple fields\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    '$remove' => [\n        'city',\n        'postalCode',\n        'surname'\n    ],\n    'email' => 'john@new-domain.com',\n    'country' => 'GB'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Update contact information\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"\n\npayload = {\n    \"name\": \"John\",\n    \"surname\": \"Doe\",\n    \"email\": \"john@domain.com\",\n    \"country\": \"US\",\n    \"city\": \"Ney York\",\n    \"postalCode\": \"1234\",\n    \"kind\": \"personal\",\n    \"metadata\": [\n        {\n            \"key\": \"CRM_ID\",\n            \"value\": \"12345678\"\n        }\n    ]\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Update and remove multiple fields\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"\n\npayload = {\n    \"$remove\": [\"city\", \"postalCode\", \"surname\"],\n    \"email\": \"john@new-domain.com\",\n    \"country\": \"GB\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update contact information\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"John\",\"surname\":\"Doe\",\"email\":\"john@domain.com\",\"country\":\"US\",\"city\":\"Ney York\",\"postalCode\":\"1234\",\"kind\":\"personal\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"12345678\"}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Update and remove multiple fields\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"$remove\":[\"city\",\"postalCode\",\"surname\"],\"email\":\"john@new-domain.com\",\"country\":\"GB\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update contact information\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"name\":\"John\",\"surname\":\"Doe\",\"email\":\"john@domain.com\",\"country\":\"US\",\"city\":\"Ney York\",\"postalCode\":\"1234\",\"kind\":\"personal\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"12345678\"}]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Update and remove multiple fields\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"$remove\":[\"city\",\"postalCode\",\"surname\"],\"email\":\"john@new-domain.com\",\"country\":\"GB\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Update contact information\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"name\\\":\\\"John\\\",\\\"surname\\\":\\\"Doe\\\",\\\"email\\\":\\\"john@domain.com\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Ney York\\\",\\\"postalCode\\\":\\\"1234\\\",\\\"kind\\\":\\\"personal\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"12345678\\\"}]}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Update and remove multiple fields\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"$remove\\\":[\\\"city\\\",\\\"postalCode\\\",\\\"surname\\\"],\\\"email\\\":\\\"john@new-domain.com\\\",\\\"country\\\":\\\"GB\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Update contact information\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"\n\n\tpayload := strings.NewReader(\"{\\\"name\\\":\\\"John\\\",\\\"surname\\\":\\\"Doe\\\",\\\"email\\\":\\\"john@domain.com\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Ney York\\\",\\\"postalCode\\\":\\\"1234\\\",\\\"kind\\\":\\\"personal\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"12345678\\\"}]}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Update and remove multiple fields\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"\n\n\tpayload := strings.NewReader(\"{\\\"$remove\\\":[\\\"city\\\",\\\"postalCode\\\",\\\"surname\\\"],\\\"email\\\":\\\"john@new-domain.com\\\",\\\"country\\\":\\\"GB\\\"}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Update contact information\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"name\\\":\\\"John\\\",\\\"surname\\\":\\\"Doe\\\",\\\"email\\\":\\\"john@domain.com\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Ney York\\\",\\\"postalCode\\\":\\\"1234\\\",\\\"kind\\\":\\\"personal\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"12345678\\\"}]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Update and remove multiple fields\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"$remove\\\":[\\\"city\\\",\\\"postalCode\\\",\\\"surname\\\"],\\\"email\\\":\\\"john@new-domain.com\\\",\\\"country\\\":\\\"GB\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Update contact information\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"name\\\":\\\"John\\\",\\\"surname\\\":\\\"Doe\\\",\\\"email\\\":\\\"john@domain.com\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Ney York\\\",\\\"postalCode\\\":\\\"1234\\\",\\\"kind\\\":\\\"personal\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"12345678\\\"}]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Update and remove multiple fields\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"$remove\\\":[\\\"city\\\",\\\"postalCode\\\",\\\"surname\\\"],\\\"email\\\":\\\"john@new-domain.com\\\",\\\"country\\\":\\\"GB\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Update contact information\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"name\\\":\\\"John\\\",\\\"surname\\\":\\\"Doe\\\",\\\"email\\\":\\\"john@domain.com\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Ney York\\\",\\\"postalCode\\\":\\\"1234\\\",\\\"kind\\\":\\\"personal\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"12345678\\\"}]}\")\n  .asString();\n\n\n// Update and remove multiple fields\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"$remove\\\":[\\\"city\\\",\\\"postalCode\\\",\\\"surname\\\"],\\\"email\\\":\\\"john@new-domain.com\\\",\\\"country\\\":\\\"GB\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Update contact information\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"name\\\":\\\"John\\\",\\\"surname\\\":\\\"Doe\\\",\\\"email\\\":\\\"john@domain.com\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Ney York\\\",\\\"postalCode\\\":\\\"1234\\\",\\\"kind\\\":\\\"personal\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"12345678\\\"}]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Update and remove multiple fields\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"$remove\\\":[\\\"city\\\",\\\"postalCode\\\",\\\"surname\\\"],\\\"email\\\":\\\"john@new-domain.com\\\",\\\"country\\\":\\\"GB\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Update contact information\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"name\\\":\\\"John\\\",\\\"surname\\\":\\\"Doe\\\",\\\"email\\\":\\\"john@domain.com\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Ney York\\\",\\\"postalCode\\\":\\\"1234\\\",\\\"kind\\\":\\\"personal\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"12345678\\\"}]}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Update and remove multiple fields\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"$remove\\\":[\\\"city\\\",\\\"postalCode\\\",\\\"surname\\\"],\\\"email\\\":\\\"john@new-domain.com\\\",\\\"country\\\":\\\"GB\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Update contact information\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"name\":\"John\",\"surname\":\"Doe\",\"email\":\"john@domain.com\",\"country\":\"US\",\"city\":\"Ney York\",\"postalCode\":\"1234\",\"kind\":\"personal\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"12345678\"}]}'\n\n\n# Update and remove multiple fields\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"$remove\":[\"city\",\"postalCode\",\"surname\"],\"email\":\"john@new-domain.com\",\"country\":\"GB\"}'"},{"lang":"ObjC","source":"// Update contact information\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"name\": @\"John\",\n                              @\"surname\": @\"Doe\",\n                              @\"email\": @\"john@domain.com\",\n                              @\"country\": @\"US\",\n                              @\"city\": @\"Ney York\",\n                              @\"postalCode\": @\"1234\",\n                              @\"kind\": @\"personal\",\n                              @\"metadata\": @[ @{ @\"key\": @\"CRM_ID\", @\"value\": @\"12345678\" } ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Update and remove multiple fields\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"$remove\": @[ @\"city\", @\"postalCode\", @\"surname\" ],\n                              @\"email\": @\"john@new-domain.com\",\n                              @\"country\": @\"GB\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Update contact information\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"name\": \"John\",\n  \"surname\": \"Doe\",\n  \"email\": \"john@domain.com\",\n  \"country\": \"US\",\n  \"city\": \"Ney York\",\n  \"postalCode\": \"1234\",\n  \"kind\": \"personal\",\n  \"metadata\": [\n    [\n      \"key\": \"CRM_ID\",\n      \"value\": \"12345678\"\n    ]\n  ]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Update and remove multiple fields\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"$remove\": [\"city\", \"postalCode\", \"surname\"],\n  \"email\": \"john@new-domain.com\",\n  \"country\": \"GB\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Delete contact","description":"Delete contact by WhatsApp contact ID.\n\n\n\nExample WhatsApp ID: `123456789@c.us` where `123456789` represents the international phone number.\n\n\n\n**Important**: you can only delete contacts created outside of WhatsApp and the mobile agenda and those contacts who never had a WhatsApp chat in the existing number. Otherwise, the API will return a `409 Conflict` error.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fcontacts%2F%7BcontactWid%7D&method=PATCH&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deleteContact","security":[{"apiKey":[]}],"parameters":[],"tags":["Chat Contacts"],"produces":["application/json"],"responses":{"204":{"description":"Contact deleted","schema":{"$ref":"#/definitions/ioContact"}},"400":{"description":"Invalid request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Contact not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Contact cannot be deleted due to existing WhatsApp chat or WhatsApp synced","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Delete contact\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Delete contact\nhttp PATCH https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Delete contact\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}';\nconst options = {method: 'PATCH', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Delete contact\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Delete contact\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Delete contact\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Delete contact\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}');\n$request->setRequestMethod('PATCH');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Delete contact\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Delete contact\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.patch(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete contact\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}';\nconst options = {method: 'PATCH', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete contact\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}',\n  method: 'PATCH',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Delete contact\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Delete contact\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"\n\n\treq, _ := http.NewRequest(\"PATCH\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Delete contact\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Delete contact\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Delete contact\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Delete contact\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")\n  .patch(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Delete contact\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Delete contact\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}' -Method PATCH -Headers $headers"},{"lang":"ObjC","source":"// Delete contact\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Delete contact\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/contacts/{contactWid}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/contacts":{"parameters":[],"get":{"summary":"Contacts","description":"List or search contacts available for the device store, optionally filtered by search params.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fcontacts&params=%5B%7B%22key%22%3A%22size%22%2C%22value%22%3A20%7D%2C%7B%22key%22%3A%22page%22%2C%22value%22%3A0%7D%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getDeviceContacts","security":[{"apiKey":[]}],"tags":["Chat Contacts"],"produces":["application/json"],"parameters":[{"in":"query","name":"search","type":"string","maxLength":150,"description":"Search contacts by name, surname, ID, phone number, email, company name, company email, address, metadata or private notes"},{"in":"query","name":"type","type":"array","collectionFormat":"csv","maxItems":4,"items":{"type":"string","enum":["personal","business","private","user","group","channel"]},"description":"Filter contacts by type: personal, business, user (both previous), group, channel or private (contacts that came from a Facebook Ad campaign and did not approve yet to share their phone number)"},{"in":"query","name":"owner","type":"array","collectionFormat":"csv","description":"Filter contacts assigned to one of the given user IDs (24 characters hexadecimal). Multiple values allowed comma-separated.","maxItems":10,"items":{"type":"string","maxLength":24,"minLength":24,"pattern":"[0-9A-Fa-f]{24}"}},{"in":"query","name":"has","type":"array","collectionFormat":"csv","description":"Filter contacts that has an email, chat, or both.","items":{"type":"string","enum":["email","chat"]}},{"in":"query","name":"hasChat","type":"boolean","description":"**Deprecated**: use `has=chat` instead. Filter contacts with or without a WhatsApp chat."},{"in":"query","name":"country","type":"array","description":"Filter contacts per country alpha-2 ISO 3166 code. More information: https://www.iban.com/country-codes. Multiple values allowed comma-separeted.","maxItems":10,"items":{"type":"string","maxLength":2,"minLength":2,"pattern":"[A-Z]{2}"}},{"in":"query","name":"status","description":"Filter contacts by status","type":"array","collectionFormat":"csv","items":{"type":"string","maxLength":20,"enum":["active","blocked","removed"]},"maxItems":3},{"in":"query","name":"chatStatus","description":"Filter chats by status","type":"array","collectionFormat":"csv","items":{"type":"string","maxLength":20,"enum":["pending","active","resolved","muted","removed","archived"]},"maxItems":10},{"in":"query","name":"labels","type":"array","collectionFormat":"csv","description":"**Note**: this filter only works with contacts that have or had a WhatsApp chat started. Filter contacts by chat labels. If multiple labels are defined, at least one label should match. To include contacts that has any label assigned, use `*` as value, e.g: `labels=*`.","items":{"type":"string","minLength":1,"maxLength":30},"maxItems":20},{"in":"query","name":"labelsExclude","type":"array","collectionFormat":"csv","description":"**Note**: this filter only works with contacts that have or had a WhatsApp chat started. Exclude contacts that has certain labels. If multiple labels are defined, none of the labels provided should match. To exclude contacts that has no labels assigned, use `*` as value, e.g: `labelsExclude=*`.","items":{"type":"string","minLength":1,"maxLength":30},"maxItems":20},{"in":"query","name":"ids","type":"array","collectionFormat":"csv","description":"Filter contacts by chat WhatsApp ID. E.g: `1234567890@c.us`. Multiple IDs allowed separated by commas.","items":{"type":"string","minLength":8,"maxLength":40},"maxItems":200},{"in":"query","name":"lid","type":"array","collectionFormat":"csv","description":"Filter contacts by LID (private WhatsApp identifier). E.g: `1234567890123@lid`. Multiple LIDs allowed separated by commas.","maxItems":200,"items":{"type":"string","minLength":14,"maxLength":25}},{"in":"query","name":"phone","type":"array","collectionFormat":"csv","description":"Filter contacts by phone numbers or WIDs","items":{"type":"string","minLength":8,"maxLength":20},"maxItems":30},{"in":"query","name":"group","type":"array","collectionFormat":"csv","description":"Filter contacts by group WIDs","items":{"type":"string","minLength":8,"maxLength":30},"maxItems":30},{"in":"query","name":"broadcast","type":"array","collectionFormat":"csv","description":"Filter contacts by broadlist WIDs","items":{"type":"string","minLength":8,"maxLength":30},"maxItems":30},{"in":"query","name":"include","type":"array","collectionFormat":"csv","description":"Include contact related entities in the response, like the contact active chat, if available","items":{"type":"string","enum":["chat"]},"maxItems":5},{"in":"query","name":"metadataKey","description":"Filter contacts with a specific metadata key. Multiple values are allowed comma-separated","type":"array","collectionFormat":"csv","maxItems":10,"items":{"type":"string","minLength":1,"maxLength":30,"pattern":"[a-zA-Z0-9_]"}},{"in":"query","name":"metadataValue","type":"array","description":"Filter contacts with a specific metadata value. Multiple values are allowed comma-separated","collectionFormat":"csv","maxItems":10,"items":{"type":"string","minLength":1,"maxLength":300}},{"name":"after","description":"Filter contacts created after the given date","in":"query","type":"string","format":"date-time"},{"name":"before","description":"Filter contacts created before the given date","in":"query","type":"string","format":"date-time"},{"name":"updatedAfter","description":"Filter contacts updated after the given date","in":"query","type":"string","format":"date-time"},{"name":"updatedBefore","description":"Filter contacts updated before the given date","in":"query","type":"string","format":"date-time"},{"name":"lastMessageBefore","description":"Filter contacts with an active chat where the last message want sent before the given date","in":"query","type":"string","format":"date-time"},{"name":"lastMessageAfter","description":"Filter contacts with an active chat where the last message want sent after the given date","in":"query","type":"string","format":"date-time"},{"in":"query","name":"page","description":"Results page number (starting from 0)","type":"number","format":"integer","default":0,"minimum":0,"maximum":300},{"in":"query","name":"size","description":"Results page size","type":"number","format":"integer","default":20,"minimum":1,"maximum":500},{"in":"query","name":"sort","description":"Defines how to sort contacts","type":"string","enum":["name:asc","name:desc","date:asc","date:desc","message:asc","message:desc"]}],"responses":{"200":{"description":"Contacts","schema":{"type":"array","items":{"$ref":"#/definitions/ioContact"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Search most recent contacts\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/contacts?size=20&page=0' \\\n  --header 'Token: <api token goes here>'\n\n\n// Search group only contacts\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/contacts?type=group' \\\n  --header 'Token: <api token goes here>'\n\n\n// Search contact by phone number \ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/contacts?phone=%2B123456789' \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Search most recent contacts\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/contacts?size=20&page=0' \\\n  Token:'<api token goes here>'\n\n\n// Search group only contacts\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/contacts?type=group' \\\n  Token:'<api token goes here>'\n\n\n// Search contact by phone number \nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/contacts?phone=%2B123456789' \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Search most recent contacts\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/contacts?size=20&page=0';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Search group only contacts\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/contacts?type=group';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Search contact by phone number \nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/contacts?phone=%2B123456789';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Search most recent contacts\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/contacts',\n  params: {size: '20', page: '0'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Search group only contacts\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/contacts',\n  params: {type: 'group'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Search contact by phone number \nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/contacts',\n  params: {phone: '+123456789'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Search most recent contacts\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/contacts');\n\nreq.query({\n  size: '20',\n  page: '0'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Search group only contacts\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/contacts');\n\nreq.query({\n  type: 'group'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Search contact by phone number \nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/contacts');\n\nreq.query({\n  phone: '+123456789'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Search most recent contacts\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/contacts?size=20&page=0', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Search group only contacts\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/contacts?type=group', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Search contact by phone number \n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/contacts?phone=%2B123456789', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Search most recent contacts\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/contacts');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'size' => '20',\n  'page' => '0'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Search group only contacts\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/contacts');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'type' => 'group'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Search contact by phone number \n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/contacts');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'phone' => '+123456789'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Search most recent contacts\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/contacts?size=20&page=0\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Search group only contacts\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/contacts?type=group\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Search contact by phone number \n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/contacts?phone=%2B123456789\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Search most recent contacts\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/contacts\"\n\nquerystring = {\"size\":\"20\",\"page\":\"0\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Search group only contacts\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/contacts\"\n\nquerystring = {\"type\":\"group\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Search contact by phone number \nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/contacts\"\n\nquerystring = {\"phone\":\"+123456789\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Search most recent contacts\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/contacts?size=20&page=0';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Search group only contacts\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/contacts?type=group';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Search contact by phone number \nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/contacts?phone=%2B123456789';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Search most recent contacts\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/contacts?size=20&page=0',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Search group only contacts\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/contacts?type=group',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Search contact by phone number \nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/contacts?phone=%2B123456789',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Search most recent contacts\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts?size=20&page=0\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Search group only contacts\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts?type=group\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Search contact by phone number \nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts?phone=%2B123456789\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Search most recent contacts\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/contacts?size=20&page=0\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Search group only contacts\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/contacts?type=group\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Search contact by phone number \npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/contacts?phone=%2B123456789\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Search most recent contacts\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts?size=20&page=0\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Search group only contacts\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts?type=group\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Search contact by phone number \nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts?phone=%2B123456789\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Search most recent contacts\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts?size=20&page=0\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Search group only contacts\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts?type=group\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Search contact by phone number \nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts?phone=%2B123456789\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Search most recent contacts\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts?size=20&page=0\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Search group only contacts\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts?type=group\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Search contact by phone number \nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts?phone=%2B123456789\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Search most recent contacts\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts?size=20&page=0\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Search group only contacts\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts?type=group\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Search contact by phone number \nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts?phone=%2B123456789\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Search most recent contacts\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/contacts?size=20&page=0\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Search group only contacts\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/contacts?type=group\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Search contact by phone number \nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/contacts?phone=%2B123456789\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Search most recent contacts\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/contacts?size=20&page=0' -Method GET -Headers $headers\n\n\n# Search group only contacts\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/contacts?type=group' -Method GET -Headers $headers\n\n\n# Search contact by phone number \n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/contacts?phone=%2B123456789' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Search most recent contacts\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/contacts?size=20&page=0\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Search group only contacts\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/contacts?type=group\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Search contact by phone number \n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/contacts?phone=%2B123456789\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Search most recent contacts\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/contacts?size=20&page=0\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Search group only contacts\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/contacts?type=group\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Search contact by phone number \nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/contacts?phone=%2B123456789\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"post":{"summary":"Create contact","description":"Create a new user contact based a phone numer in E164 format (e.g: +1234567890) in the platform internal contacts agenda of the connected WhatsApp number.\n\n\n\nContacts created from the platform API or chat are not synced with the WhatsApp connected mobile agenda, therefore contacts may be listed in the WhatsApp mobile app with their the raw phone number instead of the contact name.\n\n\n\n**Related tutorials**:\n\n- [Import contacts from Hubspot using the API](/help/contacts-hubspot)\n\n\n\n**Note**: if the phone number is already in use by an existing contact in the specific device contacts store, the API will return a `409 Conflict` error response, and the existing contact WhatsApp ID will be returned in the error response that can be later used to update the existing contact using the [Update contact endpoint](#operation/updateContact).\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fcontacts&method=POST&body=%7B%0A%20%20%22name%22%3A%20%22John%22%2C%0A%20%20%22surname%22%3A%20%22Doe%22%2C%0A%20%20%22kind%22%3A%20%22personal%22%2C%0A%20%20%22email%22%3A%20%22john%40domain.com%22%2C%0A%20%20%22phone%22%3A%20%22%2B1234567890%22%2C%0A%20%20%22country%22%3A%20%22US%22%2C%0A%20%20%22city%22%3A%20%22Ney%20York%22%2C%0A%20%20%22postalCode%22%3A%20%2212345%22%2C%0A%20%20%22metadata%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22key%22%3A%20%22CRM_ID%22%2C%0A%20%20%20%20%20%20%22value%22%3A%20%2212345678%22%0A%20%20%20%20%7D%0A%20%20%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"createContact","security":[{"apiKey":[]}],"parameters":[{"in":"body","name":"contact","schema":{"type":"object","properties":{"name":{"type":"string","maxLength":30},"surname":{"type":"string","maxLength":50},"title":{"type":"string","maxLength":15},"kind":{"type":"string","enum":["personal","business"]},"gender":{"type":"string","enum":["male","female","other"]},"altPhone":{"type":"string","minLength":6,"maxLength":20,"description":"Secondary phone number in E164 compatible format. E.g: +1234567890"},"email":{"type":"string","format":"email","minLength":5,"maxLength":100},"description":{"type":"string","maxLength":100},"languages":{"type":"array","items":{"type":"string","minLength":2,"maxLength":2},"minItems":0,"maxItems":3},"companyName":{"type":"string","maxLength":50},"companyCode":{"type":"string","maxLength":50},"companyTaxId":{"type":"string","maxLength":30},"companyRole":{"type":"string","maxLength":30},"companyWebsite":{"type":"string","minLength":6,"maxLength":100},"companyEmail":{"type":"string","format":"email","minLength":5,"maxLength":100},"companyPhone":{"type":"string","minLength":2,"maxLength":18,"description":"Company phone number in E164 compatible format. E.g: +1234567890"},"companyCountry":{"type":"string","minLength":2,"maxLength":2,"description":"Company country alpha-2 ISO 3166 code. [More information](https://www.iban.com/country-codes)"},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"Currency alpha-3 ISO code. [More information](https://www.iban.com/currency-codes)"},"address":{"type":"string","maxLength":100},"city":{"type":"string","maxLength":30},"postalCode":{"type":"string","maxLength":20},"country":{"type":"string","minLength":2,"maxLength":2,"description":"Country alpha-2 ISO 3166 code. [More information](https://www.iban.com/country-codes)"},"notes":{"type":"string","minLength":0,"maxLength":3000,"description":"Internal plain text notes about this contact. Setting this field will overwrite the existing notes text."},"birthday":{"type":"string","format":"date-time"},"notifications":{"type":"string","enum":["on","mute","ignore"]},"timezone":{"type":"string","minLength":2,"maxLength":40,"description":"Contact location time zone. [List of supported values](https://bit.ly/3Ci2Ac1)"},"crm":{"type":"string","minLength":2,"maxLength":50,"description":"Optional external CRM source name. E.g: `hubspot`, `dynamics`, `zoho`, `bitrix`, `salesforce`..."},"crmRef":{"type":"string","minLength":2,"maxLength":500,"description":"Optional external CRM user reference, such as an ID, email or URL to the contact in an external CRM system."},"sync":{"type":"boolean","description":"Enable contact automatic synchronization across **all** WhatsApp numbers connected in your account. This option is disabled by default. To synchronize a contact only in specific WhatsApp numbers, use `syncNumbers` field instead.","default":false},"syncNumbers":{"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Synchronize this contact in specific WhatsApp numbers in your account by entering the the WhatsApp number IDs (24 characters hexadecimal value)."},"maxItems":30,"description":"Enable contact automatic synchronization across multiple WhatsApp numbers connected in your account. Use `all` to synchronize the contact across all connected numbers in your account, or use the target number ID (24 characters hexadecimal) to select the target numbers you want to synchronize the contact with. This option is disabled by default."},"metadata":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-zA-Z0-9_]*$","minLength":1,"maxLength":30,"description":"Metadata entry key that can only contain alphanumeric (`a-z`, `A-Z`, `0-9`), or underscore (`_`) characters."},"value":{"type":"string","minLength":0,"maxLength":300,"description":"Metadata entry value can contain any text up to 300 characters."}},"additionalProperties":false},"maxItems":30},"links":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["url","token","text"],"default":"text"},"platform":{"type":"string","minLength":30},"value":{"type":"string","minLength":2,"maxLength":200}},"additionalProperties":false},"maxItems":10},"subscription":{"type":"object","properties":{"status":{"type":"string","enum":["subscribed","active","exclude","unsubscribed"],"description":"Set subscription status for this contact"}},"additionalProperties":false,"description":"Update campaigns subscription settings for this contact"},"$remove":{},"phone":{"type":"string","minLength":6,"maxLength":20},"assign":{"type":"string","minLength":24,"maxLength":24,"description":"Optionally assign the chat of the new contact to a member of the number's team by ID (24 hexadecimal characters). Applies only when the contact and its chat are created, and only if your role can assign chats; an existing contact keeps its chat as it is. If not set, the chat stays unassigned and pending, and can be assigned later."},"upsert":{"type":"boolean","description":"If the contact already exists, update the contact information. If not, create a new contact entry. Default is `false`","default":false}},"required":["phone"],"additionalProperties":false}}],"tags":["Chat Contacts"],"consumes":["application/json"],"produces":["application/json"],"responses":{"200":{"description":"Contact created","schema":{"$ref":"#/definitions/ioContact"}},"400":{"description":"Invalid body request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unauthorized or missing permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Contact phone number already exists","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Create new contact\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/contacts \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"name\":\"John\",\"surname\":\"Doe\",\"kind\":\"personal\",\"email\":\"john@domain.com\",\"phone\":\"+1234567890\",\"country\":\"US\",\"city\":\"Ney York\",\"postalCode\":\"12345\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"12345678\"}]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Create new contact\necho '{\"name\":\"John\",\"surname\":\"Doe\",\"kind\":\"personal\",\"email\":\"john@domain.com\",\"phone\":\"+1234567890\",\"country\":\"US\",\"city\":\"Ney York\",\"postalCode\":\"12345\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"12345678\"}]}' |  \\\n  http POST https://api.wassenger.com/v1/chat/{deviceId}/contacts \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Create new contact\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/contacts';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"John\",\"surname\":\"Doe\",\"kind\":\"personal\",\"email\":\"john@domain.com\",\"phone\":\"+1234567890\",\"country\":\"US\",\"city\":\"Ney York\",\"postalCode\":\"12345\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"12345678\"}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Create new contact\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/contacts',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    name: 'John',\n    surname: 'Doe',\n    kind: 'personal',\n    email: 'john@domain.com',\n    phone: '+1234567890',\n    country: 'US',\n    city: 'Ney York',\n    postalCode: '12345',\n    metadata: [{key: 'CRM_ID', value: '12345678'}]\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Create new contact\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/contacts');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  name: 'John',\n  surname: 'Doe',\n  kind: 'personal',\n  email: 'john@domain.com',\n  phone: '+1234567890',\n  country: 'US',\n  city: 'Ney York',\n  postalCode: '12345',\n  metadata: [\n    {\n      key: 'CRM_ID',\n      value: '12345678'\n    }\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Create new contact\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/contacts', [\n  'body' => '{\"name\":\"John\",\"surname\":\"Doe\",\"kind\":\"personal\",\"email\":\"john@domain.com\",\"phone\":\"+1234567890\",\"country\":\"US\",\"city\":\"Ney York\",\"postalCode\":\"12345\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"12345678\"}]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Create new contact\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'name' => 'John',\n  'surname' => 'Doe',\n  'kind' => 'personal',\n  'email' => 'john@domain.com',\n  'phone' => '+1234567890',\n  'country' => 'US',\n  'city' => 'Ney York',\n  'postalCode' => '12345',\n  'metadata' => [\n    [\n        'key' => 'CRM_ID',\n        'value' => '12345678'\n    ]\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/contacts');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Create new contact\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/contacts\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'name' => 'John',\n    'surname' => 'Doe',\n    'kind' => 'personal',\n    'email' => 'john@domain.com',\n    'phone' => '+1234567890',\n    'country' => 'US',\n    'city' => 'Ney York',\n    'postalCode' => '12345',\n    'metadata' => [\n        [\n                'key' => 'CRM_ID',\n                'value' => '12345678'\n        ]\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Create new contact\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/contacts\"\n\npayload = {\n    \"name\": \"John\",\n    \"surname\": \"Doe\",\n    \"kind\": \"personal\",\n    \"email\": \"john@domain.com\",\n    \"phone\": \"+1234567890\",\n    \"country\": \"US\",\n    \"city\": \"Ney York\",\n    \"postalCode\": \"12345\",\n    \"metadata\": [\n        {\n            \"key\": \"CRM_ID\",\n            \"value\": \"12345678\"\n        }\n    ]\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create new contact\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/contacts';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"John\",\"surname\":\"Doe\",\"kind\":\"personal\",\"email\":\"john@domain.com\",\"phone\":\"+1234567890\",\"country\":\"US\",\"city\":\"Ney York\",\"postalCode\":\"12345\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"12345678\"}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create new contact\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/contacts',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"name\":\"John\",\"surname\":\"Doe\",\"kind\":\"personal\",\"email\":\"john@domain.com\",\"phone\":\"+1234567890\",\"country\":\"US\",\"city\":\"Ney York\",\"postalCode\":\"12345\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"12345678\"}]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Create new contact\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"name\\\":\\\"John\\\",\\\"surname\\\":\\\"Doe\\\",\\\"kind\\\":\\\"personal\\\",\\\"email\\\":\\\"john@domain.com\\\",\\\"phone\\\":\\\"+1234567890\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Ney York\\\",\\\"postalCode\\\":\\\"12345\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"12345678\\\"}]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Create new contact\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/contacts\"\n\n\tpayload := strings.NewReader(\"{\\\"name\\\":\\\"John\\\",\\\"surname\\\":\\\"Doe\\\",\\\"kind\\\":\\\"personal\\\",\\\"email\\\":\\\"john@domain.com\\\",\\\"phone\\\":\\\"+1234567890\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Ney York\\\",\\\"postalCode\\\":\\\"12345\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"12345678\\\"}]}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Create new contact\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"name\\\":\\\"John\\\",\\\"surname\\\":\\\"Doe\\\",\\\"kind\\\":\\\"personal\\\",\\\"email\\\":\\\"john@domain.com\\\",\\\"phone\\\":\\\"+1234567890\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Ney York\\\",\\\"postalCode\\\":\\\"12345\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"12345678\\\"}]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Create new contact\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"name\\\":\\\"John\\\",\\\"surname\\\":\\\"Doe\\\",\\\"kind\\\":\\\"personal\\\",\\\"email\\\":\\\"john@domain.com\\\",\\\"phone\\\":\\\"+1234567890\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Ney York\\\",\\\"postalCode\\\":\\\"12345\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"12345678\\\"}]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Create new contact\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"name\\\":\\\"John\\\",\\\"surname\\\":\\\"Doe\\\",\\\"kind\\\":\\\"personal\\\",\\\"email\\\":\\\"john@domain.com\\\",\\\"phone\\\":\\\"+1234567890\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Ney York\\\",\\\"postalCode\\\":\\\"12345\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"12345678\\\"}]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Create new contact\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"name\\\":\\\"John\\\",\\\"surname\\\":\\\"Doe\\\",\\\"kind\\\":\\\"personal\\\",\\\"email\\\":\\\"john@domain.com\\\",\\\"phone\\\":\\\"+1234567890\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Ney York\\\",\\\"postalCode\\\":\\\"12345\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"12345678\\\"}]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Create new contact\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/contacts\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"name\\\":\\\"John\\\",\\\"surname\\\":\\\"Doe\\\",\\\"kind\\\":\\\"personal\\\",\\\"email\\\":\\\"john@domain.com\\\",\\\"phone\\\":\\\"+1234567890\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Ney York\\\",\\\"postalCode\\\":\\\"12345\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"12345678\\\"}]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Create new contact\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/contacts' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"name\":\"John\",\"surname\":\"Doe\",\"kind\":\"personal\",\"email\":\"john@domain.com\",\"phone\":\"+1234567890\",\"country\":\"US\",\"city\":\"Ney York\",\"postalCode\":\"12345\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"12345678\"}]}'"},{"lang":"ObjC","source":"// Create new contact\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"name\": @\"John\",\n                              @\"surname\": @\"Doe\",\n                              @\"kind\": @\"personal\",\n                              @\"email\": @\"john@domain.com\",\n                              @\"phone\": @\"+1234567890\",\n                              @\"country\": @\"US\",\n                              @\"city\": @\"Ney York\",\n                              @\"postalCode\": @\"12345\",\n                              @\"metadata\": @[ @{ @\"key\": @\"CRM_ID\", @\"value\": @\"12345678\" } ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/contacts\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Create new contact\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"name\": \"John\",\n  \"surname\": \"Doe\",\n  \"kind\": \"personal\",\n  \"email\": \"john@domain.com\",\n  \"phone\": \"+1234567890\",\n  \"country\": \"US\",\n  \"city\": \"Ney York\",\n  \"postalCode\": \"12345\",\n  \"metadata\": [\n    [\n      \"key\": \"CRM_ID\",\n      \"value\": \"12345678\"\n    ]\n  ]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/contacts\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Bulk create contacts","description":"Bulk create contacts up to 1000 contacts at once in a single API request.\n\n\n\nThis API endpoint is useful to create multiple contacts at once, and it is more efficient than calling the `Create contact` endpoint multiple times.\n\n\n\nSimilarly to `Create contact` endpoint, each contact entry provided must have a phone numer in E164 format (e.g: +1234567890) platform internal contacts agenda of the connected WhatsApp number.\n\n\n\nContacts created from the platform API or chat are not synced with the WhatsApp connected mobile agenda, therefore contacts may be listed in the WhatsApp mobile app with their the raw phone number instead of the contact name.\n\n\n\nBy default the `upsert=true` query param is used, meaning that if the phone number is already in use by an existing contact in the specific device contacts store, the existing contact will be updated with the provided contact information. You can change this behavior using query param `upsert=false`.\n\n\n\nDepending on how many contacts you need to create, the response may take up to several seconds\n\n\n\n[Try here the API usage example to import multiple contacts](/help/api-tester?example=import-contacts)\n\n\n\n**Related tutorials**:\n\n- [Import contacts from Hubspot using the API](/help/contacts-hubspot)\n\n\n\n**Note**: by default, unless `?upsert=true` query param is defined, if the phone number is already in use by an existing contact in the specific device contacts store, the will return in the response JSON an error field with `409` - `Conflict` and the existing contact WhatsApp ID will be returned in the error response that can be later used to update the existing contact using the [Update contact endpoint](#operation/updateContact).\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fcontacts&method=PATCH&body=%5B%0A%20%20%7B%0A%20%20%20%20%22name%22%3A%20%22John%22%2C%0A%20%20%20%20%22surname%22%3A%20%22Doe%22%2C%0A%20%20%20%20%22kind%22%3A%20%22personal%22%2C%0A%20%20%20%20%22email%22%3A%20%22john%40domain.com%22%2C%0A%20%20%20%20%22phone%22%3A%20%22%2B1234567890%22%2C%0A%20%20%20%20%22country%22%3A%20%22US%22%2C%0A%20%20%20%20%22city%22%3A%20%22Ney%20York%22%2C%0A%20%20%20%20%22postalCode%22%3A%20%2212345%22%2C%0A%20%20%20%20%22metadata%22%3A%20%5B%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22key%22%3A%20%22CRM_ID%22%2C%0A%20%20%20%20%20%20%20%20%22value%22%3A%20%2212345678%22%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%5D%0A%20%20%7D%2C%0A%20%20%7B%0A%20%20%20%20%22name%22%3A%20%22Michael%22%2C%0A%20%20%20%20%22surname%22%3A%20%22Jackson%22%2C%0A%20%20%20%20%22kind%22%3A%20%22personal%22%2C%0A%20%20%20%20%22email%22%3A%20%22mike%40jackson5.com%22%2C%0A%20%20%20%20%22phone%22%3A%20%22%2B1234561234%22%2C%0A%20%20%20%20%22country%22%3A%20%22US%22%2C%0A%20%20%20%20%22city%22%3A%20%22Los%20Angeles%22%2C%0A%20%20%20%20%22postalCode%22%3A%20%2252345%22%2C%0A%20%20%20%20%22metadata%22%3A%20%5B%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22key%22%3A%20%22CRM_ID%22%2C%0A%20%20%20%20%20%20%20%20%22value%22%3A%20%225555555%22%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%5D%0A%20%20%7D%0A%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"bulkCreateContacts","security":[{"apiKey":[]}],"parameters":[{"in":"body","name":"contacts","schema":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","maxLength":30},"surname":{"type":"string","maxLength":50},"title":{"type":"string","maxLength":15},"kind":{"type":"string","enum":["personal","business"]},"gender":{"type":"string","enum":["male","female","other"]},"altPhone":{"type":"string","minLength":6,"maxLength":20,"description":"Secondary phone number in E164 compatible format. E.g: +1234567890"},"email":{"type":"string","format":"email","minLength":5,"maxLength":100},"description":{"type":"string","maxLength":100},"languages":{"type":"array","items":{"type":"string","minLength":2,"maxLength":2},"minItems":0,"maxItems":3},"companyName":{"type":"string","maxLength":50},"companyCode":{"type":"string","maxLength":50},"companyTaxId":{"type":"string","maxLength":30},"companyRole":{"type":"string","maxLength":30},"companyWebsite":{"type":"string","minLength":6,"maxLength":100},"companyEmail":{"type":"string","format":"email","minLength":5,"maxLength":100},"companyPhone":{"type":"string","minLength":2,"maxLength":18,"description":"Company phone number in E164 compatible format. E.g: +1234567890"},"companyCountry":{"type":"string","minLength":2,"maxLength":2,"description":"Company country alpha-2 ISO 3166 code. [More information](https://www.iban.com/country-codes)"},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"Currency alpha-3 ISO code. [More information](https://www.iban.com/currency-codes)"},"address":{"type":"string","maxLength":100},"city":{"type":"string","maxLength":30},"postalCode":{"type":"string","maxLength":20},"country":{"type":"string","minLength":2,"maxLength":2,"description":"Country alpha-2 ISO 3166 code. [More information](https://www.iban.com/country-codes)"},"notes":{"type":"string","minLength":0,"maxLength":3000,"description":"Internal plain text notes about this contact. Setting this field will overwrite the existing notes text."},"birthday":{"type":"string","format":"date-time"},"notifications":{"type":"string","enum":["on","mute","ignore"]},"timezone":{"type":"string","minLength":2,"maxLength":40,"description":"Contact location time zone. [List of supported values](https://bit.ly/3Ci2Ac1)"},"crm":{"type":"string","minLength":2,"maxLength":50,"description":"Optional external CRM source name. E.g: `hubspot`, `dynamics`, `zoho`, `bitrix`, `salesforce`..."},"crmRef":{"type":"string","minLength":2,"maxLength":500,"description":"Optional external CRM user reference, such as an ID, email or URL to the contact in an external CRM system."},"sync":{"type":"boolean","description":"Enable contact automatic synchronization across **all** WhatsApp numbers connected in your account. This option is disabled by default. To synchronize a contact only in specific WhatsApp numbers, use `syncNumbers` field instead.","default":false},"syncNumbers":{"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Synchronize this contact in specific WhatsApp numbers in your account by entering the the WhatsApp number IDs (24 characters hexadecimal value)."},"maxItems":30,"description":"Enable contact automatic synchronization across multiple WhatsApp numbers connected in your account. Use `all` to synchronize the contact across all connected numbers in your account, or use the target number ID (24 characters hexadecimal) to select the target numbers you want to synchronize the contact with. This option is disabled by default."},"metadata":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-zA-Z0-9_]*$","minLength":1,"maxLength":30,"description":"Metadata entry key that can only contain alphanumeric (`a-z`, `A-Z`, `0-9`), or underscore (`_`) characters."},"value":{"type":"string","minLength":0,"maxLength":300,"description":"Metadata entry value can contain any text up to 300 characters."}},"additionalProperties":false},"maxItems":30},"links":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["url","token","text"],"default":"text"},"platform":{"type":"string","minLength":30},"value":{"type":"string","minLength":2,"maxLength":200}},"additionalProperties":false},"maxItems":10},"subscription":{"type":"object","properties":{"status":{"type":"string","enum":["subscribed","active","exclude","unsubscribed"],"description":"Set subscription status for this contact"}},"additionalProperties":false,"description":"Update campaigns subscription settings for this contact"},"$remove":{},"phone":{"type":"string","minLength":6,"maxLength":20},"assign":{"type":"string","minLength":24,"maxLength":24,"description":"Optionally assign the new contact to a specific user by ID (24 hexadecimal characters). If not set, the contact's chat will remain unaassigned and as pending state. The chat can be later manually assigned to any user."}},"required":["phone"],"additionalProperties":false},"minItems":1,"maxItems":1000,"description":"Create multiple contacts in bulk mode, up to `500`."}},{"in":"query","name":"upsert","type":"boolean","default":true,"description":"If `true` and the contact already exists, the contact will be updated with the provided data. If `false` and the contact already exists, the contact creation will be skipped and the contact entry will be returned as error code `409` in the array results."}],"tags":["Chat Contacts"],"consumes":["application/json"],"produces":["application/json"],"responses":{"200":{"description":"Contacts created","schema":{"type":"array","items":{"$ref":"#/definitions/ioContact"}}},"202":{"description":"Contacts partially created and some failed","schema":{"type":"array","items":{"$ref":"#/definitions/ioContact"}}},"400":{"description":"Invalid body request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unauthorized or missing permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Maximum contacts limit reached - Upgrade plan required","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Create multiple contacts\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/contacts \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '[{\"name\":\"John\",\"surname\":\"Doe\",\"kind\":\"personal\",\"email\":\"john@domain.com\",\"phone\":\"+1234567890\",\"country\":\"US\",\"city\":\"Ney York\",\"postalCode\":\"12345\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"12345678\"}]},{\"name\":\"Michael\",\"surname\":\"Jackson\",\"kind\":\"personal\",\"email\":\"mike@jackson5.com\",\"phone\":\"+1234561234\",\"country\":\"US\",\"city\":\"Los Angeles\",\"postalCode\":\"52345\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"5555555\"}]}]'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Create multiple contacts\necho '[{\"name\":\"John\",\"surname\":\"Doe\",\"kind\":\"personal\",\"email\":\"john@domain.com\",\"phone\":\"+1234567890\",\"country\":\"US\",\"city\":\"Ney York\",\"postalCode\":\"12345\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"12345678\"}]},{\"name\":\"Michael\",\"surname\":\"Jackson\",\"kind\":\"personal\",\"email\":\"mike@jackson5.com\",\"phone\":\"+1234561234\",\"country\":\"US\",\"city\":\"Los Angeles\",\"postalCode\":\"52345\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"5555555\"}]}]' |  \\\n  http PATCH https://api.wassenger.com/v1/chat/{deviceId}/contacts \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Create multiple contacts\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/contacts';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"name\":\"John\",\"surname\":\"Doe\",\"kind\":\"personal\",\"email\":\"john@domain.com\",\"phone\":\"+1234567890\",\"country\":\"US\",\"city\":\"Ney York\",\"postalCode\":\"12345\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"12345678\"}]},{\"name\":\"Michael\",\"surname\":\"Jackson\",\"kind\":\"personal\",\"email\":\"mike@jackson5.com\",\"phone\":\"+1234561234\",\"country\":\"US\",\"city\":\"Los Angeles\",\"postalCode\":\"52345\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"5555555\"}]}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Create multiple contacts\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/contacts',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: [\n    {\n      name: 'John',\n      surname: 'Doe',\n      kind: 'personal',\n      email: 'john@domain.com',\n      phone: '+1234567890',\n      country: 'US',\n      city: 'Ney York',\n      postalCode: '12345',\n      metadata: [{key: 'CRM_ID', value: '12345678'}]\n    },\n    {\n      name: 'Michael',\n      surname: 'Jackson',\n      kind: 'personal',\n      email: 'mike@jackson5.com',\n      phone: '+1234561234',\n      country: 'US',\n      city: 'Los Angeles',\n      postalCode: '52345',\n      metadata: [{key: 'CRM_ID', value: '5555555'}]\n    }\n  ]\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Create multiple contacts\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/contacts');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send([\n  {\n    name: 'John',\n    surname: 'Doe',\n    kind: 'personal',\n    email: 'john@domain.com',\n    phone: '+1234567890',\n    country: 'US',\n    city: 'Ney York',\n    postalCode: '12345',\n    metadata: [\n      {\n        key: 'CRM_ID',\n        value: '12345678'\n      }\n    ]\n  },\n  {\n    name: 'Michael',\n    surname: 'Jackson',\n    kind: 'personal',\n    email: 'mike@jackson5.com',\n    phone: '+1234561234',\n    country: 'US',\n    city: 'Los Angeles',\n    postalCode: '52345',\n    metadata: [\n      {\n        key: 'CRM_ID',\n        value: '5555555'\n      }\n    ]\n  }\n]);\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Create multiple contacts\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/contacts', [\n  'body' => '[{\"name\":\"John\",\"surname\":\"Doe\",\"kind\":\"personal\",\"email\":\"john@domain.com\",\"phone\":\"+1234567890\",\"country\":\"US\",\"city\":\"Ney York\",\"postalCode\":\"12345\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"12345678\"}]},{\"name\":\"Michael\",\"surname\":\"Jackson\",\"kind\":\"personal\",\"email\":\"mike@jackson5.com\",\"phone\":\"+1234561234\",\"country\":\"US\",\"city\":\"Los Angeles\",\"postalCode\":\"52345\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"5555555\"}]}]',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Create multiple contacts\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  [\n    'name' => 'John',\n    'surname' => 'Doe',\n    'kind' => 'personal',\n    'email' => 'john@domain.com',\n    'phone' => '+1234567890',\n    'country' => 'US',\n    'city' => 'Ney York',\n    'postalCode' => '12345',\n    'metadata' => [\n        [\n                'key' => 'CRM_ID',\n                'value' => '12345678'\n        ]\n    ]\n  ],\n  [\n    'name' => 'Michael',\n    'surname' => 'Jackson',\n    'kind' => 'personal',\n    'email' => 'mike@jackson5.com',\n    'phone' => '+1234561234',\n    'country' => 'US',\n    'city' => 'Los Angeles',\n    'postalCode' => '52345',\n    'metadata' => [\n        [\n                'key' => 'CRM_ID',\n                'value' => '5555555'\n        ]\n    ]\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/contacts');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Create multiple contacts\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/contacts\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    [\n        'name' => 'John',\n        'surname' => 'Doe',\n        'kind' => 'personal',\n        'email' => 'john@domain.com',\n        'phone' => '+1234567890',\n        'country' => 'US',\n        'city' => 'Ney York',\n        'postalCode' => '12345',\n        'metadata' => [\n                [\n                                'key' => 'CRM_ID',\n                                'value' => '12345678'\n                ]\n        ]\n    ],\n    [\n        'name' => 'Michael',\n        'surname' => 'Jackson',\n        'kind' => 'personal',\n        'email' => 'mike@jackson5.com',\n        'phone' => '+1234561234',\n        'country' => 'US',\n        'city' => 'Los Angeles',\n        'postalCode' => '52345',\n        'metadata' => [\n                [\n                                'key' => 'CRM_ID',\n                                'value' => '5555555'\n                ]\n        ]\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Create multiple contacts\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/contacts\"\n\npayload = [\n    {\n        \"name\": \"John\",\n        \"surname\": \"Doe\",\n        \"kind\": \"personal\",\n        \"email\": \"john@domain.com\",\n        \"phone\": \"+1234567890\",\n        \"country\": \"US\",\n        \"city\": \"Ney York\",\n        \"postalCode\": \"12345\",\n        \"metadata\": [\n            {\n                \"key\": \"CRM_ID\",\n                \"value\": \"12345678\"\n            }\n        ]\n    },\n    {\n        \"name\": \"Michael\",\n        \"surname\": \"Jackson\",\n        \"kind\": \"personal\",\n        \"email\": \"mike@jackson5.com\",\n        \"phone\": \"+1234561234\",\n        \"country\": \"US\",\n        \"city\": \"Los Angeles\",\n        \"postalCode\": \"52345\",\n        \"metadata\": [\n            {\n                \"key\": \"CRM_ID\",\n                \"value\": \"5555555\"\n            }\n        ]\n    }\n]\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create multiple contacts\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/contacts';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"name\":\"John\",\"surname\":\"Doe\",\"kind\":\"personal\",\"email\":\"john@domain.com\",\"phone\":\"+1234567890\",\"country\":\"US\",\"city\":\"Ney York\",\"postalCode\":\"12345\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"12345678\"}]},{\"name\":\"Michael\",\"surname\":\"Jackson\",\"kind\":\"personal\",\"email\":\"mike@jackson5.com\",\"phone\":\"+1234561234\",\"country\":\"US\",\"city\":\"Los Angeles\",\"postalCode\":\"52345\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"5555555\"}]}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create multiple contacts\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/contacts',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '[{\"name\":\"John\",\"surname\":\"Doe\",\"kind\":\"personal\",\"email\":\"john@domain.com\",\"phone\":\"+1234567890\",\"country\":\"US\",\"city\":\"Ney York\",\"postalCode\":\"12345\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"12345678\"}]},{\"name\":\"Michael\",\"surname\":\"Jackson\",\"kind\":\"personal\",\"email\":\"mike@jackson5.com\",\"phone\":\"+1234561234\",\"country\":\"US\",\"city\":\"Los Angeles\",\"postalCode\":\"52345\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"5555555\"}]}]'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Create multiple contacts\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"[{\\\"name\\\":\\\"John\\\",\\\"surname\\\":\\\"Doe\\\",\\\"kind\\\":\\\"personal\\\",\\\"email\\\":\\\"john@domain.com\\\",\\\"phone\\\":\\\"+1234567890\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Ney York\\\",\\\"postalCode\\\":\\\"12345\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"12345678\\\"}]},{\\\"name\\\":\\\"Michael\\\",\\\"surname\\\":\\\"Jackson\\\",\\\"kind\\\":\\\"personal\\\",\\\"email\\\":\\\"mike@jackson5.com\\\",\\\"phone\\\":\\\"+1234561234\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Los Angeles\\\",\\\"postalCode\\\":\\\"52345\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"5555555\\\"}]}]\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Create multiple contacts\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/contacts\"\n\n\tpayload := strings.NewReader(\"[{\\\"name\\\":\\\"John\\\",\\\"surname\\\":\\\"Doe\\\",\\\"kind\\\":\\\"personal\\\",\\\"email\\\":\\\"john@domain.com\\\",\\\"phone\\\":\\\"+1234567890\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Ney York\\\",\\\"postalCode\\\":\\\"12345\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"12345678\\\"}]},{\\\"name\\\":\\\"Michael\\\",\\\"surname\\\":\\\"Jackson\\\",\\\"kind\\\":\\\"personal\\\",\\\"email\\\":\\\"mike@jackson5.com\\\",\\\"phone\\\":\\\"+1234561234\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Los Angeles\\\",\\\"postalCode\\\":\\\"52345\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"5555555\\\"}]}]\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Create multiple contacts\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"[{\\\"name\\\":\\\"John\\\",\\\"surname\\\":\\\"Doe\\\",\\\"kind\\\":\\\"personal\\\",\\\"email\\\":\\\"john@domain.com\\\",\\\"phone\\\":\\\"+1234567890\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Ney York\\\",\\\"postalCode\\\":\\\"12345\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"12345678\\\"}]},{\\\"name\\\":\\\"Michael\\\",\\\"surname\\\":\\\"Jackson\\\",\\\"kind\\\":\\\"personal\\\",\\\"email\\\":\\\"mike@jackson5.com\\\",\\\"phone\\\":\\\"+1234561234\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Los Angeles\\\",\\\"postalCode\\\":\\\"52345\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"5555555\\\"}]}]\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Create multiple contacts\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"[{\\\"name\\\":\\\"John\\\",\\\"surname\\\":\\\"Doe\\\",\\\"kind\\\":\\\"personal\\\",\\\"email\\\":\\\"john@domain.com\\\",\\\"phone\\\":\\\"+1234567890\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Ney York\\\",\\\"postalCode\\\":\\\"12345\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"12345678\\\"}]},{\\\"name\\\":\\\"Michael\\\",\\\"surname\\\":\\\"Jackson\\\",\\\"kind\\\":\\\"personal\\\",\\\"email\\\":\\\"mike@jackson5.com\\\",\\\"phone\\\":\\\"+1234561234\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Los Angeles\\\",\\\"postalCode\\\":\\\"52345\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"5555555\\\"}]}]\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Create multiple contacts\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"[{\\\"name\\\":\\\"John\\\",\\\"surname\\\":\\\"Doe\\\",\\\"kind\\\":\\\"personal\\\",\\\"email\\\":\\\"john@domain.com\\\",\\\"phone\\\":\\\"+1234567890\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Ney York\\\",\\\"postalCode\\\":\\\"12345\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"12345678\\\"}]},{\\\"name\\\":\\\"Michael\\\",\\\"surname\\\":\\\"Jackson\\\",\\\"kind\\\":\\\"personal\\\",\\\"email\\\":\\\"mike@jackson5.com\\\",\\\"phone\\\":\\\"+1234561234\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Los Angeles\\\",\\\"postalCode\\\":\\\"52345\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"5555555\\\"}]}]\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Create multiple contacts\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"[{\\\"name\\\":\\\"John\\\",\\\"surname\\\":\\\"Doe\\\",\\\"kind\\\":\\\"personal\\\",\\\"email\\\":\\\"john@domain.com\\\",\\\"phone\\\":\\\"+1234567890\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Ney York\\\",\\\"postalCode\\\":\\\"12345\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"12345678\\\"}]},{\\\"name\\\":\\\"Michael\\\",\\\"surname\\\":\\\"Jackson\\\",\\\"kind\\\":\\\"personal\\\",\\\"email\\\":\\\"mike@jackson5.com\\\",\\\"phone\\\":\\\"+1234561234\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Los Angeles\\\",\\\"postalCode\\\":\\\"52345\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"5555555\\\"}]}]\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/contacts\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Create multiple contacts\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/contacts\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"[{\\\"name\\\":\\\"John\\\",\\\"surname\\\":\\\"Doe\\\",\\\"kind\\\":\\\"personal\\\",\\\"email\\\":\\\"john@domain.com\\\",\\\"phone\\\":\\\"+1234567890\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Ney York\\\",\\\"postalCode\\\":\\\"12345\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"12345678\\\"}]},{\\\"name\\\":\\\"Michael\\\",\\\"surname\\\":\\\"Jackson\\\",\\\"kind\\\":\\\"personal\\\",\\\"email\\\":\\\"mike@jackson5.com\\\",\\\"phone\\\":\\\"+1234561234\\\",\\\"country\\\":\\\"US\\\",\\\"city\\\":\\\"Los Angeles\\\",\\\"postalCode\\\":\\\"52345\\\",\\\"metadata\\\":[{\\\"key\\\":\\\"CRM_ID\\\",\\\"value\\\":\\\"5555555\\\"}]}]\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Create multiple contacts\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/contacts' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '[{\"name\":\"John\",\"surname\":\"Doe\",\"kind\":\"personal\",\"email\":\"john@domain.com\",\"phone\":\"+1234567890\",\"country\":\"US\",\"city\":\"Ney York\",\"postalCode\":\"12345\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"12345678\"}]},{\"name\":\"Michael\",\"surname\":\"Jackson\",\"kind\":\"personal\",\"email\":\"mike@jackson5.com\",\"phone\":\"+1234561234\",\"country\":\"US\",\"city\":\"Los Angeles\",\"postalCode\":\"52345\",\"metadata\":[{\"key\":\"CRM_ID\",\"value\":\"5555555\"}]}]'"},{"lang":"ObjC","source":"// Create multiple contacts\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @[ @{ @\"name\": @\"John\", @\"surname\": @\"Doe\", @\"kind\": @\"personal\", @\"email\": @\"john@domain.com\", @\"phone\": @\"+1234567890\", @\"country\": @\"US\", @\"city\": @\"Ney York\", @\"postalCode\": @\"12345\", @\"metadata\": @[ @{ @\"key\": @\"CRM_ID\", @\"value\": @\"12345678\" } ] },\n                              @{ @\"name\": @\"Michael\", @\"surname\": @\"Jackson\", @\"kind\": @\"personal\", @\"email\": @\"mike@jackson5.com\", @\"phone\": @\"+1234561234\", @\"country\": @\"US\", @\"city\": @\"Los Angeles\", @\"postalCode\": @\"52345\", @\"metadata\": @[ @{ @\"key\": @\"CRM_ID\", @\"value\": @\"5555555\" } ] } ];\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/contacts\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Create multiple contacts\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  [\n    \"name\": \"John\",\n    \"surname\": \"Doe\",\n    \"kind\": \"personal\",\n    \"email\": \"john@domain.com\",\n    \"phone\": \"+1234567890\",\n    \"country\": \"US\",\n    \"city\": \"Ney York\",\n    \"postalCode\": \"12345\",\n    \"metadata\": [\n      [\n        \"key\": \"CRM_ID\",\n        \"value\": \"12345678\"\n      ]\n    ]\n  ],\n  [\n    \"name\": \"Michael\",\n    \"surname\": \"Jackson\",\n    \"kind\": \"personal\",\n    \"email\": \"mike@jackson5.com\",\n    \"phone\": \"+1234561234\",\n    \"country\": \"US\",\n    \"city\": \"Los Angeles\",\n    \"postalCode\": \"52345\",\n    \"metadata\": [\n      [\n        \"key\": \"CRM_ID\",\n        \"value\": \"5555555\"\n      ]\n    ]\n  ]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/contacts\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/chats/{chatWid}/unread":{"parameters":[],"patch":{"summary":"Mark chat as read/unread","description":"Update a specific chat status as `unread` or `read`.\n\n\n\n**Note**: when a chat is manually updated a `unread`, even when it has no unread messages, it will be required to manually update it again as `read` via API or web chat interface, or send a new outbound message in order to flag set it as a read chat.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fchats%2F%7BchatWid%7D%2Funread&method=PATCH&body=%7B%0A%20%20%22unread%22%3A%20true%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateChatReadStatus","security":[{"apiKey":[]}],"tags":["Chats"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"status","schema":{"type":"object","properties":{"unread":{"type":"boolean","description":"Use `true` in order to mark the chat as unread. Use `false` to mark the chat as read."}},"additionalProperties":false}}],"responses":{"200":{"description":"Updated chat","schema":{"type":"object","items":{"$ref":"#/definitions/ioChat"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Mark chat as unread\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"unread\":true}'\n\n\n// Mark chat as read\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"unread\":false}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Mark chat as unread\necho '{\"unread\":true}' |  \\\n  http PATCH https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Mark chat as read\necho '{\"unread\":false}' |  \\\n  http PATCH https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Mark chat as unread\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"unread\":true}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Mark chat as read\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"unread\":false}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Mark chat as unread\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {unread: true}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Mark chat as read\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {unread: false}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Mark chat as unread\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  unread: true\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Mark chat as read\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  unread: false\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Mark chat as unread\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread', [\n  'body' => '{\"unread\":true}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Mark chat as read\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread', [\n  'body' => '{\"unread\":false}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Mark chat as unread\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'unread' => null\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Mark chat as read\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'unread' => null\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Mark chat as unread\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'unread' => null\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Mark chat as read\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'unread' => null\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Mark chat as unread\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread\"\n\npayload = { \"unread\": True }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Mark chat as read\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread\"\n\npayload = { \"unread\": False }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Mark chat as unread\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"unread\":true}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Mark chat as read\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"unread\":false}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Mark chat as unread\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"unread\":true}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Mark chat as read\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"unread\":false}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Mark chat as unread\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"unread\\\":true}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Mark chat as read\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"unread\\\":false}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Mark chat as unread\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread\"\n\n\tpayload := strings.NewReader(\"{\\\"unread\\\":true}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Mark chat as read\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread\"\n\n\tpayload := strings.NewReader(\"{\\\"unread\\\":false}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Mark chat as unread\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"unread\\\":true}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Mark chat as read\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"unread\\\":false}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Mark chat as unread\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"unread\\\":true}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Mark chat as read\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"unread\\\":false}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Mark chat as unread\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"unread\\\":true}\")\n  .asString();\n\n\n// Mark chat as read\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"unread\\\":false}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Mark chat as unread\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"unread\\\":true}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Mark chat as read\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"unread\\\":false}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Mark chat as unread\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"unread\\\":true}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Mark chat as read\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"unread\\\":false}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Mark chat as unread\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"unread\":true}'\n\n\n# Mark chat as read\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"unread\":false}'"},{"lang":"ObjC","source":"// Mark chat as unread\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"unread\": @YES };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Mark chat as read\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"unread\": @NO };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Mark chat as unread\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"unread\": true] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Mark chat as read\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"unread\": false] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/unread\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/chats/{chatWid}/sync":{"parameters":[],"get":{"summary":"Sync chat messages","description":"Synchronizes and returns most recent messages of a specific chat.\n\n\n\n**Imporant notes**:\n\n\n\n- This operation requres the device's session to be online, otherwise it will return an error.\n\n- In some situations, depending on the size/page of messages to synchronize, the server may take up to 90 seconds to provide a response, hence please consider increasing the network timeout in your HTTP client code.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fchats%2F%7BchatWid%7D%2Fsync&params=%5B%7B%22key%22%3A%22size%22%2C%22value%22%3A200%7D%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"syncDeviceChatMessages","security":[{"apiKey":[]}],"tags":["Chats"],"produces":["application/json"],"parameters":[{"in":"query","name":"size","description":"Maximum recent messages to sync in the chat.","type":"number","format":"integer","default":50,"minimum":50,"maximum":500},{"in":"query","name":"page","description":"Most recent messages to skip. Useful for results pagination.","type":"number","format":"integer","default":0,"minimum":0,"maximum":10}],"responses":{"200":{"description":"Messages","schema":{"type":"array","items":{"$ref":"#/definitions/ioMessage"}}},"400":{"description":"Bad request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation not available","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Sync most recent 200 messages per chat\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=200' \\\n  --header 'Token: <api token goes here>'\n\n\n// Sync most recent 1000 messages per chat\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=1000' \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Sync most recent 200 messages per chat\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=200' \\\n  Token:'<api token goes here>'\n\n\n// Sync most recent 1000 messages per chat\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=1000' \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Sync most recent 200 messages per chat\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=200';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Sync most recent 1000 messages per chat\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=1000';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Sync most recent 200 messages per chat\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync',\n  params: {size: '200'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Sync most recent 1000 messages per chat\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync',\n  params: {size: '1000'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Sync most recent 200 messages per chat\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync');\n\nreq.query({\n  size: '200'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Sync most recent 1000 messages per chat\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync');\n\nreq.query({\n  size: '1000'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Sync most recent 200 messages per chat\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=200', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Sync most recent 1000 messages per chat\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=1000', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Sync most recent 200 messages per chat\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'size' => '200'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Sync most recent 1000 messages per chat\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'size' => '1000'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Sync most recent 200 messages per chat\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=200\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Sync most recent 1000 messages per chat\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=1000\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Sync most recent 200 messages per chat\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync\"\n\nquerystring = {\"size\":\"200\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Sync most recent 1000 messages per chat\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync\"\n\nquerystring = {\"size\":\"1000\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Sync most recent 200 messages per chat\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=200';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Sync most recent 1000 messages per chat\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=1000';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Sync most recent 200 messages per chat\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=200',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Sync most recent 1000 messages per chat\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=1000',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Sync most recent 200 messages per chat\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=200\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Sync most recent 1000 messages per chat\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=1000\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Sync most recent 200 messages per chat\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=200\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Sync most recent 1000 messages per chat\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=1000\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Sync most recent 200 messages per chat\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=200\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Sync most recent 1000 messages per chat\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=1000\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Sync most recent 200 messages per chat\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=200\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Sync most recent 1000 messages per chat\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=1000\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Sync most recent 200 messages per chat\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=200\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Sync most recent 1000 messages per chat\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=1000\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Sync most recent 200 messages per chat\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=200\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Sync most recent 1000 messages per chat\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=1000\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Sync most recent 200 messages per chat\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=200\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Sync most recent 1000 messages per chat\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=1000\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Sync most recent 200 messages per chat\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=200' -Method GET -Headers $headers\n\n\n# Sync most recent 1000 messages per chat\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=1000' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Sync most recent 200 messages per chat\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=200\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Sync most recent 1000 messages per chat\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=1000\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Sync most recent 200 messages per chat\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=200\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Sync most recent 1000 messages per chat\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/sync?size=1000\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/chats/{chatWid}/status":{"parameters":[],"patch":{"summary":"Update chat status","description":"Update chat internal status as active, pending or resolved\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fchats%2F%7BchatWid%7D%2Fstatus&method=PATCH&body=%7B%0A%20%20%22status%22%3A%20%22resolved%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"setChatStatus","security":[{"apiKey":[]}],"tags":["Chats"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"status","schema":{"type":"object","properties":{"status":{"type":"string","enum":["removed","archived","pending","active","resolved"],"description":"Chat internal status"}},"required":["status"],"additionalProperties":false}}],"responses":{"200":{"description":"Updated chat","schema":{"type":"object","items":{"$ref":"#/definitions/ioChat"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Set chat status as resolved\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"status\":\"resolved\"}'\n\n\n// Set chat status as pending\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"status\":\"pending\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Set chat status as resolved\necho '{\"status\":\"resolved\"}' |  \\\n  http PATCH https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Set chat status as pending\necho '{\"status\":\"pending\"}' |  \\\n  http PATCH https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Set chat status as resolved\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"status\":\"resolved\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Set chat status as pending\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"status\":\"pending\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Set chat status as resolved\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {status: 'resolved'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Set chat status as pending\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {status: 'pending'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Set chat status as resolved\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  status: 'resolved'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Set chat status as pending\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  status: 'pending'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Set chat status as resolved\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status', [\n  'body' => '{\"status\":\"resolved\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Set chat status as pending\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status', [\n  'body' => '{\"status\":\"pending\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Set chat status as resolved\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'status' => 'resolved'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Set chat status as pending\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'status' => 'pending'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Set chat status as resolved\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'status' => 'resolved'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Set chat status as pending\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'status' => 'pending'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Set chat status as resolved\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status\"\n\npayload = { \"status\": \"resolved\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Set chat status as pending\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status\"\n\npayload = { \"status\": \"pending\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Set chat status as resolved\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"status\":\"resolved\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Set chat status as pending\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"status\":\"pending\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Set chat status as resolved\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"status\":\"resolved\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Set chat status as pending\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"status\":\"pending\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Set chat status as resolved\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"status\\\":\\\"resolved\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Set chat status as pending\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"status\\\":\\\"pending\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Set chat status as resolved\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status\"\n\n\tpayload := strings.NewReader(\"{\\\"status\\\":\\\"resolved\\\"}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Set chat status as pending\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status\"\n\n\tpayload := strings.NewReader(\"{\\\"status\\\":\\\"pending\\\"}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Set chat status as resolved\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"status\\\":\\\"resolved\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Set chat status as pending\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"status\\\":\\\"pending\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Set chat status as resolved\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"status\\\":\\\"resolved\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Set chat status as pending\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"status\\\":\\\"pending\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Set chat status as resolved\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"status\\\":\\\"resolved\\\"}\")\n  .asString();\n\n\n// Set chat status as pending\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"status\\\":\\\"pending\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Set chat status as resolved\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"status\\\":\\\"resolved\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Set chat status as pending\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"status\\\":\\\"pending\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Set chat status as resolved\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"status\\\":\\\"resolved\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Set chat status as pending\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"status\\\":\\\"pending\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Set chat status as resolved\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"status\":\"resolved\"}'\n\n\n# Set chat status as pending\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"status\":\"pending\"}'"},{"lang":"ObjC","source":"// Set chat status as resolved\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"status\": @\"resolved\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Set chat status as pending\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"status\": @\"pending\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Set chat status as resolved\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"status\": \"resolved\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Set chat status as pending\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"status\": \"pending\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/status\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/chats/{chatWid}/participants":{"parameters":[],"get":{"summary":"Get group participants","description":"Get group chat participants, optionally filtering results by name, phone number, role, or contact status.\n\n\n\nIf the target chat WhatsApp ID is not a group, the API will return a `400 Bad Request` error.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fchats%2F%7BchatWid%7D%2Fparticipants)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getGroupParticipants","security":[{"apiKey":[]}],"tags":["Chats"],"produces":["application/json"],"parameters":[{"in":"query","name":"search","type":"string","maxLength":100,"description":"Filter participants by name, phone number, WhatsApp ID"},{"in":"query","name":"phone","type":"array","collectionFormat":"csv","description":"Filter participants by phone number. Multiple values allowed separated by commas.","minimum":1,"maximum":50,"items":{"type":"string","minLength":10,"maxLength":18}},{"in":"query","name":"role","type":"array","collectionFormat":"csv","description":"Filter participants by role: `admin`, `owner` or `participant`. Multiple values allowed separated by commas.","minimum":1,"maximum":3,"items":{"type":"string","enum":["owner","admin","participant"]}},{"in":"query","name":"contact","type":"boolean","description":"Filter only participants that are contacts in the WhatsApp agenda"},{"in":"query","name":"include","type":"array","collectionFormat":"csv","description":"Include participant contact information, if available.","minimum":1,"maximum":1,"items":{"type":"string","enum":["contact"]}},{"in":"query","name":"page","description":"Results page number (starting from 0)","type":"number","format":"integer","default":0,"minimum":0,"maximum":500},{"in":"query","name":"size","description":"Maximum results per page","type":"number","format":"integer","default":100,"minimum":1,"maximum":500}],"responses":{"200":{"description":"Group participants","schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Participant WhatsApp ID"},"phone":{"type":"string","description":"Participant phone number in E164 format"},"name":{"type":"string","description":"Participant contact name or public WhatsApp profile name, if available"},"isSuperAdmin":{"type":"boolean","description":"Participant is the group owner"},"isAdmin":{"type":"boolean","description":"Participant is a group admin"},"isContact":{"type":"boolean","description":"Participant is an existing contact in the agenda"}}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get group participants\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"size\":100,\"page\":0}'\n\n\n// Get group participants by phone number\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"phone\":\"+1234567890,+1298765431\"}'\n\n\n// Search group participants by name\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"search\":\"john\"}'\n\n\n// Filter group participants by role\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"role\":\"owner,admin\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get group participants\necho '{\"size\":100,\"page\":0}' |  \\\n  http GET https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Get group participants by phone number\necho '{\"phone\":\"+1234567890,+1298765431\"}' |  \\\n  http GET https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Search group participants by name\necho '{\"search\":\"john\"}' |  \\\n  http GET https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Filter group participants by role\necho '{\"role\":\"owner,admin\"}' |  \\\n  http GET https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get group participants\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants';\nconst options = {\n  method: 'GET',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"size\":100,\"page\":0}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get group participants by phone number\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants';\nconst options = {\n  method: 'GET',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phone\":\"+1234567890,+1298765431\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Search group participants by name\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants';\nconst options = {\n  method: 'GET',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"search\":\"john\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Filter group participants by role\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants';\nconst options = {\n  method: 'GET',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"role\":\"owner,admin\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get group participants\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {size: 100, page: 0}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get group participants by phone number\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {phone: '+1234567890,+1298765431'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Search group participants by name\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {search: 'john'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Filter group participants by role\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {role: 'owner,admin'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get group participants\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  size: 100,\n  page: 0\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get group participants by phone number\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  phone: '+1234567890,+1298765431'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Search group participants by name\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  search: 'john'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Filter group participants by role\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  role: 'owner,admin'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get group participants\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants', [\n  'body' => '{\"size\":100,\"page\":0}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get group participants by phone number\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants', [\n  'body' => '{\"phone\":\"+1234567890,+1298765431\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Search group participants by name\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants', [\n  'body' => '{\"search\":\"john\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Filter group participants by role\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants', [\n  'body' => '{\"role\":\"owner,admin\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get group participants\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'size' => 100,\n  'page' => 0\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants');\n$request->setRequestMethod('GET');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get group participants by phone number\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'phone' => '+1234567890,+1298765431'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants');\n$request->setRequestMethod('GET');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Search group participants by name\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'search' => 'john'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants');\n$request->setRequestMethod('GET');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Filter group participants by role\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'role' => 'owner,admin'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants');\n$request->setRequestMethod('GET');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get group participants\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'size' => 100,\n    'page' => 0\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get group participants by phone number\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'phone' => '+1234567890,+1298765431'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Search group participants by name\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'search' => 'john'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Filter group participants by role\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'role' => 'owner,admin'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get group participants\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\"\n\npayload = {\n    \"size\": 100,\n    \"page\": 0\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.get(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Get group participants by phone number\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\"\n\npayload = { \"phone\": \"+1234567890,+1298765431\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.get(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Search group participants by name\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\"\n\npayload = { \"search\": \"john\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.get(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Filter group participants by role\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\"\n\npayload = { \"role\": \"owner,admin\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.get(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get group participants\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants';\nconst options = {\n  method: 'GET',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"size\":100,\"page\":0}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get group participants by phone number\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants';\nconst options = {\n  method: 'GET',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phone\":\"+1234567890,+1298765431\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Search group participants by name\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants';\nconst options = {\n  method: 'GET',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"search\":\"john\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Filter group participants by role\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants';\nconst options = {\n  method: 'GET',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"role\":\"owner,admin\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get group participants\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants',\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"size\":100,\"page\":0}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get group participants by phone number\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants',\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"phone\":\"+1234567890,+1298765431\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Search group participants by name\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants',\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"search\":\"john\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Filter group participants by role\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants',\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"role\":\"owner,admin\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get group participants\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"size\\\":100,\\\"page\\\":0}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get group participants by phone number\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"phone\\\":\\\"+1234567890,+1298765431\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Search group participants by name\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"search\\\":\\\"john\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Filter group participants by role\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"role\\\":\\\"owner,admin\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get group participants\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\"\n\n\tpayload := strings.NewReader(\"{\\\"size\\\":100,\\\"page\\\":0}\")\n\n\treq, _ := http.NewRequest(\"GET\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get group participants by phone number\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\"\n\n\tpayload := strings.NewReader(\"{\\\"phone\\\":\\\"+1234567890,+1298765431\\\"}\")\n\n\treq, _ := http.NewRequest(\"GET\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Search group participants by name\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\"\n\n\tpayload := strings.NewReader(\"{\\\"search\\\":\\\"john\\\"}\")\n\n\treq, _ := http.NewRequest(\"GET\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Filter group participants by role\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\"\n\n\tpayload := strings.NewReader(\"{\\\"role\\\":\\\"owner,admin\\\"}\")\n\n\treq, _ := http.NewRequest(\"GET\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get group participants\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"size\\\":100,\\\"page\\\":0}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Get group participants by phone number\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"phone\\\":\\\"+1234567890,+1298765431\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Search group participants by name\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"search\\\":\\\"john\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Filter group participants by role\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"role\\\":\\\"owner,admin\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get group participants\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"size\\\":100,\\\"page\\\":0}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get group participants by phone number\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"phone\\\":\\\"+1234567890,+1298765431\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Search group participants by name\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"search\\\":\\\"john\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Filter group participants by role\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"role\\\":\\\"owner,admin\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get group participants\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"size\\\":100,\\\"page\\\":0}\")\n  .asString();\n\n\n// Get group participants by phone number\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"phone\\\":\\\"+1234567890,+1298765431\\\"}\")\n  .asString();\n\n\n// Search group participants by name\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"search\\\":\\\"john\\\"}\")\n  .asString();\n\n\n// Filter group participants by role\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"role\\\":\\\"owner,admin\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get group participants\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"size\\\":100,\\\"page\\\":0}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\")\n  .get()\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get group participants by phone number\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"phone\\\":\\\"+1234567890,+1298765431\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\")\n  .get()\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Search group participants by name\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"search\\\":\\\"john\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\")\n  .get()\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Filter group participants by role\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"role\\\":\\\"owner,admin\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\")\n  .get()\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get group participants\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"size\\\":100,\\\"page\\\":0}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get group participants by phone number\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"phone\\\":\\\"+1234567890,+1298765431\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Search group participants by name\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"search\\\":\\\"john\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Filter group participants by role\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"role\\\":\\\"owner,admin\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get group participants\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants' -Method GET -Headers $headers -ContentType 'application/json' -Body '{\"size\":100,\"page\":0}'\n\n\n# Get group participants by phone number\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants' -Method GET -Headers $headers -ContentType 'application/json' -Body '{\"phone\":\"+1234567890,+1298765431\"}'\n\n\n# Search group participants by name\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants' -Method GET -Headers $headers -ContentType 'application/json' -Body '{\"search\":\"john\"}'\n\n\n# Filter group participants by role\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants' -Method GET -Headers $headers -ContentType 'application/json' -Body '{\"role\":\"owner,admin\"}'"},{"lang":"ObjC","source":"// Get group participants\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"size\": @100,\n                              @\"page\": @0 };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get group participants by phone number\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"phone\": @\"+1234567890,+1298765431\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Search group participants by name\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"search\": @\"john\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Filter group participants by role\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"role\": @\"owner,admin\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get group participants\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"size\": 100,\n  \"page\": 0\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get group participants by phone number\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"phone\": \"+1234567890,+1298765431\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Search group participants by name\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"search\": \"john\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Filter group participants by role\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"role\": \"owner,admin\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/participants\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/chats/{chatWid}/owner":{"parameters":[],"patch":{"summary":"Assign chat","description":"Assign or re-assign chat to an team member by user ID or email, to a department, or both.\n\n\n\nWhen a chat is assigned, it will transition from `pending` status to `active` automatically.\n\n\n\n> **Note**: team departments is a limited feature only available in the Business and Enterprise plans, otherwise the API will return an error.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fchats%2F%7BchatWid%7D%2Fowner&method=PATCH&body=%7B%0A%20%20%22agent%22%3A%20%225f70af51009f418374e390d2%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"assignChatAgent","security":[{"apiKey":[]}],"tags":["Chats"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"assign","schema":{"type":"object","properties":{"agent":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Agent user ID to assign the chat to. Required if `email` and `department` fields are not present."},"email":{"type":"string","format":"email","minLength":5,"maxLength":100,"description":"Agent user email to assign the chat to. Required if `agent` and `department` fields are not present."},"department":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Department ID to assign the chat to. Required if `agent` and `email` fields are not present."}},"additionalProperties":false}}],"responses":{"200":{"description":"Chat assigned successfully","schema":{"type":"object","items":{"$ref":"#/definitions/ioChat"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Assign chat to an agent by ID\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"agent\":\"5f70af51009f418374e390d2\"}'\n\n\n// Assign chat to an agent by email\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"email\":\"agent@company.com\"}'\n\n\n// Assign chat to a department by ID\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"department\":\"{DEPARTMENT_ID}\"}'\n\n\n// Assign chat to a department and agent by ID\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"department\":\"{DEPARTMENT_ID}\",\"agent\":\"{AGENT_ID}\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Assign chat to an agent by ID\necho '{\"agent\":\"5f70af51009f418374e390d2\"}' |  \\\n  http PATCH https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Assign chat to an agent by email\necho '{\"email\":\"agent@company.com\"}' |  \\\n  http PATCH https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Assign chat to a department by ID\necho '{\"department\":\"{DEPARTMENT_ID}\"}' |  \\\n  http PATCH https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Assign chat to a department and agent by ID\necho '{\"department\":\"{DEPARTMENT_ID}\",\"agent\":\"{AGENT_ID}\"}' |  \\\n  http PATCH https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Assign chat to an agent by ID\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"agent\":\"5f70af51009f418374e390d2\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Assign chat to an agent by email\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"email\":\"agent@company.com\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Assign chat to a department by ID\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"department\":\"{DEPARTMENT_ID}\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Assign chat to a department and agent by ID\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"department\":\"{DEPARTMENT_ID}\",\"agent\":\"{AGENT_ID}\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Assign chat to an agent by ID\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {agent: '5f70af51009f418374e390d2'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Assign chat to an agent by email\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {email: 'agent@company.com'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Assign chat to a department by ID\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {department: '{DEPARTMENT_ID}'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Assign chat to a department and agent by ID\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {department: '{DEPARTMENT_ID}', agent: '{AGENT_ID}'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Assign chat to an agent by ID\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  agent: '5f70af51009f418374e390d2'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Assign chat to an agent by email\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  email: 'agent@company.com'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Assign chat to a department by ID\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  department: '{DEPARTMENT_ID}'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Assign chat to a department and agent by ID\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  department: '{DEPARTMENT_ID}',\n  agent: '{AGENT_ID}'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Assign chat to an agent by ID\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner', [\n  'body' => '{\"agent\":\"5f70af51009f418374e390d2\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Assign chat to an agent by email\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner', [\n  'body' => '{\"email\":\"agent@company.com\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Assign chat to a department by ID\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner', [\n  'body' => '{\"department\":\"{DEPARTMENT_ID}\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Assign chat to a department and agent by ID\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner', [\n  'body' => '{\"department\":\"{DEPARTMENT_ID}\",\"agent\":\"{AGENT_ID}\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Assign chat to an agent by ID\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'agent' => '5f70af51009f418374e390d2'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Assign chat to an agent by email\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'email' => 'agent@company.com'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Assign chat to a department by ID\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'department' => '{DEPARTMENT_ID}'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Assign chat to a department and agent by ID\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'department' => '{DEPARTMENT_ID}',\n  'agent' => '{AGENT_ID}'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Assign chat to an agent by ID\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'agent' => '5f70af51009f418374e390d2'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Assign chat to an agent by email\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'email' => 'agent@company.com'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Assign chat to a department by ID\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'department' => '{DEPARTMENT_ID}'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Assign chat to a department and agent by ID\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'department' => '{DEPARTMENT_ID}',\n    'agent' => '{AGENT_ID}'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Assign chat to an agent by ID\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\"\n\npayload = { \"agent\": \"5f70af51009f418374e390d2\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Assign chat to an agent by email\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\"\n\npayload = { \"email\": \"agent@company.com\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Assign chat to a department by ID\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\"\n\npayload = { \"department\": \"{DEPARTMENT_ID}\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Assign chat to a department and agent by ID\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\"\n\npayload = {\n    \"department\": \"{DEPARTMENT_ID}\",\n    \"agent\": \"{AGENT_ID}\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Assign chat to an agent by ID\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"agent\":\"5f70af51009f418374e390d2\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Assign chat to an agent by email\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"email\":\"agent@company.com\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Assign chat to a department by ID\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"department\":\"{DEPARTMENT_ID}\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Assign chat to a department and agent by ID\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"department\":\"{DEPARTMENT_ID}\",\"agent\":\"{AGENT_ID}\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Assign chat to an agent by ID\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"agent\":\"5f70af51009f418374e390d2\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Assign chat to an agent by email\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"email\":\"agent@company.com\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Assign chat to a department by ID\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"department\":\"{DEPARTMENT_ID}\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Assign chat to a department and agent by ID\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"department\":\"{DEPARTMENT_ID}\",\"agent\":\"{AGENT_ID}\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Assign chat to an agent by ID\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"agent\\\":\\\"5f70af51009f418374e390d2\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Assign chat to an agent by email\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"email\\\":\\\"agent@company.com\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Assign chat to a department by ID\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"department\\\":\\\"{DEPARTMENT_ID}\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Assign chat to a department and agent by ID\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"department\\\":\\\"{DEPARTMENT_ID}\\\",\\\"agent\\\":\\\"{AGENT_ID}\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Assign chat to an agent by ID\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\"\n\n\tpayload := strings.NewReader(\"{\\\"agent\\\":\\\"5f70af51009f418374e390d2\\\"}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Assign chat to an agent by email\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\"\n\n\tpayload := strings.NewReader(\"{\\\"email\\\":\\\"agent@company.com\\\"}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Assign chat to a department by ID\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\"\n\n\tpayload := strings.NewReader(\"{\\\"department\\\":\\\"{DEPARTMENT_ID}\\\"}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Assign chat to a department and agent by ID\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\"\n\n\tpayload := strings.NewReader(\"{\\\"department\\\":\\\"{DEPARTMENT_ID}\\\",\\\"agent\\\":\\\"{AGENT_ID}\\\"}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Assign chat to an agent by ID\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"agent\\\":\\\"5f70af51009f418374e390d2\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Assign chat to an agent by email\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"email\\\":\\\"agent@company.com\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Assign chat to a department by ID\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"department\\\":\\\"{DEPARTMENT_ID}\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Assign chat to a department and agent by ID\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"department\\\":\\\"{DEPARTMENT_ID}\\\",\\\"agent\\\":\\\"{AGENT_ID}\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Assign chat to an agent by ID\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"agent\\\":\\\"5f70af51009f418374e390d2\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Assign chat to an agent by email\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"email\\\":\\\"agent@company.com\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Assign chat to a department by ID\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"department\\\":\\\"{DEPARTMENT_ID}\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Assign chat to a department and agent by ID\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"department\\\":\\\"{DEPARTMENT_ID}\\\",\\\"agent\\\":\\\"{AGENT_ID}\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Assign chat to an agent by ID\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"agent\\\":\\\"5f70af51009f418374e390d2\\\"}\")\n  .asString();\n\n\n// Assign chat to an agent by email\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"email\\\":\\\"agent@company.com\\\"}\")\n  .asString();\n\n\n// Assign chat to a department by ID\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"department\\\":\\\"{DEPARTMENT_ID}\\\"}\")\n  .asString();\n\n\n// Assign chat to a department and agent by ID\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"department\\\":\\\"{DEPARTMENT_ID}\\\",\\\"agent\\\":\\\"{AGENT_ID}\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Assign chat to an agent by ID\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"agent\\\":\\\"5f70af51009f418374e390d2\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Assign chat to an agent by email\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"email\\\":\\\"agent@company.com\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Assign chat to a department by ID\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"department\\\":\\\"{DEPARTMENT_ID}\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Assign chat to a department and agent by ID\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"department\\\":\\\"{DEPARTMENT_ID}\\\",\\\"agent\\\":\\\"{AGENT_ID}\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Assign chat to an agent by ID\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"agent\\\":\\\"5f70af51009f418374e390d2\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Assign chat to an agent by email\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"email\\\":\\\"agent@company.com\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Assign chat to a department by ID\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"department\\\":\\\"{DEPARTMENT_ID}\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Assign chat to a department and agent by ID\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"department\\\":\\\"{DEPARTMENT_ID}\\\",\\\"agent\\\":\\\"{AGENT_ID}\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Assign chat to an agent by ID\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"agent\":\"5f70af51009f418374e390d2\"}'\n\n\n# Assign chat to an agent by email\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"email\":\"agent@company.com\"}'\n\n\n# Assign chat to a department by ID\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"department\":\"{DEPARTMENT_ID}\"}'\n\n\n# Assign chat to a department and agent by ID\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"department\":\"{DEPARTMENT_ID}\",\"agent\":\"{AGENT_ID}\"}'"},{"lang":"ObjC","source":"// Assign chat to an agent by ID\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"agent\": @\"5f70af51009f418374e390d2\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Assign chat to an agent by email\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"email\": @\"agent@company.com\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Assign chat to a department by ID\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"department\": @\"{DEPARTMENT_ID}\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Assign chat to a department and agent by ID\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"department\": @\"{DEPARTMENT_ID}\",\n                              @\"agent\": @\"{AGENT_ID}\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Assign chat to an agent by ID\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"agent\": \"5f70af51009f418374e390d2\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Assign chat to an agent by email\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"email\": \"agent@company.com\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Assign chat to a department by ID\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"department\": \"{DEPARTMENT_ID}\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Assign chat to a department and agent by ID\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"department\": \"{DEPARTMENT_ID}\",\n  \"agent\": \"{AGENT_ID}\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Unassign chat","description":"Unassign chat from current team member, department or both.\n\n\n\nWhen a chat is was assigned to a department, it will be unassigned from the department as well.\n\n\n\nWhen a chat is unassigned, it will transition back from `active` to `pending` status, \n\nrequering manual resolution or re-assignment in order to change the update back to `resolved` or `active` respectively.\n\n\n\n> **Note**: team departments is a limited feature only available in the Business and Enterprise plans, otherwise the API will return an error.","operationId":"unassignChatAgent","security":[{"apiKey":[]}],"tags":["Chats"],"produces":["application/json"],"consumes":["application/json"],"parameters":[],"responses":{"200":{"description":"Chat assigned","schema":{"type":"object","items":{"$ref":"#/definitions/ioChat"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Unassign chat from active agent\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Unassign chat from active agent\nhttp DELETE https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Unassign chat from active agent\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Unassign chat from active agent\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Unassign chat from active agent\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Unassign chat from active agent\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Unassign chat from active agent\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner');\n$request->setRequestMethod('DELETE');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Unassign chat from active agent\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Unassign chat from active agent\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.delete(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Unassign chat from active agent\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Unassign chat from active agent\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner',\n  method: 'DELETE',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Unassign chat from active agent\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Unassign chat from active agent\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Unassign chat from active agent\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Unassign chat from active agent\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Unassign chat from active agent\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Unassign chat from active agent\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\")\n  .delete(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Unassign chat from active agent\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Unassign chat from active agent\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner' -Method DELETE -Headers $headers"},{"lang":"ObjC","source":"// Unassign chat from active agent\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Unassign chat from active agent\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/owner\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/chats/{chatWid}/notes":{"parameters":[],"post":{"summary":"Create note","description":"Create new chat internal note only visible to chat agents, supervisors and administrators.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fchats%2F%7BchatWid%7D%2Fnotes&method=POST&body=%7B%0A%20%20%22message%22%3A%20%22This%20is%20an%20internal%20note%20within%20a%20chat%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"createChatNote","security":[{"apiKey":[]}],"tags":["Chats"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"note","schema":{"type":"object","properties":{"message":{"type":"string","minLength":2,"maxLength":6000,"description":"Private note message. [WhatsApp rich text syntax](/help/text-format) allowed."},"quote":{"type":"string","pattern":"[0-9a-f]","minLength":20,"maxLength":32,"description":"Optional message or note ID to quote"},"author":{"type":"string","pattern":"[0-9a-f]","maxLength":24,"minLength":24,"description":"Optional author user ID that creates the note. **Note**: the user must have access to the specific WhatsApp number in the platform."}},"required":["message"],"additionalProperties":false}}],"responses":{"200":{"description":"Created note","schema":{"type":"object","items":{"$ref":"#/definitions/ioChat"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Create new chat internal note\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"message\":\"This is an internal note within a chat\"}'\n\n\n// Create new chat internal note as another user\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"message\":\"This is an internal note within a chat\",\"author\":\"{{USER_ID}}\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Create new chat internal note\necho '{\"message\":\"This is an internal note within a chat\"}' |  \\\n  http POST https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Create new chat internal note as another user\necho '{\"message\":\"This is an internal note within a chat\",\"author\":\"{{USER_ID}}\"}' |  \\\n  http POST https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Create new chat internal note\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"message\":\"This is an internal note within a chat\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Create new chat internal note as another user\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"message\":\"This is an internal note within a chat\",\"author\":\"{{USER_ID}}\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Create new chat internal note\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {message: 'This is an internal note within a chat'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Create new chat internal note as another user\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {message: 'This is an internal note within a chat', author: '{{USER_ID}}'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Create new chat internal note\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  message: 'This is an internal note within a chat'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Create new chat internal note as another user\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  message: 'This is an internal note within a chat',\n  author: '{{USER_ID}}'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Create new chat internal note\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes', [\n  'body' => '{\"message\":\"This is an internal note within a chat\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Create new chat internal note as another user\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes', [\n  'body' => '{\"message\":\"This is an internal note within a chat\",\"author\":\"{{USER_ID}}\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Create new chat internal note\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'message' => 'This is an internal note within a chat'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Create new chat internal note as another user\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'message' => 'This is an internal note within a chat',\n  'author' => '{{USER_ID}}'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Create new chat internal note\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'message' => 'This is an internal note within a chat'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Create new chat internal note as another user\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'message' => 'This is an internal note within a chat',\n    'author' => '{{USER_ID}}'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Create new chat internal note\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\"\n\npayload = { \"message\": \"This is an internal note within a chat\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Create new chat internal note as another user\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\"\n\npayload = {\n    \"message\": \"This is an internal note within a chat\",\n    \"author\": \"{{USER_ID}}\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create new chat internal note\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"message\":\"This is an internal note within a chat\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Create new chat internal note as another user\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"message\":\"This is an internal note within a chat\",\"author\":\"{{USER_ID}}\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create new chat internal note\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"message\":\"This is an internal note within a chat\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Create new chat internal note as another user\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"message\":\"This is an internal note within a chat\",\"author\":\"{{USER_ID}}\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Create new chat internal note\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"message\\\":\\\"This is an internal note within a chat\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Create new chat internal note as another user\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"message\\\":\\\"This is an internal note within a chat\\\",\\\"author\\\":\\\"{{USER_ID}}\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Create new chat internal note\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\"\n\n\tpayload := strings.NewReader(\"{\\\"message\\\":\\\"This is an internal note within a chat\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Create new chat internal note as another user\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\"\n\n\tpayload := strings.NewReader(\"{\\\"message\\\":\\\"This is an internal note within a chat\\\",\\\"author\\\":\\\"{{USER_ID}}\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Create new chat internal note\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"message\\\":\\\"This is an internal note within a chat\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Create new chat internal note as another user\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"message\\\":\\\"This is an internal note within a chat\\\",\\\"author\\\":\\\"{{USER_ID}}\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Create new chat internal note\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"message\\\":\\\"This is an internal note within a chat\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Create new chat internal note as another user\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"message\\\":\\\"This is an internal note within a chat\\\",\\\"author\\\":\\\"{{USER_ID}}\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Create new chat internal note\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"message\\\":\\\"This is an internal note within a chat\\\"}\")\n  .asString();\n\n\n// Create new chat internal note as another user\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"message\\\":\\\"This is an internal note within a chat\\\",\\\"author\\\":\\\"{{USER_ID}}\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Create new chat internal note\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"message\\\":\\\"This is an internal note within a chat\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Create new chat internal note as another user\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"message\\\":\\\"This is an internal note within a chat\\\",\\\"author\\\":\\\"{{USER_ID}}\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Create new chat internal note\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"message\\\":\\\"This is an internal note within a chat\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Create new chat internal note as another user\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"message\\\":\\\"This is an internal note within a chat\\\",\\\"author\\\":\\\"{{USER_ID}}\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Create new chat internal note\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"message\":\"This is an internal note within a chat\"}'\n\n\n# Create new chat internal note as another user\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"message\":\"This is an internal note within a chat\",\"author\":\"{{USER_ID}}\"}'"},{"lang":"ObjC","source":"// Create new chat internal note\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"message\": @\"This is an internal note within a chat\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Create new chat internal note as another user\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"message\": @\"This is an internal note within a chat\",\n                              @\"author\": @\"{{USER_ID}}\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Create new chat internal note\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"message\": \"This is an internal note within a chat\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Create new chat internal note as another user\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"message\": \"This is an internal note within a chat\",\n  \"author\": \"{{USER_ID}}\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Delete note","description":"Delete one or multiple private chat notes\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fchats%2F%7BchatWid%7D%2Fnotes&method=DELETE&body=%7B%0A%20%20%22ids%22%3A%20%5B%0A%20%20%20%20%223EB003C71809B56EC2A63E%22%0A%20%20%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deleteChatNote","security":[{"apiKey":[]}],"tags":["Chats"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"Delete notes","schema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","pattern":"[0-9a-f]","minLength":20,"maxLength":22},"maxItems":100,"minItems":1}},"required":["ids"],"additionalProperties":false}}],"responses":{"200":{"description":"Notes deleted successfully","schema":{"type":"array","items":{"type":"string"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Delete internal chat note\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"ids\":[\"3EB003C71809B56EC2A63E\"]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Delete internal chat note\necho '{\"ids\":[\"3EB003C71809B56EC2A63E\"]}' |  \\\n  http DELETE https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Delete internal chat note\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"ids\":[\"3EB003C71809B56EC2A63E\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Delete internal chat note\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {ids: ['3EB003C71809B56EC2A63E']}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Delete internal chat note\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  ids: [\n    '3EB003C71809B56EC2A63E'\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Delete internal chat note\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes', [\n  'body' => '{\"ids\":[\"3EB003C71809B56EC2A63E\"]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Delete internal chat note\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'ids' => [\n    '3EB003C71809B56EC2A63E'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Delete internal chat note\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'ids' => [\n        '3EB003C71809B56EC2A63E'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Delete internal chat note\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\"\n\npayload = { \"ids\": [\"3EB003C71809B56EC2A63E\"] }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete internal chat note\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"ids\":[\"3EB003C71809B56EC2A63E\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete internal chat note\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"ids\":[\"3EB003C71809B56EC2A63E\"]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Delete internal chat note\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"ids\\\":[\\\"3EB003C71809B56EC2A63E\\\"]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Delete internal chat note\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\"\n\n\tpayload := strings.NewReader(\"{\\\"ids\\\":[\\\"3EB003C71809B56EC2A63E\\\"]}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Delete internal chat note\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"ids\\\":[\\\"3EB003C71809B56EC2A63E\\\"]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Delete internal chat note\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"ids\\\":[\\\"3EB003C71809B56EC2A63E\\\"]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Delete internal chat note\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"ids\\\":[\\\"3EB003C71809B56EC2A63E\\\"]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Delete internal chat note\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"ids\\\":[\\\"3EB003C71809B56EC2A63E\\\"]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Delete internal chat note\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"ids\\\":[\\\"3EB003C71809B56EC2A63E\\\"]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Delete internal chat note\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"ids\":[\"3EB003C71809B56EC2A63E\"]}'"},{"lang":"ObjC","source":"// Delete internal chat note\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"ids\": @[ @\"3EB003C71809B56EC2A63E\" ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Delete internal chat note\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"ids\": [\"3EB003C71809B56EC2A63E\"]] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/notes\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/chats/{chatWid}/labels":{"parameters":[],"patch":{"summary":"Update chat labels","description":"Set, upsert or remove labels on a specific chat.\n\n\n\nLabels created in the platform are always available. Labels synced from\n\nWhatsApp can also be attached and detached on **online WhatsApp Business**\n\nnumbers, and the change is pushed to the WhatsApp session. Creating,\n\nrenaming or deleting a WhatsApp label is only possible from the\n\nWhatsApp Business app.\n\n\n\nBy default, the existing labels will be replaced with the new ones.\n\nTo **partially update** labels without replacing the existing ones, set the URL query param `?upsert=true`.\n\nTo **remove** specific labels, set the URL query param `?remove=true`.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fchats%2F%7BchatWid%7D%2Flabels&method=PATCH&body=%5B%0A%20%20%22sales%22%2C%0A%20%20%22important%22%0A%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateChatLabels","security":[{"apiKey":[]}],"tags":["Chats"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"labels","schema":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30,"description":"Label name"},"maxItems":40}},{"in":"query","name":"upsert","required":false,"type":"boolean","default":false,"description":"Upsert (add and update) labels without removing the existing ones"},{"in":"query","name":"remove","required":false,"type":"boolean","default":false,"description":"Remove only the specified labels in the body request. Other existing labels will be kept."}],"responses":{"200":{"description":"New chat labels","schema":{"type":"array","items":{"type":"string"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Update chat labels\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '[\"sales\",\"important\"]'\n\n\n// Upsert chat labels\ncurl --request PATCH \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels?upsert=true' \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '[\"sales\",\"important\"]'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Update chat labels\necho '[\"sales\",\"important\"]' |  \\\n  http PATCH https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Upsert chat labels\necho '[\"sales\",\"important\"]' |  \\\n  http PATCH 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels?upsert=true' \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Update chat labels\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[\"sales\",\"important\"]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Upsert chat labels\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels?upsert=true';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[\"sales\",\"important\"]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Update chat labels\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: ['sales', 'important']\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Upsert chat labels\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels',\n  params: {upsert: 'true'},\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: ['sales', 'important']\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Update chat labels\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send([\n  'sales',\n  'important'\n]);\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Upsert chat labels\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels');\n\nreq.query({\n  upsert: 'true'\n});\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send([\n  'sales',\n  'important'\n]);\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Update chat labels\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels', [\n  'body' => '[\"sales\",\"important\"]',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Upsert chat labels\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels?upsert=true', [\n  'body' => '[\"sales\",\"important\"]',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Update chat labels\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'sales',\n  'important'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Upsert chat labels\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'sales',\n  'important'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setQuery(new http\\QueryString([\n  'upsert' => 'true'\n]));\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Update chat labels\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'sales',\n    'important'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Upsert chat labels\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels?upsert=true\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'sales',\n    'important'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Update chat labels\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels\"\n\npayload = [\"sales\", \"important\"]\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Upsert chat labels\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels\"\n\nquerystring = {\"upsert\":\"true\"}\n\npayload = [\"sales\", \"important\"]\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers, params=querystring)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update chat labels\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[\"sales\",\"important\"]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Upsert chat labels\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels?upsert=true';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[\"sales\",\"important\"]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update chat labels\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '[\"sales\",\"important\"]'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Upsert chat labels\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels?upsert=true',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '[\"sales\",\"important\"]'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Update chat labels\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"[\\\"sales\\\",\\\"important\\\"]\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Upsert chat labels\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels?upsert=true\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"[\\\"sales\\\",\\\"important\\\"]\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Update chat labels\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels\"\n\n\tpayload := strings.NewReader(\"[\\\"sales\\\",\\\"important\\\"]\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Upsert chat labels\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels?upsert=true\"\n\n\tpayload := strings.NewReader(\"[\\\"sales\\\",\\\"important\\\"]\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Update chat labels\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"[\\\"sales\\\",\\\"important\\\"]\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Upsert chat labels\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels?upsert=true\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"[\\\"sales\\\",\\\"important\\\"]\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Update chat labels\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"[\\\"sales\\\",\\\"important\\\"]\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Upsert chat labels\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels?upsert=true\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"[\\\"sales\\\",\\\"important\\\"]\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Update chat labels\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"[\\\"sales\\\",\\\"important\\\"]\")\n  .asString();\n\n\n// Upsert chat labels\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels?upsert=true\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"[\\\"sales\\\",\\\"important\\\"]\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Update chat labels\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"[\\\"sales\\\",\\\"important\\\"]\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Upsert chat labels\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"[\\\"sales\\\",\\\"important\\\"]\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels?upsert=true\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Update chat labels\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"[\\\"sales\\\",\\\"important\\\"]\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Upsert chat labels\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels?upsert=true\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"[\\\"sales\\\",\\\"important\\\"]\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Update chat labels\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '[\"sales\",\"important\"]'\n\n\n# Upsert chat labels\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels?upsert=true' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '[\"sales\",\"important\"]'"},{"lang":"ObjC","source":"// Update chat labels\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @[ @\"sales\",\n                              @\"important\" ];\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Upsert chat labels\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @[ @\"sales\",\n                              @\"important\" ];\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels?upsert=true\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Update chat labels\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"sales\", \"important\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Upsert chat labels\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"sales\", \"important\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/labels?upsert=true\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/chats/{chatWid}/attributes":{"parameters":[],"patch":{"summary":"Update chat attributes","description":"Update chat meta attributes as muted/unmuted or pinned/unpinned chat.\n\n\n\n`pinned`: on WhatsApp QR numbers the chat is pinned or unpinned in the WhatsApp app too, so the number session must be online. If WhatsApp already has its maximum of pinned chats, the chat is pinned in the platform only and the response `pinSync.whatsapp` is `limit`. On WhatsApp Business API numbers it applies to the platform only.\n\n\n\n`muted`: applies to the platform only, never to the WhatsApp app.","operationId":"updateChatMeta","security":[{"apiKey":[]}],"tags":["Chats"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"meta","schema":{"type":"object","properties":{"pinned":{"type":"boolean","description":"Set or unset chat pinned attribute"},"muted":{"type":"boolean","description":"Set or unset chat in mute mode"}},"additionalProperties":false}}],"responses":{"200":{"description":"Updated chat","schema":{"$ref":"#/definitions/ioChat"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n"},{"lang":"Node (axios)","source":""},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n"},{"lang":"PHP (curl)","source":""},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n"},{"lang":"Ruby","source":""},{"lang":"Go","source":""},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n"},{"lang":"C","source":""},{"lang":"Powershell","source":""},{"lang":"ObjC","source":""},{"lang":"Swift","source":""}]}},"/io/{deviceId}/chats/{chatWid}/archive":{"parameters":[],"put":{"summary":"Archive chat","description":"Archive an specific chat by WhatsApp ID. E.g: `123456789@c.us`\n\nThe chat will be archived in the WhatsApp app end as well, therefore is required the number session to be online.\n\n\n\nIf the WhatsApp number session is not online, the API will return a 503 Unavailable error. Try again in a few seconds.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fchats%2F%7BchatWid%7D%2Farchive&method=PUT&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"archiveChat","security":[{"apiKey":[]}],"tags":["Chats"],"produces":["application/json"],"consumes":["application/json"],"responses":{"200":{"description":"Archived chat","schema":{"$ref":"#/definitions/ioChat"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Archive chat in WhatsApp\ncurl --request PUT \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Archive chat in WhatsApp\nhttp PUT https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Archive chat in WhatsApp\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive';\nconst options = {method: 'PUT', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Archive chat in WhatsApp\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PUT',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Archive chat in WhatsApp\nconst unirest = require('unirest');\n\nconst req = unirest('PUT', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Archive chat in WhatsApp\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PUT', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Archive chat in WhatsApp\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive');\n$request->setRequestMethod('PUT');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Archive chat in WhatsApp\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PUT\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Archive chat in WhatsApp\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.put(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Archive chat in WhatsApp\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive';\nconst options = {method: 'PUT', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Archive chat in WhatsApp\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive',\n  method: 'PUT',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Archive chat in WhatsApp\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Put.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Archive chat in WhatsApp\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive\"\n\n\treq, _ := http.NewRequest(\"PUT\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Archive chat in WhatsApp\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive\");\nvar request = new RestRequest(Method.PUT);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Archive chat in WhatsApp\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Put,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Archive chat in WhatsApp\nHttpResponse<String> response = Unirest.put(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Archive chat in WhatsApp\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive\")\n  .put(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Archive chat in WhatsApp\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PUT\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Archive chat in WhatsApp\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive' -Method PUT -Headers $headers"},{"lang":"ObjC","source":"// Archive chat in WhatsApp\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PUT\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Archive chat in WhatsApp\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PUT\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Unarchive chat","description":"Unarchive an specific chat by WhatsApp ID. E.g: `123456789@c.us`\n\nThe chat will be unarchived in the WhatsApp app end as well, therefore is required the number session to be online.\n\n\n\nIf the WhatsApp number session is not online, the API will return a 503 Unavailable error. Try again in a few seconds.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fchats%2F%7BchatWid%7D%2Farchive&method=DELETE&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"unarchiveChat","security":[{"apiKey":[]}],"tags":["Chats"],"produces":["application/json"],"consumes":["application/json"],"responses":{"200":{"description":"Unarchived chat","schema":{"$ref":"#/definitions/ioChat"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Archive chat in WhatsApp\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Archive chat in WhatsApp\nhttp DELETE https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Archive chat in WhatsApp\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Archive chat in WhatsApp\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Archive chat in WhatsApp\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Archive chat in WhatsApp\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Archive chat in WhatsApp\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive');\n$request->setRequestMethod('DELETE');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Archive chat in WhatsApp\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Archive chat in WhatsApp\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.delete(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Archive chat in WhatsApp\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Archive chat in WhatsApp\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive',\n  method: 'DELETE',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Archive chat in WhatsApp\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Archive chat in WhatsApp\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Archive chat in WhatsApp\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Archive chat in WhatsApp\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Archive chat in WhatsApp\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Archive chat in WhatsApp\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive\")\n  .delete(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Archive chat in WhatsApp\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Archive chat in WhatsApp\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive' -Method DELETE -Headers $headers"},{"lang":"ObjC","source":"// Archive chat in WhatsApp\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Archive chat in WhatsApp\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}/archive\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/chats/{chatWid}":{"parameters":[],"get":{"summary":"Get chat by WID","description":"Get a WhatsApp chat information by WhatsApp ID. You can retrieve information for both user and group chats.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fchats%2F%7BchatWid%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getDeviceChatDetails","security":[{"apiKey":[]}],"tags":["Chats"],"parameters":[{"in":"query","name":"include","type":"array","collectionFormat":"csv","description":"Optionally include chat subentities in the response, limited to 30 most recent entries","items":{"type":"string","enum":["files"]},"maxItems":2}],"produces":["application/json"],"responses":{"200":{"description":"Chat details","schema":{"$ref":"#/definitions/ioChat"}},"400":{"description":"Invalid request","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Chat not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get device chat details\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get device chat details\nhttp GET https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get device chat details\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get device chat details\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get device chat details\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get device chat details\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get device chat details\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get device chat details\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get device chat details\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get device chat details\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get device chat details\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get device chat details\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get device chat details\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get device chat details\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get device chat details\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get device chat details\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get device chat details\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get device chat details\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get device chat details\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get device chat details\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get device chat details\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Delete chat","description":"Flag chat as internally deleted, optionally deleting it on the WhatsApp side as well.\n\n\n\nWhatsApp session must be online and synced in order to delete the chat, otherwise the API will return a `503` error.\n\n\n\n#### Notes\n\n\n\n\n\n* If the chat is deleted on WhatsApp, messages will be no longer accessible in the mobile app but if the chat's messages were synced, a copy of the chat will be still acessible in the multi-agent live chat and via API.\n\n\n\n\n\n* By default, deleted chats and messages are not deleted from the system, but temporarily accessible from the Chat and API for 30 days before its final deletion for your convenience and future reference.\n\n\n\n\n\n* In case an already deleted chat is started again with the same user, the chat will be moved back to the active list of chats, skipping the deletion process.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fchats%2F%7BchatWid%7D&method=DELETE&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deleteDeviceChat","security":[{"apiKey":[]}],"tags":["Chats"],"produces":["application/json"],"parameters":[{"in":"body","name":"delete","schema":{"type":"object","properties":{"whatsapp":{"type":"boolean","description":"Delete chat on WhatsApp app. Requires the session to be online, otherwise it will return an error unless `force` body param is set to `true`.","default":false},"force":{"type":"boolean","description":"Force to flag chat as removed when `whatsapp` field is set to `true` and the chat cannot be removed on the WhatsApp side.","default":false}},"additionalProperties":false}}],"responses":{"204":{"description":"Chat deleted successfully"},"400":{"description":"Invalid ID or body data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Chat not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Session not online or synced - Try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Flag chat as deleted (internally only, but do not delete it on the WhatsApp side)\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid} \\\n  --header 'Token: <api token goes here>'\n\n\n// Flag chat as deleted and delete on WhatsApp (number session must be online, otherwise the API will return a 503 error)\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid} \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"whatsapp\":true}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Flag chat as deleted (internally only, but do not delete it on the WhatsApp side)\nhttp DELETE https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid} \\\n  Token:'<api token goes here>'\n\n\n// Flag chat as deleted and delete on WhatsApp (number session must be online, otherwise the API will return a 503 error)\necho '{\"whatsapp\":true}' |  \\\n  http DELETE https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid} \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Flag chat as deleted (internally only, but do not delete it on the WhatsApp side)\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Flag chat as deleted and delete on WhatsApp (number session must be online, otherwise the API will return a 503 error)\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"whatsapp\":true}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Flag chat as deleted (internally only, but do not delete it on the WhatsApp side)\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Flag chat as deleted and delete on WhatsApp (number session must be online, otherwise the API will return a 503 error)\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {whatsapp: true}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Flag chat as deleted (internally only, but do not delete it on the WhatsApp side)\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Flag chat as deleted and delete on WhatsApp (number session must be online, otherwise the API will return a 503 error)\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  whatsapp: true\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Flag chat as deleted (internally only, but do not delete it on the WhatsApp side)\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Flag chat as deleted and delete on WhatsApp (number session must be online, otherwise the API will return a 503 error)\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}', [\n  'body' => '{\"whatsapp\":true}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Flag chat as deleted (internally only, but do not delete it on the WhatsApp side)\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}');\n$request->setRequestMethod('DELETE');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Flag chat as deleted and delete on WhatsApp (number session must be online, otherwise the API will return a 503 error)\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'whatsapp' => null\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Flag chat as deleted (internally only, but do not delete it on the WhatsApp side)\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Flag chat as deleted and delete on WhatsApp (number session must be online, otherwise the API will return a 503 error)\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'whatsapp' => null\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Flag chat as deleted (internally only, but do not delete it on the WhatsApp side)\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.delete(url, headers=headers)\n\nprint(response.json())\n\n\n# Flag chat as deleted and delete on WhatsApp (number session must be online, otherwise the API will return a 503 error)\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\"\n\npayload = { \"whatsapp\": True }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Flag chat as deleted (internally only, but do not delete it on the WhatsApp side)\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Flag chat as deleted and delete on WhatsApp (number session must be online, otherwise the API will return a 503 error)\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"whatsapp\":true}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Flag chat as deleted (internally only, but do not delete it on the WhatsApp side)\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}',\n  method: 'DELETE',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Flag chat as deleted and delete on WhatsApp (number session must be online, otherwise the API will return a 503 error)\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"whatsapp\":true}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Flag chat as deleted (internally only, but do not delete it on the WhatsApp side)\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Flag chat as deleted and delete on WhatsApp (number session must be online, otherwise the API will return a 503 error)\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"whatsapp\\\":true}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Flag chat as deleted (internally only, but do not delete it on the WhatsApp side)\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Flag chat as deleted and delete on WhatsApp (number session must be online, otherwise the API will return a 503 error)\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\"\n\n\tpayload := strings.NewReader(\"{\\\"whatsapp\\\":true}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Flag chat as deleted (internally only, but do not delete it on the WhatsApp side)\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Flag chat as deleted and delete on WhatsApp (number session must be online, otherwise the API will return a 503 error)\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"whatsapp\\\":true}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Flag chat as deleted (internally only, but do not delete it on the WhatsApp side)\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Flag chat as deleted and delete on WhatsApp (number session must be online, otherwise the API will return a 503 error)\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"whatsapp\\\":true}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Flag chat as deleted (internally only, but do not delete it on the WhatsApp side)\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Flag chat as deleted and delete on WhatsApp (number session must be online, otherwise the API will return a 503 error)\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"whatsapp\\\":true}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Flag chat as deleted (internally only, but do not delete it on the WhatsApp side)\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\")\n  .delete(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Flag chat as deleted and delete on WhatsApp (number session must be online, otherwise the API will return a 503 error)\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"whatsapp\\\":true}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Flag chat as deleted (internally only, but do not delete it on the WhatsApp side)\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Flag chat as deleted and delete on WhatsApp (number session must be online, otherwise the API will return a 503 error)\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"whatsapp\\\":true}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Flag chat as deleted (internally only, but do not delete it on the WhatsApp side)\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}' -Method DELETE -Headers $headers\n\n\n# Flag chat as deleted and delete on WhatsApp (number session must be online, otherwise the API will return a 503 error)\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"whatsapp\":true}'"},{"lang":"ObjC","source":"// Flag chat as deleted (internally only, but do not delete it on the WhatsApp side)\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Flag chat as deleted and delete on WhatsApp (number session must be online, otherwise the API will return a 503 error)\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"whatsapp\": @YES };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Flag chat as deleted (internally only, but do not delete it on the WhatsApp side)\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Flag chat as deleted and delete on WhatsApp (number session must be online, otherwise the API will return a 503 error)\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"whatsapp\": true] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats/{chatWid}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/io/{deviceId}/chats":{"parameters":[],"get":{"summary":"Search chats","description":"List chats for the current WhatsApp linked account, optionally filtered by search params.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fchats&params=%5B%7B%22key%22%3A%22size%22%2C%22value%22%3A50%7D%2C%7B%22key%22%3A%22page%22%2C%22value%22%3A0%7D%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getDeviceChats","security":[{"apiKey":[]}],"tags":["Chats"],"produces":["application/json"],"parameters":[{"in":"query","name":"status","type":"array","collectionFormat":"csv","description":"Filter chats by status. Multiple status are allowed separated by commas.\n\n- `pending` = unassigned and not answered chats.\n - `active` = assigned and answered chat. - `resolved` = closed chats.\n - `muted` = when it is the only status given, chats muted in the platform or on the WhatsApp app, whether pending, active or resolved.","items":{"type":"string","enum":["removed","banned","archived","muted","pending","active","resolved"]},"maxItems":7,"default":"pending,active,resolved"},{"in":"query","name":"unread","type":"boolean","description":"Filter chats with unread messages (`true`) or with no unread messages (`false`). Unread chats may have any status (pending, active, resolved)"},{"in":"query","name":"active","type":"boolean","description":"Filter only by active chats/groups/channels. Non-active chats include removed chats and read-only groups that cannot accept new messages. A group chat is read-only when your number no longer is a participant in the group."},{"in":"query","name":"canSend","type":"boolean","description":"Filter only by chats/groups/channels that you can messages to, as opposite to read-only chats."},{"in":"query","name":"readOnly","type":"boolean","description":"Filter chats/groups/channels that are read-only and **cannot** accept messages. A group chat that is read-only when your number is no longer a participant in the group."},{"in":"query","name":"type","description":"Filter chats by type. **Note**: `broadcast` type is deprecated and will be removed in the future.","type":"array","collectionFormat":"csv","maxItems":10,"items":{"type":"string","enum":["chat","group","community","channel","broadcast"]}},{"in":"query","name":"agent","type":"array","collectionFormat":"csv","maxItems":10,"description":"Filter chats assigned to one or multiple user agents by ID (24 characters hexadecimal user ID). Multiple agent IDs allowed separated by commas.","items":{"type":"string","minLength":24,"maxLength":24,"pattern":"^[a-f0-9]{24}$"}},{"in":"query","name":"ids","type":"array","collectionFormat":"csv","description":"Filter chats by chat WhatsApp ID. E.g: `1234567890@c.us`. Multiple IDs allowed separated by commas.","maxItems":200,"items":{"type":"string","minLength":8,"maxLength":40}},{"in":"query","name":"lid","type":"array","collectionFormat":"csv","description":"Filter chats by LID (private WhatsApp identifier). E.g: `1234567890123@lid`. Multiple LIDs allowed separated by commas.","maxItems":200,"items":{"type":"string","minLength":14,"maxLength":25}},{"in":"query","name":"chat","type":"array","collectionFormat":"csv","description":"Filter messages by chat WhatsApp ID. This filter works for user chats, groups and channels. E.g: `1234567890@c.us`, `123456789000000000@g.us`, `123000098765421000@newsletter`","maxItems":100,"items":{"type":"string","minLength":10,"maxLength":50}},{"in":"query","name":"phone","type":"array","collectionFormat":"csv","description":"Filter chats by phone numbers or WIDs. E.g: +1234567890 or 1234567890@c.us","maxItems":100,"items":{"type":"string","minLength":8,"maxLength":20}},{"in":"query","name":"group","type":"array","collectionFormat":"csv","description":"Filter chats by group WIDs. E.g: 123456789000000000@g.us","maxItems":100,"items":{"type":"string","minLength":8,"maxLength":40}},{"in":"query","name":"channel","type":"array","collectionFormat":"csv","description":"Filter chats by Channel WIDs. E.g: 123000098765421000@newsletter","maxItems":100,"items":{"type":"string","minLength":10,"maxLength":40}},{"in":"query","name":"search","type":"string","description":"Search chats by free text that partially matches the phone number, WhatsApp ID, group or chat name, contact name, email, company name, website, metadata or private notes","maxLength":150},{"in":"query","name":"labels","type":"array","collectionFormat":"csv","description":"Filter chats contaning at least one of the given label keywords. If multiple labels are defined, at least one label should match per chat. To include chats that has any label assigned, use `*` as value, e.g: `labels=*`. This filter cannot be used along with `labelsExclude`.","items":{"type":"string","minLength":1,"maxLength":50},"maxItems":30},{"in":"query","name":"labelsExclude","type":"array","collectionFormat":"csv","description":"Exclude chats that has certain labels. If multiple labels are defined, none of one labels provided should match. To exclude chats that has no labels assigned, use `*` as value, e.g: `labelsExclude=*`. This filter cannot be used along with `labels`.","items":{"type":"string","minLength":1,"maxLength":50},"maxItems":30},{"in":"query","name":"include","type":"array","collectionFormat":"csv","description":"Optionally include related subdocuments per chat entry","items":{"type":"string","enum":["lastMessage","group.participants","group.participants.contact"]}},{"in":"query","name":"includeChats","type":"array","collectionFormat":"csv","description":"Always include additional chat by WhatsApp ID documents in the search without excluding matched chats based on the search filters. E.g: 1234567890@c.us","maxItems":10,"items":{"type":"string","minLength":6,"maxLength":40}},{"in":"query","name":"excludeChats","type":"array","collectionFormat":"csv","description":"Exclude specific chats by WhatsApp ID in the search. E.g: 1234567890@c.us","maxItems":50,"items":{"type":"string","minLength":6,"maxLength":40}},{"in":"query","name":"excludeType","description":"Exclude chats by type.","type":"array","collectionFormat":"csv","maxItems":4,"items":{"type":"string","enum":["chat","group","community","channel"]}},{"in":"query","name":"metadataKey","description":"Find chats that has at least one of the given metadata keys. Multiple values are allowed comma-separated.","type":"array","collectionFormat":"csv","maxItems":10,"items":{"type":"string","minLength":1,"maxLength":30,"pattern":"[a-zA-Z0-9_]"}},{"in":"query","name":"metadataValue","description":"Find chats that has at least one of the given metadata values. Multiple values are allowed comma-separated.","type":"array","collectionFormat":"csv","maxItems":10,"items":{"type":"string","minLength":1,"maxLength":300}},{"name":"after","description":"Chats created after the given date","in":"query","type":"string","format":"date-time"},{"name":"before","description":"Chats created before the given date","in":"query","type":"string","format":"date-time"},{"name":"lastMessageAfter","description":"Chats with last message after the given date, whether it is an inbound or outbound last message","in":"query","type":"string","format":"date-time"},{"name":"lastMessageBefore","description":"Chats with last message before the given date, whether it is an inbound or outbound last message","in":"query","type":"string","format":"date-time"},{"name":"lastMessageInboundAfter","description":"Chats with last inbound message after the given date","in":"query","type":"string","format":"date-time"},{"name":"lastMessageInboundBefore","description":"Chats with last inbound message before the given date","in":"query","type":"string","format":"date-time"},{"name":"lastMessageOutboundAfter","description":"Chats with last outbound message after the given date","in":"query","type":"string","format":"date-time"},{"name":"lastMessageOutboundBefore","description":"Chats with last outbound message before the given date","in":"query","type":"string","format":"date-time"},{"name":"lastMessageOutboundfter","description":"Deprecated misspelling of `lastMessageOutboundAfter`, accepted for backward compatibility. Use `lastMessageOutboundAfter`, which wins when both are sent.","in":"query","type":"string","format":"date-time"},{"name":"firstMessageBefore","description":"Chats with **first outbound message** before or equal to the given date","in":"query","type":"string","format":"date-time"},{"name":"firstMessageAfter","description":"Chats with a **first outbound message** after or equal the given date","in":"query","type":"string","format":"date-time"},{"name":"firstInboundMessageBefore","description":"Chats with **first inbound message** before or equal the given date","in":"query","type":"string","format":"date-time"},{"name":"firstInboundMessageAfter","description":"Chats with a **first inbound message** after or equal the given date","in":"query","type":"string","format":"date-time"},{"in":"query","name":"page","description":"Results page number (starting from 0)","type":"number","format":"integer","default":0,"minimum":0,"maximum":300},{"in":"query","name":"size","description":"Results page size","type":"number","format":"integer","default":20,"minimum":1,"maximum":500},{"in":"query","name":"sort","description":"Defines how to sort chats","type":"string","enum":["date:asc","date:desc","lastMessage:asc","lastMessage:desc","inbound:asc"]},{"in":"query","name":"assigned","type":"boolean","description":"Filter only chats that are currently assigned to any user agent (i.e. `owner.agent` is set). Cannot be combined with `unassigned`."},{"in":"query","name":"unassigned","type":"boolean","description":"Filter only chats that are not assigned to any user agent (i.e. `owner.agent` is empty). Cannot be combined with `assigned`."},{"in":"query","name":"department","type":"array","collectionFormat":"csv","description":"Filter chats assigned to one or multiple departments by ID (24 characters hexadecimal). Multiple department IDs allowed separated by commas.","items":{"type":"string","minLength":24,"maxLength":24,"pattern":"^[a-f0-9]{24}$"},"maxItems":20},{"in":"query","name":"favorite","type":"boolean","description":"Filter only chats flagged as favorite."},{"in":"query","name":"pinned","type":"boolean","description":"Filter only chats pinned on the platform or on the WhatsApp app."},{"in":"query","name":"spam","type":"boolean","description":"Filter only chats flagged as spam."},{"in":"query","name":"excludeApi","type":"boolean","description":"Exclude chats whose last activity is an outbound message on an unassigned chat — the chat-level approximation of \"last message was sent via the API\". Keeps chats that are assigned to an agent, have no outbound messages, or whose latest inbound message is newer than the latest outbound one."}],"responses":{"200":{"description":"Chats","schema":{"type":"array","items":{"$ref":"#/definitions/ioChat"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get most recent 50 chats\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/chats?size=50&page=0' \\\n  --header 'Token: <api token goes here>'\n\n\n// Get group chats up to 30\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/chats?type=group&size=30&page=0' \\\n  --header 'Token: <api token goes here>'\n\n\n// Search chat by phone number \ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/chat/{deviceId}/chats?phone=%2B123456789' \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get most recent 50 chats\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/chats?size=50&page=0' \\\n  Token:'<api token goes here>'\n\n\n// Get group chats up to 30\nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/chats?type=group&size=30&page=0' \\\n  Token:'<api token goes here>'\n\n\n// Search chat by phone number \nhttp GET 'https://api.wassenger.com/v1/chat/{deviceId}/chats?phone=%2B123456789' \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get most recent 50 chats\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats?size=50&page=0';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get group chats up to 30\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats?type=group&size=30&page=0';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Search chat by phone number \nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats?phone=%2B123456789';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get most recent 50 chats\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats',\n  params: {size: '50', page: '0'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get group chats up to 30\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats',\n  params: {type: 'group', size: '30', page: '0'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Search chat by phone number \nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats',\n  params: {phone: '+123456789'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get most recent 50 chats\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/chats');\n\nreq.query({\n  size: '50',\n  page: '0'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Get group chats up to 30\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/chats');\n\nreq.query({\n  type: 'group',\n  size: '30',\n  page: '0'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Search chat by phone number \nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/chats');\n\nreq.query({\n  phone: '+123456789'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get most recent 50 chats\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/chats?size=50&page=0', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Get group chats up to 30\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/chats?type=group&size=30&page=0', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Search chat by phone number \n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/chat/{deviceId}/chats?phone=%2B123456789', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get most recent 50 chats\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'size' => '50',\n  'page' => '0'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Get group chats up to 30\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'type' => 'group',\n  'size' => '30',\n  'page' => '0'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Search chat by phone number \n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/chats');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'phone' => '+123456789'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get most recent 50 chats\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats?size=50&page=0\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Get group chats up to 30\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats?type=group&size=30&page=0\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Search chat by phone number \n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/chats?phone=%2B123456789\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get most recent 50 chats\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats\"\n\nquerystring = {\"size\":\"50\",\"page\":\"0\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Get group chats up to 30\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats\"\n\nquerystring = {\"type\":\"group\",\"size\":\"30\",\"page\":\"0\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Search chat by phone number \nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/chats\"\n\nquerystring = {\"phone\":\"+123456789\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get most recent 50 chats\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats?size=50&page=0';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Get group chats up to 30\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats?type=group&size=30&page=0';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Search chat by phone number \nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/chats?phone=%2B123456789';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get most recent 50 chats\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats?size=50&page=0',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Get group chats up to 30\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats?type=group&size=30&page=0',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Search chat by phone number \nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/chats?phone=%2B123456789',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get most recent 50 chats\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats?size=50&page=0\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Get group chats up to 30\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats?type=group&size=30&page=0\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Search chat by phone number \nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/chats?phone=%2B123456789\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get most recent 50 chats\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats?size=50&page=0\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Get group chats up to 30\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats?type=group&size=30&page=0\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Search chat by phone number \npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/chats?phone=%2B123456789\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get most recent 50 chats\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats?size=50&page=0\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Get group chats up to 30\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats?type=group&size=30&page=0\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Search chat by phone number \nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/chats?phone=%2B123456789\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get most recent 50 chats\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats?size=50&page=0\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Get group chats up to 30\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats?type=group&size=30&page=0\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Search chat by phone number \nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/chats?phone=%2B123456789\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get most recent 50 chats\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/chats?size=50&page=0\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Get group chats up to 30\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/chats?type=group&size=30&page=0\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Search chat by phone number \nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/chat/{deviceId}/chats?phone=%2B123456789\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get most recent 50 chats\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats?size=50&page=0\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Get group chats up to 30\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats?type=group&size=30&page=0\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Search chat by phone number \nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/chats?phone=%2B123456789\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get most recent 50 chats\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats?size=50&page=0\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Get group chats up to 30\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats?type=group&size=30&page=0\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Search chat by phone number \nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/chats?phone=%2B123456789\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get most recent 50 chats\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats?size=50&page=0' -Method GET -Headers $headers\n\n\n# Get group chats up to 30\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats?type=group&size=30&page=0' -Method GET -Headers $headers\n\n\n# Search chat by phone number \n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/chats?phone=%2B123456789' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get most recent 50 chats\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats?size=50&page=0\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Get group chats up to 30\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats?type=group&size=30&page=0\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Search chat by phone number \n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/chats?phone=%2B123456789\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get most recent 50 chats\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats?size=50&page=0\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Get group chats up to 30\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats?type=group&size=30&page=0\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Search chat by phone number \nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/chats?phone=%2B123456789\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Bulk chats update","description":"Update chats in bulk mode, up to 1000 chats per API call.\n\n\n\nYou can perform one bulk action over a group of chats per API call.\n\n\n\n**Supported bulk actions**\n\n\n\n- resolve\n- unresolve\n- pin\n- unpin\n- mute\n- unmute\n- assign\n- unassign\n- block\n- unblock\n- read\n- unread\n- labels\n- remove\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fchat%2F%7BdeviceId%7D%2Fbulk%2Fchats&method=POST&body=%7B%0A%20%20%22action%22%3A%20%22resolve%22%2C%0A%20%20%22chats%22%3A%20%5B%0A%20%20%20%20%221234567890%40c.us%22%2C%0A%20%20%20%20%221234567890%40c.us%22%0A%20%20%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"bulkChatsUpdate","security":[{"apiKey":[]}],"tags":["Chats"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"params","schema":{"type":"object","properties":{"action":{"type":"string","enum":["resolve","unresolve","pin","unpin","mute","unmute","assign","unassign","block","unblock","read","unread","labels","remove"],"description":"Action to perform on the given chats. Example: `resolve`"},"chats":{"type":"array","items":{"type":"string","maxLength":40,"minLength":8},"minItems":1,"maxItems":1000,"description":"List of chat IDs or phone numbers to update. Example: +1234567890, 1234567890@c.us"},"params":{"type":"object","properties":{"add":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"maxItems":100,"description":"Only applied to `labels` action. List of labels to add to the given chats"},"remove":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"maxItems":100,"description":"Only applied to `remove` action. List of labels to remove from the given chats"},"agent":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Only required in `assign` action: defines the Agent ID (24 characters hexadecimal) to assign the given chats to. Can be in used in combination with the `department` field."},"department":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Only applicate to `assign` action: defines the Team Department ID (24 characters hexadecimal) to assign the given chats to. Can be in used in combination with the `agent` field"}},"additionalProperties":false}},"required":["action"],"additionalProperties":false}}],"responses":{"200":{"description":"Chats updated successfully","schema":{"type":"object","properties":{"total":{"type":"number","description":"Total updated chats"}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Resolve multiple chats\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"action\":\"resolve\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n\n\n// Mark multiple chats as unread\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"action\":\"unread\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n\n\n// Assign multiple chats\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"action\":\"assign\",\"params\":{\"agent\":\"<AGENT-ID>\"},\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n\n\n// Assign multiple chats to a department\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"action\":\"assign\",\"params\":{\"department\":\"<DEPARTMENT_ID>\"},\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n\n\n// Unassign multiple chats\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"action\":\"unassign\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n\n\n// Update labels\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"action\":\"labels\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"],\"params\":{\"add\":[\"label1\",\"label2\"],\"remove\":[\"label3\"]}}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Resolve multiple chats\necho '{\"action\":\"resolve\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}' |  \\\n  http POST https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Mark multiple chats as unread\necho '{\"action\":\"unread\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}' |  \\\n  http POST https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Assign multiple chats\necho '{\"action\":\"assign\",\"params\":{\"agent\":\"<AGENT-ID>\"},\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}' |  \\\n  http POST https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Assign multiple chats to a department\necho '{\"action\":\"assign\",\"params\":{\"department\":\"<DEPARTMENT_ID>\"},\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}' |  \\\n  http POST https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Unassign multiple chats\necho '{\"action\":\"unassign\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}' |  \\\n  http POST https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Update labels\necho '{\"action\":\"labels\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"],\"params\":{\"add\":[\"label1\",\"label2\"],\"remove\":[\"label3\"]}}' |  \\\n  http POST https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Resolve multiple chats\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"resolve\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Mark multiple chats as unread\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"unread\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Assign multiple chats\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"assign\",\"params\":{\"agent\":\"<AGENT-ID>\"},\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Assign multiple chats to a department\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"assign\",\"params\":{\"department\":\"<DEPARTMENT_ID>\"},\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Unassign multiple chats\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"unassign\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Update labels\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"labels\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"],\"params\":{\"add\":[\"label1\",\"label2\"],\"remove\":[\"label3\"]}}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Resolve multiple chats\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {action: 'resolve', chats: ['1234567890@c.us', '1234567890@c.us']}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Mark multiple chats as unread\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {action: 'unread', chats: ['1234567890@c.us', '1234567890@c.us']}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Assign multiple chats\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    action: 'assign',\n    params: {agent: '<AGENT-ID>'},\n    chats: ['1234567890@c.us', '1234567890@c.us']\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Assign multiple chats to a department\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    action: 'assign',\n    params: {department: '<DEPARTMENT_ID>'},\n    chats: ['1234567890@c.us', '1234567890@c.us']\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Unassign multiple chats\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {action: 'unassign', chats: ['1234567890@c.us', '1234567890@c.us']}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Update labels\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    action: 'labels',\n    chats: ['1234567890@c.us', '1234567890@c.us'],\n    params: {add: ['label1', 'label2'], remove: ['label3']}\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Resolve multiple chats\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  action: 'resolve',\n  chats: [\n    '1234567890@c.us',\n    '1234567890@c.us'\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Mark multiple chats as unread\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  action: 'unread',\n  chats: [\n    '1234567890@c.us',\n    '1234567890@c.us'\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Assign multiple chats\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  action: 'assign',\n  params: {\n    agent: '<AGENT-ID>'\n  },\n  chats: [\n    '1234567890@c.us',\n    '1234567890@c.us'\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Assign multiple chats to a department\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  action: 'assign',\n  params: {\n    department: '<DEPARTMENT_ID>'\n  },\n  chats: [\n    '1234567890@c.us',\n    '1234567890@c.us'\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Unassign multiple chats\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  action: 'unassign',\n  chats: [\n    '1234567890@c.us',\n    '1234567890@c.us'\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Update labels\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  action: 'labels',\n  chats: [\n    '1234567890@c.us',\n    '1234567890@c.us'\n  ],\n  params: {\n    add: [\n      'label1',\n      'label2'\n    ],\n    remove: [\n      'label3'\n    ]\n  }\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Resolve multiple chats\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats', [\n  'body' => '{\"action\":\"resolve\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Mark multiple chats as unread\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats', [\n  'body' => '{\"action\":\"unread\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Assign multiple chats\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats', [\n  'body' => '{\"action\":\"assign\",\"params\":{\"agent\":\"<AGENT-ID>\"},\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Assign multiple chats to a department\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats', [\n  'body' => '{\"action\":\"assign\",\"params\":{\"department\":\"<DEPARTMENT_ID>\"},\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Unassign multiple chats\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats', [\n  'body' => '{\"action\":\"unassign\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Update labels\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats', [\n  'body' => '{\"action\":\"labels\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"],\"params\":{\"add\":[\"label1\",\"label2\"],\"remove\":[\"label3\"]}}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Resolve multiple chats\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'action' => 'resolve',\n  'chats' => [\n    '1234567890@c.us',\n    '1234567890@c.us'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Mark multiple chats as unread\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'action' => 'unread',\n  'chats' => [\n    '1234567890@c.us',\n    '1234567890@c.us'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Assign multiple chats\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'action' => 'assign',\n  'params' => [\n    'agent' => '<AGENT-ID>'\n  ],\n  'chats' => [\n    '1234567890@c.us',\n    '1234567890@c.us'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Assign multiple chats to a department\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'action' => 'assign',\n  'params' => [\n    'department' => '<DEPARTMENT_ID>'\n  ],\n  'chats' => [\n    '1234567890@c.us',\n    '1234567890@c.us'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Unassign multiple chats\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'action' => 'unassign',\n  'chats' => [\n    '1234567890@c.us',\n    '1234567890@c.us'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Update labels\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'action' => 'labels',\n  'chats' => [\n    '1234567890@c.us',\n    '1234567890@c.us'\n  ],\n  'params' => [\n    'add' => [\n        'label1',\n        'label2'\n    ],\n    'remove' => [\n        'label3'\n    ]\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Resolve multiple chats\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'action' => 'resolve',\n    'chats' => [\n        '1234567890@c.us',\n        '1234567890@c.us'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Mark multiple chats as unread\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'action' => 'unread',\n    'chats' => [\n        '1234567890@c.us',\n        '1234567890@c.us'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Assign multiple chats\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'action' => 'assign',\n    'params' => [\n        'agent' => '<AGENT-ID>'\n    ],\n    'chats' => [\n        '1234567890@c.us',\n        '1234567890@c.us'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Assign multiple chats to a department\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'action' => 'assign',\n    'params' => [\n        'department' => '<DEPARTMENT_ID>'\n    ],\n    'chats' => [\n        '1234567890@c.us',\n        '1234567890@c.us'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Unassign multiple chats\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'action' => 'unassign',\n    'chats' => [\n        '1234567890@c.us',\n        '1234567890@c.us'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Update labels\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'action' => 'labels',\n    'chats' => [\n        '1234567890@c.us',\n        '1234567890@c.us'\n    ],\n    'params' => [\n        'add' => [\n                'label1',\n                'label2'\n        ],\n        'remove' => [\n                'label3'\n        ]\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Resolve multiple chats\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"\n\npayload = {\n    \"action\": \"resolve\",\n    \"chats\": [\"1234567890@c.us\", \"1234567890@c.us\"]\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Mark multiple chats as unread\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"\n\npayload = {\n    \"action\": \"unread\",\n    \"chats\": [\"1234567890@c.us\", \"1234567890@c.us\"]\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Assign multiple chats\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"\n\npayload = {\n    \"action\": \"assign\",\n    \"params\": { \"agent\": \"<AGENT-ID>\" },\n    \"chats\": [\"1234567890@c.us\", \"1234567890@c.us\"]\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Assign multiple chats to a department\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"\n\npayload = {\n    \"action\": \"assign\",\n    \"params\": { \"department\": \"<DEPARTMENT_ID>\" },\n    \"chats\": [\"1234567890@c.us\", \"1234567890@c.us\"]\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Unassign multiple chats\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"\n\npayload = {\n    \"action\": \"unassign\",\n    \"chats\": [\"1234567890@c.us\", \"1234567890@c.us\"]\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Update labels\nimport requests\n\nurl = \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"\n\npayload = {\n    \"action\": \"labels\",\n    \"chats\": [\"1234567890@c.us\", \"1234567890@c.us\"],\n    \"params\": {\n        \"add\": [\"label1\", \"label2\"],\n        \"remove\": [\"label3\"]\n    }\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Resolve multiple chats\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"resolve\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Mark multiple chats as unread\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"unread\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Assign multiple chats\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"assign\",\"params\":{\"agent\":\"<AGENT-ID>\"},\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Assign multiple chats to a department\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"assign\",\"params\":{\"department\":\"<DEPARTMENT_ID>\"},\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Unassign multiple chats\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"unassign\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Update labels\nconst url = 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"labels\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"],\"params\":{\"add\":[\"label1\",\"label2\"],\"remove\":[\"label3\"]}}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Resolve multiple chats\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"action\":\"resolve\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Mark multiple chats as unread\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"action\":\"unread\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Assign multiple chats\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"action\":\"assign\",\"params\":{\"agent\":\"<AGENT-ID>\"},\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Assign multiple chats to a department\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"action\":\"assign\",\"params\":{\"department\":\"<DEPARTMENT_ID>\"},\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Unassign multiple chats\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"action\":\"unassign\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Update labels\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"action\":\"labels\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"],\"params\":{\"add\":[\"label1\",\"label2\"],\"remove\":[\"label3\"]}}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Resolve multiple chats\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"action\\\":\\\"resolve\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Mark multiple chats as unread\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"action\\\":\\\"unread\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Assign multiple chats\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"action\\\":\\\"assign\\\",\\\"params\\\":{\\\"agent\\\":\\\"<AGENT-ID>\\\"},\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Assign multiple chats to a department\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"action\\\":\\\"assign\\\",\\\"params\\\":{\\\"department\\\":\\\"<DEPARTMENT_ID>\\\"},\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Unassign multiple chats\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"action\\\":\\\"unassign\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Update labels\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"action\\\":\\\"labels\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"],\\\"params\\\":{\\\"add\\\":[\\\"label1\\\",\\\"label2\\\"],\\\"remove\\\":[\\\"label3\\\"]}}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Resolve multiple chats\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"\n\n\tpayload := strings.NewReader(\"{\\\"action\\\":\\\"resolve\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Mark multiple chats as unread\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"\n\n\tpayload := strings.NewReader(\"{\\\"action\\\":\\\"unread\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Assign multiple chats\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"\n\n\tpayload := strings.NewReader(\"{\\\"action\\\":\\\"assign\\\",\\\"params\\\":{\\\"agent\\\":\\\"<AGENT-ID>\\\"},\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Assign multiple chats to a department\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"\n\n\tpayload := strings.NewReader(\"{\\\"action\\\":\\\"assign\\\",\\\"params\\\":{\\\"department\\\":\\\"<DEPARTMENT_ID>\\\"},\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Unassign multiple chats\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"\n\n\tpayload := strings.NewReader(\"{\\\"action\\\":\\\"unassign\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Update labels\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"\n\n\tpayload := strings.NewReader(\"{\\\"action\\\":\\\"labels\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"],\\\"params\\\":{\\\"add\\\":[\\\"label1\\\",\\\"label2\\\"],\\\"remove\\\":[\\\"label3\\\"]}}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Resolve multiple chats\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"action\\\":\\\"resolve\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Mark multiple chats as unread\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"action\\\":\\\"unread\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Assign multiple chats\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"action\\\":\\\"assign\\\",\\\"params\\\":{\\\"agent\\\":\\\"<AGENT-ID>\\\"},\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Assign multiple chats to a department\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"action\\\":\\\"assign\\\",\\\"params\\\":{\\\"department\\\":\\\"<DEPARTMENT_ID>\\\"},\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Unassign multiple chats\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"action\\\":\\\"unassign\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Update labels\nvar client = new RestClient(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"action\\\":\\\"labels\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"],\\\"params\\\":{\\\"add\\\":[\\\"label1\\\",\\\"label2\\\"],\\\"remove\\\":[\\\"label3\\\"]}}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Resolve multiple chats\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"action\\\":\\\"resolve\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Mark multiple chats as unread\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"action\\\":\\\"unread\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Assign multiple chats\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"action\\\":\\\"assign\\\",\\\"params\\\":{\\\"agent\\\":\\\"<AGENT-ID>\\\"},\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Assign multiple chats to a department\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"action\\\":\\\"assign\\\",\\\"params\\\":{\\\"department\\\":\\\"<DEPARTMENT_ID>\\\"},\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Unassign multiple chats\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"action\\\":\\\"unassign\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Update labels\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"action\\\":\\\"labels\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"],\\\"params\\\":{\\\"add\\\":[\\\"label1\\\",\\\"label2\\\"],\\\"remove\\\":[\\\"label3\\\"]}}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Resolve multiple chats\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"action\\\":\\\"resolve\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\")\n  .asString();\n\n\n// Mark multiple chats as unread\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"action\\\":\\\"unread\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\")\n  .asString();\n\n\n// Assign multiple chats\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"action\\\":\\\"assign\\\",\\\"params\\\":{\\\"agent\\\":\\\"<AGENT-ID>\\\"},\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\")\n  .asString();\n\n\n// Assign multiple chats to a department\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"action\\\":\\\"assign\\\",\\\"params\\\":{\\\"department\\\":\\\"<DEPARTMENT_ID>\\\"},\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\")\n  .asString();\n\n\n// Unassign multiple chats\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"action\\\":\\\"unassign\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\")\n  .asString();\n\n\n// Update labels\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"action\\\":\\\"labels\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"],\\\"params\\\":{\\\"add\\\":[\\\"label1\\\",\\\"label2\\\"],\\\"remove\\\":[\\\"label3\\\"]}}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Resolve multiple chats\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"action\\\":\\\"resolve\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Mark multiple chats as unread\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"action\\\":\\\"unread\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Assign multiple chats\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"action\\\":\\\"assign\\\",\\\"params\\\":{\\\"agent\\\":\\\"<AGENT-ID>\\\"},\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Assign multiple chats to a department\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"action\\\":\\\"assign\\\",\\\"params\\\":{\\\"department\\\":\\\"<DEPARTMENT_ID>\\\"},\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Unassign multiple chats\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"action\\\":\\\"unassign\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Update labels\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"action\\\":\\\"labels\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"],\\\"params\\\":{\\\"add\\\":[\\\"label1\\\",\\\"label2\\\"],\\\"remove\\\":[\\\"label3\\\"]}}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Resolve multiple chats\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"action\\\":\\\"resolve\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Mark multiple chats as unread\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"action\\\":\\\"unread\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Assign multiple chats\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"action\\\":\\\"assign\\\",\\\"params\\\":{\\\"agent\\\":\\\"<AGENT-ID>\\\"},\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Assign multiple chats to a department\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"action\\\":\\\"assign\\\",\\\"params\\\":{\\\"department\\\":\\\"<DEPARTMENT_ID>\\\"},\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Unassign multiple chats\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"action\\\":\\\"unassign\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"]}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Update labels\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"action\\\":\\\"labels\\\",\\\"chats\\\":[\\\"1234567890@c.us\\\",\\\"1234567890@c.us\\\"],\\\"params\\\":{\\\"add\\\":[\\\"label1\\\",\\\"label2\\\"],\\\"remove\\\":[\\\"label3\\\"]}}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Resolve multiple chats\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"action\":\"resolve\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n\n\n# Mark multiple chats as unread\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"action\":\"unread\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n\n\n# Assign multiple chats\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"action\":\"assign\",\"params\":{\"agent\":\"<AGENT-ID>\"},\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n\n\n# Assign multiple chats to a department\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"action\":\"assign\",\"params\":{\"department\":\"<DEPARTMENT_ID>\"},\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n\n\n# Unassign multiple chats\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"action\":\"unassign\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"]}'\n\n\n# Update labels\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"action\":\"labels\",\"chats\":[\"1234567890@c.us\",\"1234567890@c.us\"],\"params\":{\"add\":[\"label1\",\"label2\"],\"remove\":[\"label3\"]}}'"},{"lang":"ObjC","source":"// Resolve multiple chats\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"action\": @\"resolve\",\n                              @\"chats\": @[ @\"1234567890@c.us\", @\"1234567890@c.us\" ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Mark multiple chats as unread\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"action\": @\"unread\",\n                              @\"chats\": @[ @\"1234567890@c.us\", @\"1234567890@c.us\" ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Assign multiple chats\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"action\": @\"assign\",\n                              @\"params\": @{ @\"agent\": @\"<AGENT-ID>\" },\n                              @\"chats\": @[ @\"1234567890@c.us\", @\"1234567890@c.us\" ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Assign multiple chats to a department\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"action\": @\"assign\",\n                              @\"params\": @{ @\"department\": @\"<DEPARTMENT_ID>\" },\n                              @\"chats\": @[ @\"1234567890@c.us\", @\"1234567890@c.us\" ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Unassign multiple chats\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"action\": @\"unassign\",\n                              @\"chats\": @[ @\"1234567890@c.us\", @\"1234567890@c.us\" ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Update labels\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"action\": @\"labels\",\n                              @\"chats\": @[ @\"1234567890@c.us\", @\"1234567890@c.us\" ],\n                              @\"params\": @{ @\"add\": @[ @\"label1\", @\"label2\" ], @\"remove\": @[ @\"label3\" ] } };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Resolve multiple chats\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"action\": \"resolve\",\n  \"chats\": [\"1234567890@c.us\", \"1234567890@c.us\"]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Mark multiple chats as unread\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"action\": \"unread\",\n  \"chats\": [\"1234567890@c.us\", \"1234567890@c.us\"]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Assign multiple chats\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"action\": \"assign\",\n  \"params\": [\"agent\": \"<AGENT-ID>\"],\n  \"chats\": [\"1234567890@c.us\", \"1234567890@c.us\"]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Assign multiple chats to a department\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"action\": \"assign\",\n  \"params\": [\"department\": \"<DEPARTMENT_ID>\"],\n  \"chats\": [\"1234567890@c.us\", \"1234567890@c.us\"]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Unassign multiple chats\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"action\": \"unassign\",\n  \"chats\": [\"1234567890@c.us\", \"1234567890@c.us\"]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Update labels\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"action\": \"labels\",\n  \"chats\": [\"1234567890@c.us\", \"1234567890@c.us\"],\n  \"params\": [\n    \"add\": [\"label1\", \"label2\"],\n    \"remove\": [\"label3\"]\n  ]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/chat/{deviceId}/bulk/chats\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}],"x-meta":{"method":"PATCH","path":"/io/{deviceId}/chats","samples":[{"comment":"Resolve multiple chats","body":{"action":"resolve","chats":["1234567890@c.us","1234567890@c.us"]}},{"comment":"Mark multiple chats as unread","body":{"action":"unread","chats":["1234567890@c.us","1234567890@c.us"]}},{"comment":"Assign multiple chats","body":{"action":"assign","params":{"agent":"<AGENT-ID>"},"chats":["1234567890@c.us","1234567890@c.us"]}},{"comment":"Unassign multiple chats","body":{"action":"unassign","chats":["1234567890@c.us","1234567890@c.us"]}}]}}},"/install/kv/{key}":{"parameters":[],"get":{"summary":"Read install key","description":"Read a key of the key-value store of the calling install.\n\n\n\nAnswers `{ value, expiresAt }`, or 404 `install:kv_not_found` when the key is not there or already expired.","operationId":"getInstallKey","security":[{"apiKey":[]}],"tags":["Integrations"],"parameters":[{"name":"key","in":"path","required":true,"type":"string","description":"Key of the store, matching `^[A-Za-z0-9:._-]{1,128}$`."}],"responses":{"400":{"description":"A key this store cannot serve"},"404":{"description":"No such key: `install:kv_not_found`"},"default":{"description":"The value and when it expires","schema":{"type":"object"}}}},"put":{"summary":"Write install key","description":"Write a key of the key-value store of the calling install, with a time to live between 1 second and 7 days.\n\n\n\nThere is no delete: a lock is released by writing it again with `ttlSec: 1`. `ifAbsent` writes only when the key is free and `ifValue` only when it holds that exact value; when the condition does not hold the answer is 409 `install:kv_conflict` with the live value in `meta.value`. An install holds 5000 live keys, keys of the reserved `rt:` prefix aside.","operationId":"setInstallKey","security":[{"apiKey":[]}],"tags":["Integrations"],"parameters":[{"name":"key","in":"path","required":true,"type":"string","description":"Key of the store, matching `^[A-Za-z0-9:._-]{1,128}$`."},{"name":"body","in":"body","required":true,"schema":{"type":"object"}}],"responses":{"400":{"description":"A key, value or ttl this store cannot take"},"409":{"description":"The condition did not hold, or the install is out of keys"},"default":{"description":"Written","schema":{"type":"object"}}}}},"/files/{fileId}/preview":{"parameters":[],"get":{"summary":"Preview image","description":"Download file preview image, if available in the given file.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Ffiles%2F%7BfileId%7D%2Fpreview)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"previewFile","security":[{"apiKey":[]}],"tags":["Files"],"produces":["image/jpeg"],"parameters":[],"responses":{"200":{"description":"Preview image in JPEG format"},"400":{"description":"Invalid file ID or image","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"File has no preview image available","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Preview image file content\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/files/{fileId}/preview \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Preview image file content\nhttp GET https://api.wassenger.com/v1/files/{fileId}/preview \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Preview image file content\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/files/{fileId}/preview';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Preview image file content\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/files/{fileId}/preview',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Preview image file content\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/files/{fileId}/preview');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Preview image file content\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/files/{fileId}/preview', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Preview image file content\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/files/{fileId}/preview');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Preview image file content\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/files/{fileId}/preview\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Preview image file content\nimport requests\n\nurl = \"https://api.wassenger.com/v1/files/{fileId}/preview\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Preview image file content\nconst url = 'https://api.wassenger.com/v1/files/{fileId}/preview';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Preview image file content\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/files/{fileId}/preview',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Preview image file content\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/files/{fileId}/preview\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Preview image file content\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/files/{fileId}/preview\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Preview image file content\nvar client = new RestClient(\"https://api.wassenger.com/v1/files/{fileId}/preview\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Preview image file content\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/files/{fileId}/preview\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Preview image file content\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/files/{fileId}/preview\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Preview image file content\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/files/{fileId}/preview\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Preview image file content\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/files/{fileId}/preview\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Preview image file content\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/files/{fileId}/preview' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Preview image file content\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/files/{fileId}/preview\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Preview image file content\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/files/{fileId}/preview\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/files/{fileId}/download":{"parameters":[],"get":{"summary":"Download file content","description":"Download file content based on its MIME type.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Ffiles%2F%7BfileId%7D%2Fdownload)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"downloadFile","security":[{"apiKey":[]}],"tags":["Files"],"produces":["image/*","audio/*","video/*","application/*"],"parameters":[],"responses":{"200":{"description":"Download file"},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"File not found or deleted","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"410":{"description":"File is no longer available on the server","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Download file content\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/files/{fileId}/download \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Download file content\nhttp GET https://api.wassenger.com/v1/files/{fileId}/download \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Download file content\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/files/{fileId}/download';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Download file content\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/files/{fileId}/download',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Download file content\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/files/{fileId}/download');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Download file content\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/files/{fileId}/download', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Download file content\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/files/{fileId}/download');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Download file content\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/files/{fileId}/download\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Download file content\nimport requests\n\nurl = \"https://api.wassenger.com/v1/files/{fileId}/download\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Download file content\nconst url = 'https://api.wassenger.com/v1/files/{fileId}/download';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Download file content\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/files/{fileId}/download',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Download file content\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/files/{fileId}/download\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Download file content\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/files/{fileId}/download\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Download file content\nvar client = new RestClient(\"https://api.wassenger.com/v1/files/{fileId}/download\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Download file content\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/files/{fileId}/download\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Download file content\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/files/{fileId}/download\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Download file content\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/files/{fileId}/download\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Download file content\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/files/{fileId}/download\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Download file content\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/files/{fileId}/download' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Download file content\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/files/{fileId}/download\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Download file content\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/files/{fileId}/download\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/files/{fileId}":{"parameters":[],"get":{"summary":"Get file information","description":"Get file information by ID\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Ffiles%2F%7Bid%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getFile","security":[{"apiKey":[]}],"tags":["Files"],"produces":["application/json"],"parameters":[],"responses":{"200":{"description":"File document","schema":{"$ref":"#/definitions/file"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get file information\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/files/{id} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get file information\nhttp GET https://api.wassenger.com/v1/files/{id} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get file information\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/files/{id}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get file information\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/files/{id}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get file information\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/files/{id}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get file information\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/files/{id}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get file information\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/files/{id}');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get file information\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/files/{id}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get file information\nimport requests\n\nurl = \"https://api.wassenger.com/v1/files/{id}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get file information\nconst url = 'https://api.wassenger.com/v1/files/{id}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get file information\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/files/{id}',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get file information\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/files/{id}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get file information\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/files/{id}\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get file information\nvar client = new RestClient(\"https://api.wassenger.com/v1/files/{id}\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get file information\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/files/{id}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get file information\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/files/{id}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get file information\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/files/{id}\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get file information\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/files/{id}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get file information\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/files/{id}' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get file information\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/files/{id}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get file information\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/files/{id}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Update file","description":"Update an existtent file information metadata.\n\n\n\nYou can update the following file fields:\n\n- **filename**\n\n- **reference**\n\n- **expiration**\n\n- **permission**\n\n- **tags** (list of string)\n\n- **format** (only for video and audio file types)\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Ffiles%2F%7Bid%7D&method=PATCH&body=%7B%0A%20%20%22filename%22%3A%20%22newname.jpg%22%2C%0A%20%20%22tags%22%3A%20%5B%0A%20%20%20%20%22foo%22%2C%0A%20%20%20%20%22bar%22%0A%20%20%5D%2C%0A%20%20%22reference%22%3A%20%22123456789%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateFile","security":[{"apiKey":[]}],"tags":["Files"],"produces":["application/json"],"parameters":[{"in":"body","name":"file","schema":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":200},"reference":{"type":"string","minLength":2,"maxLength":150},"format":{"type":"string","enum":["gif","ptt","native"],"default":"native"},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":50},"minItems":1,"maxItems":10},"message":{"type":"string","minLength":0,"maxLength":15000,"description":"Optional media file text caption to use when deliverying the message - Only applicable to image and video media files, otherwise ignored. In case there is no message body field defined in the actual message to be delivered."},"expiration":{"type":"string","minLength":2,"maxLength":5,"enum":["10m","30m","1h","6h","12h","1d","2d","3d","5d","6d","7d","15d","30d","60d","90d","120d","180d","360d","1y","2y"]},"permission":{"type":"string","enum":["public","readonly","private"],"description":"Optional file access permission. Defaults to `public`: all team members can access, download and send the file. If set to `private` only the file owner can access, download and send the file.","default":"public"}},"additionalProperties":false}}],"responses":{"202":{"description":"Update file document","schema":{"$ref":"#/definitions/file"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Update file metadata\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/files/{id} \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"filename\":\"newname.jpg\",\"tags\":[\"foo\",\"bar\"],\"reference\":\"123456789\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Update file metadata\necho '{\"filename\":\"newname.jpg\",\"tags\":[\"foo\",\"bar\"],\"reference\":\"123456789\"}' |  \\\n  http PATCH https://api.wassenger.com/v1/files/{id} \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Update file metadata\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/files/{id}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"filename\":\"newname.jpg\",\"tags\":[\"foo\",\"bar\"],\"reference\":\"123456789\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Update file metadata\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/files/{id}',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {filename: 'newname.jpg', tags: ['foo', 'bar'], reference: '123456789'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Update file metadata\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/files/{id}');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  filename: 'newname.jpg',\n  tags: [\n    'foo',\n    'bar'\n  ],\n  reference: '123456789'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Update file metadata\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/files/{id}', [\n  'body' => '{\"filename\":\"newname.jpg\",\"tags\":[\"foo\",\"bar\"],\"reference\":\"123456789\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Update file metadata\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'filename' => 'newname.jpg',\n  'tags' => [\n    'foo',\n    'bar'\n  ],\n  'reference' => '123456789'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/files/{id}');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Update file metadata\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/files/{id}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'filename' => 'newname.jpg',\n    'tags' => [\n        'foo',\n        'bar'\n    ],\n    'reference' => '123456789'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Update file metadata\nimport requests\n\nurl = \"https://api.wassenger.com/v1/files/{id}\"\n\npayload = {\n    \"filename\": \"newname.jpg\",\n    \"tags\": [\"foo\", \"bar\"],\n    \"reference\": \"123456789\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update file metadata\nconst url = 'https://api.wassenger.com/v1/files/{id}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"filename\":\"newname.jpg\",\"tags\":[\"foo\",\"bar\"],\"reference\":\"123456789\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update file metadata\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/files/{id}',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"filename\":\"newname.jpg\",\"tags\":[\"foo\",\"bar\"],\"reference\":\"123456789\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Update file metadata\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/files/{id}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"filename\\\":\\\"newname.jpg\\\",\\\"tags\\\":[\\\"foo\\\",\\\"bar\\\"],\\\"reference\\\":\\\"123456789\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Update file metadata\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/files/{id}\"\n\n\tpayload := strings.NewReader(\"{\\\"filename\\\":\\\"newname.jpg\\\",\\\"tags\\\":[\\\"foo\\\",\\\"bar\\\"],\\\"reference\\\":\\\"123456789\\\"}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Update file metadata\nvar client = new RestClient(\"https://api.wassenger.com/v1/files/{id}\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"filename\\\":\\\"newname.jpg\\\",\\\"tags\\\":[\\\"foo\\\",\\\"bar\\\"],\\\"reference\\\":\\\"123456789\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Update file metadata\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/files/{id}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"filename\\\":\\\"newname.jpg\\\",\\\"tags\\\":[\\\"foo\\\",\\\"bar\\\"],\\\"reference\\\":\\\"123456789\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Update file metadata\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/files/{id}\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"filename\\\":\\\"newname.jpg\\\",\\\"tags\\\":[\\\"foo\\\",\\\"bar\\\"],\\\"reference\\\":\\\"123456789\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Update file metadata\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"filename\\\":\\\"newname.jpg\\\",\\\"tags\\\":[\\\"foo\\\",\\\"bar\\\"],\\\"reference\\\":\\\"123456789\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/files/{id}\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Update file metadata\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/files/{id}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"filename\\\":\\\"newname.jpg\\\",\\\"tags\\\":[\\\"foo\\\",\\\"bar\\\"],\\\"reference\\\":\\\"123456789\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Update file metadata\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/files/{id}' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"filename\":\"newname.jpg\",\"tags\":[\"foo\",\"bar\"],\"reference\":\"123456789\"}'"},{"lang":"ObjC","source":"// Update file metadata\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"filename\": @\"newname.jpg\",\n                              @\"tags\": @[ @\"foo\", @\"bar\" ],\n                              @\"reference\": @\"123456789\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/files/{id}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Update file metadata\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"filename\": \"newname.jpg\",\n  \"tags\": [\"foo\", \"bar\"],\n  \"reference\": \"123456789\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/files/{id}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Delete file","description":"Deletes file by ID. This action cannot be undone.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Ffiles%2F%7Bid%7D&method=DELETE&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deleteFile","security":[{"apiKey":[]}],"tags":["Files"],"produces":["application/json"],"parameters":[],"responses":{"204":{"description":"File was deleted successfully"},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Delete file\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/files/{id} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Delete file\nhttp DELETE https://api.wassenger.com/v1/files/{id} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Delete file\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/files/{id}';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Delete file\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/files/{id}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Delete file\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/files/{id}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Delete file\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/files/{id}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Delete file\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/files/{id}');\n$request->setRequestMethod('DELETE');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Delete file\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/files/{id}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Delete file\nimport requests\n\nurl = \"https://api.wassenger.com/v1/files/{id}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.delete(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete file\nconst url = 'https://api.wassenger.com/v1/files/{id}';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete file\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/files/{id}',\n  method: 'DELETE',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Delete file\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/files/{id}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Delete file\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/files/{id}\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Delete file\nvar client = new RestClient(\"https://api.wassenger.com/v1/files/{id}\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Delete file\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/files/{id}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Delete file\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/files/{id}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Delete file\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/files/{id}\")\n  .delete(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Delete file\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/files/{id}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Delete file\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/files/{id}' -Method DELETE -Headers $headers"},{"lang":"ObjC","source":"// Delete file\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/files/{id}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Delete file\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/files/{id}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/team":{"parameters":[],"get":{"summary":"Get users per number","description":"Get available team member users with access to the current WhatsApp device by ID.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fteam)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getDeviceTeamMembers","security":[{"apiKey":[]}],"tags":["Team Members"],"responses":{"200":{"description":"List of available team members","schema":{"type":"array","items":{"$ref":"#/definitions/user"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get WhatsApp device team members available\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/team \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get WhatsApp device team members available\nhttp GET https://api.wassenger.com/v1/devices/{deviceId}/team \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get WhatsApp device team members available\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/team';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get WhatsApp device team members available\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/team',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get WhatsApp device team members available\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/team');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get WhatsApp device team members available\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/team', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get WhatsApp device team members available\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/team');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get WhatsApp device team members available\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/team\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get WhatsApp device team members available\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/team\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get WhatsApp device team members available\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/team';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get WhatsApp device team members available\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/team',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get WhatsApp device team members available\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/team\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get WhatsApp device team members available\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/team\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get WhatsApp device team members available\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/team\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get WhatsApp device team members available\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/team\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get WhatsApp device team members available\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/team\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get WhatsApp device team members available\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/team\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get WhatsApp device team members available\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/team\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get WhatsApp device team members available\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/team' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get WhatsApp device team members available\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/team\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get WhatsApp device team members available\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/team\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"post":{"summary":"Create user","description":"Create new a user and grant access to the current WhatsApp number device team members.\n\n\n\nThis action will grant immediate access the user to the multi-agent chat in the specific WhatsApp number.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fteam&method=POST&body=%7B%0A%20%20%22email%22%3A%20%22agent.name%40company.com%22%2C%0A%20%20%22displayName%22%3A%20%22John%20Doe%22%2C%0A%20%20%22password%22%3A%20%22r2nd0m3pas%24w0rd%22%2C%0A%20%20%22color%22%3A%20%22green%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"createDeviceUser","tags":["Team Members"],"security":[{"apiKey":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"user","description":"Create user and grant access to the specific WhatsApp device","schema":{"type":"object","properties":{"displayName":{"type":"string","minLength":2,"maxLength":30},"email":{"type":"string","format":"email","minLength":5,"maxLength":100},"password":{"type":"string","minLength":5,"maxLength":50},"role":{"type":"string","enum":["admin","supervisor","agent"],"default":"agent"},"invite":{"type":"boolean","default":false},"color":{"type":"string","enum":["blue","azure","indigo","purple","pink","red","orange","yellow","lime","green","teal","cyan","gray","gray-dark"]}},"required":["displayName","email","password","role","color"],"additionalProperties":false}}],"responses":{"200":{"description":"User created and access granted","schema":{"$ref":"#/definitions/user"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing team management permission, or plan upgrade required","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"A user of the account who is not one of its agents already has the email (errorCode `user:email_exists`). An existing agent with the email is given access instead.","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Maximum agents reached - Plan upgrade required","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation not available - Try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Create a new user and grant access to the specific WhatsApp device\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/team \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"email\":\"agent.name@company.com\",\"displayName\":\"John Doe\",\"password\":\"r2nd0m3pas$w0rd\",\"color\":\"green\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Create a new user and grant access to the specific WhatsApp device\necho '{\"email\":\"agent.name@company.com\",\"displayName\":\"John Doe\",\"password\":\"r2nd0m3pas$w0rd\",\"color\":\"green\"}' |  \\\n  http POST https://api.wassenger.com/v1/devices/{deviceId}/team \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Create a new user and grant access to the specific WhatsApp device\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/team';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"email\":\"agent.name@company.com\",\"displayName\":\"John Doe\",\"password\":\"r2nd0m3pas$w0rd\",\"color\":\"green\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Create a new user and grant access to the specific WhatsApp device\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/team',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    email: 'agent.name@company.com',\n    displayName: 'John Doe',\n    password: 'r2nd0m3pas$w0rd',\n    color: 'green'\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Create a new user and grant access to the specific WhatsApp device\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/team');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  email: 'agent.name@company.com',\n  displayName: 'John Doe',\n  password: 'r2nd0m3pas$w0rd',\n  color: 'green'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Create a new user and grant access to the specific WhatsApp device\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/team', [\n  'body' => '{\"email\":\"agent.name@company.com\",\"displayName\":\"John Doe\",\"password\":\"r2nd0m3pas$w0rd\",\"color\":\"green\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Create a new user and grant access to the specific WhatsApp device\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'email' => 'agent.name@company.com',\n  'displayName' => 'John Doe',\n  'password' => 'r2nd0m3pas$w0rd',\n  'color' => 'green'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/team');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Create a new user and grant access to the specific WhatsApp device\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/team\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'email' => 'agent.name@company.com',\n    'displayName' => 'John Doe',\n    'password' => 'r2nd0m3pas$w0rd',\n    'color' => 'green'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Create a new user and grant access to the specific WhatsApp device\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/team\"\n\npayload = {\n    \"email\": \"agent.name@company.com\",\n    \"displayName\": \"John Doe\",\n    \"password\": \"r2nd0m3pas$w0rd\",\n    \"color\": \"green\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create a new user and grant access to the specific WhatsApp device\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/team';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"email\":\"agent.name@company.com\",\"displayName\":\"John Doe\",\"password\":\"r2nd0m3pas$w0rd\",\"color\":\"green\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create a new user and grant access to the specific WhatsApp device\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/team',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"email\":\"agent.name@company.com\",\"displayName\":\"John Doe\",\"password\":\"r2nd0m3pas$w0rd\",\"color\":\"green\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Create a new user and grant access to the specific WhatsApp device\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/team\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"email\\\":\\\"agent.name@company.com\\\",\\\"displayName\\\":\\\"John Doe\\\",\\\"password\\\":\\\"r2nd0m3pas$w0rd\\\",\\\"color\\\":\\\"green\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Create a new user and grant access to the specific WhatsApp device\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/team\"\n\n\tpayload := strings.NewReader(\"{\\\"email\\\":\\\"agent.name@company.com\\\",\\\"displayName\\\":\\\"John Doe\\\",\\\"password\\\":\\\"r2nd0m3pas$w0rd\\\",\\\"color\\\":\\\"green\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Create a new user and grant access to the specific WhatsApp device\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/team\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"email\\\":\\\"agent.name@company.com\\\",\\\"displayName\\\":\\\"John Doe\\\",\\\"password\\\":\\\"r2nd0m3pas$w0rd\\\",\\\"color\\\":\\\"green\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Create a new user and grant access to the specific WhatsApp device\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/team\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"email\\\":\\\"agent.name@company.com\\\",\\\"displayName\\\":\\\"John Doe\\\",\\\"password\\\":\\\"r2nd0m3pas$w0rd\\\",\\\"color\\\":\\\"green\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Create a new user and grant access to the specific WhatsApp device\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/team\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"email\\\":\\\"agent.name@company.com\\\",\\\"displayName\\\":\\\"John Doe\\\",\\\"password\\\":\\\"r2nd0m3pas$w0rd\\\",\\\"color\\\":\\\"green\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Create a new user and grant access to the specific WhatsApp device\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"email\\\":\\\"agent.name@company.com\\\",\\\"displayName\\\":\\\"John Doe\\\",\\\"password\\\":\\\"r2nd0m3pas$w0rd\\\",\\\"color\\\":\\\"green\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/team\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Create a new user and grant access to the specific WhatsApp device\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/team\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"email\\\":\\\"agent.name@company.com\\\",\\\"displayName\\\":\\\"John Doe\\\",\\\"password\\\":\\\"r2nd0m3pas$w0rd\\\",\\\"color\\\":\\\"green\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Create a new user and grant access to the specific WhatsApp device\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/team' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"email\":\"agent.name@company.com\",\"displayName\":\"John Doe\",\"password\":\"r2nd0m3pas$w0rd\",\"color\":\"green\"}'"},{"lang":"ObjC","source":"// Create a new user and grant access to the specific WhatsApp device\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"email\": @\"agent.name@company.com\",\n                              @\"displayName\": @\"John Doe\",\n                              @\"password\": @\"r2nd0m3pas$w0rd\",\n                              @\"color\": @\"green\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/team\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Create a new user and grant access to the specific WhatsApp device\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"email\": \"agent.name@company.com\",\n  \"displayName\": \"John Doe\",\n  \"password\": \"r2nd0m3pas$w0rd\",\n  \"color\": \"green\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/team\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Grant user access","description":"Grant chat access as a team member to a specific already existing user by ID to the current WhatsApp number.\n\nAn invitation email will be sent automatically to the new user after acess is granted.\n\nThe user can log in if they know the password without needing to recieve the invitation email.\n\nIf the user does not exist, the API will return an error. You can create a new user by using the [Create user](#operation/createUser) endpoint.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fteam&method=PATCH&body=%7B%0A%20%20%22id%22%3A%20%220f096004d10c300010500e41%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"grantDeviceUserAccess","tags":["Team Members"],"security":[{"apiKey":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"user","description":"Grant chat access to an existing user to the current WhatsApp device.","schema":{"type":"object","properties":{"id":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24}},"required":["id"],"additionalProperties":false}}],"responses":{"200":{"description":"User granted access to the WhatsApp number team","schema":{"$ref":"#/definitions/user"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing team management permission, or plan upgrade required","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"User already exists with the same email","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Maximum team members reached - Plan upgrade required","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation not available - Try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Grant access to a given user by ID to specified WhatsApp device chat\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/team \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"id\":\"0f096004d10c300010500e41\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Grant access to a given user by ID to specified WhatsApp device chat\necho '{\"id\":\"0f096004d10c300010500e41\"}' |  \\\n  http PATCH https://api.wassenger.com/v1/devices/{deviceId}/team \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Grant access to a given user by ID to specified WhatsApp device chat\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/team';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"id\":\"0f096004d10c300010500e41\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Grant access to a given user by ID to specified WhatsApp device chat\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/team',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {id: '0f096004d10c300010500e41'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Grant access to a given user by ID to specified WhatsApp device chat\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/team');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  id: '0f096004d10c300010500e41'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Grant access to a given user by ID to specified WhatsApp device chat\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/team', [\n  'body' => '{\"id\":\"0f096004d10c300010500e41\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Grant access to a given user by ID to specified WhatsApp device chat\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'id' => '0f096004d10c300010500e41'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/team');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Grant access to a given user by ID to specified WhatsApp device chat\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/team\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'id' => '0f096004d10c300010500e41'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Grant access to a given user by ID to specified WhatsApp device chat\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/team\"\n\npayload = { \"id\": \"0f096004d10c300010500e41\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Grant access to a given user by ID to specified WhatsApp device chat\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/team';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"id\":\"0f096004d10c300010500e41\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Grant access to a given user by ID to specified WhatsApp device chat\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/team',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"id\":\"0f096004d10c300010500e41\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Grant access to a given user by ID to specified WhatsApp device chat\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/team\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"id\\\":\\\"0f096004d10c300010500e41\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Grant access to a given user by ID to specified WhatsApp device chat\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/team\"\n\n\tpayload := strings.NewReader(\"{\\\"id\\\":\\\"0f096004d10c300010500e41\\\"}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Grant access to a given user by ID to specified WhatsApp device chat\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/team\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"id\\\":\\\"0f096004d10c300010500e41\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Grant access to a given user by ID to specified WhatsApp device chat\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/team\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"id\\\":\\\"0f096004d10c300010500e41\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Grant access to a given user by ID to specified WhatsApp device chat\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/devices/{deviceId}/team\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"id\\\":\\\"0f096004d10c300010500e41\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Grant access to a given user by ID to specified WhatsApp device chat\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"id\\\":\\\"0f096004d10c300010500e41\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/team\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Grant access to a given user by ID to specified WhatsApp device chat\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/team\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"id\\\":\\\"0f096004d10c300010500e41\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Grant access to a given user by ID to specified WhatsApp device chat\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/team' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"id\":\"0f096004d10c300010500e41\"}'"},{"lang":"ObjC","source":"// Grant access to a given user by ID to specified WhatsApp device chat\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"id\": @\"0f096004d10c300010500e41\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/team\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Grant access to a given user by ID to specified WhatsApp device chat\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"id\": \"0f096004d10c300010500e41\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/team\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Revoke user access","description":"Revoke user access from a specific WhatsApp number. This action will remove the user from the WhatsApp number team members and restrict access immediately to it.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fteam&method=DELETE&body=%7B%0A%20%20%22id%22%3A%20%220f096004d10c300010500e41%22%2C%0A%20%20%22action%22%3A%20%22resolve%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"revokeDeviceUserAccess","security":[{"apiKey":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"user","description":"Revoke chat access for the given user by email or user ID","schema":{"type":"object","properties":{"email":{"type":"string","format":"email","minLength":5,"maxLength":100,"description":"Remove agent by its email. If this field is not defined, `id` must be defined."},"id":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Remove agent by its ID. If this field is not defined, `email` must be defined."},"action":{"type":"string","enum":["unassign","reassign","resolve"],"description":"Action to be applied to all chats assigned to the agent to be removed. Defaults to `unassign` all chats.","default":"unassign"},"assign":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Required if `action` = `reassign`. Defines the target agent ID (24 hexadecimal characters) to reassign all chats that were assigned to the agent to be removed."},"remove":{"type":"boolean","description":"Use `true` in order to completely remove the agent from the system, even if it has access to other WhatsApp numbers.","default":false}},"additionalProperties":false}}],"tags":["Team Members"],"responses":{"204":{"description":"User access revoked successfully"},"400":{"description":"Invalid body data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing team management permission, or plan upgrade required","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not found user or device","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation not available - Try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Revoke user access by ID in the current WhatsApp number and resolve all the user assigned chats\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/team \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"id\":\"0f096004d10c300010500e41\",\"action\":\"resolve\"}'\n\n\n// Revoke user access by email in the current WhatsApp number and unassign all the user chats\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/team \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"id\":\"agent.name@company.com\",\"action\":\"unassign\"}'\n\n\n// Revoke user access by email in the current WhatsApp number and re-assign all the user chats to a new user\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/team \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"id\":\"agent.name@company.com\",\"action\":\"reassign\",\"assign\":\"NEW USER ID TO ASSIGN\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Revoke user access by ID in the current WhatsApp number and resolve all the user assigned chats\necho '{\"id\":\"0f096004d10c300010500e41\",\"action\":\"resolve\"}' |  \\\n  http DELETE https://api.wassenger.com/v1/devices/{deviceId}/team \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Revoke user access by email in the current WhatsApp number and unassign all the user chats\necho '{\"id\":\"agent.name@company.com\",\"action\":\"unassign\"}' |  \\\n  http DELETE https://api.wassenger.com/v1/devices/{deviceId}/team \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Revoke user access by email in the current WhatsApp number and re-assign all the user chats to a new user\necho '{\"id\":\"agent.name@company.com\",\"action\":\"reassign\",\"assign\":\"NEW USER ID TO ASSIGN\"}' |  \\\n  http DELETE https://api.wassenger.com/v1/devices/{deviceId}/team \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Revoke user access by ID in the current WhatsApp number and resolve all the user assigned chats\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/team';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"id\":\"0f096004d10c300010500e41\",\"action\":\"resolve\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Revoke user access by email in the current WhatsApp number and unassign all the user chats\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/team';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"id\":\"agent.name@company.com\",\"action\":\"unassign\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Revoke user access by email in the current WhatsApp number and re-assign all the user chats to a new user\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/team';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"id\":\"agent.name@company.com\",\"action\":\"reassign\",\"assign\":\"NEW USER ID TO ASSIGN\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Revoke user access by ID in the current WhatsApp number and resolve all the user assigned chats\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/team',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {id: '0f096004d10c300010500e41', action: 'resolve'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Revoke user access by email in the current WhatsApp number and unassign all the user chats\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/team',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {id: 'agent.name@company.com', action: 'unassign'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Revoke user access by email in the current WhatsApp number and re-assign all the user chats to a new user\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/team',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    id: 'agent.name@company.com',\n    action: 'reassign',\n    assign: 'NEW USER ID TO ASSIGN'\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Revoke user access by ID in the current WhatsApp number and resolve all the user assigned chats\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/team');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  id: '0f096004d10c300010500e41',\n  action: 'resolve'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Revoke user access by email in the current WhatsApp number and unassign all the user chats\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/team');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  id: 'agent.name@company.com',\n  action: 'unassign'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Revoke user access by email in the current WhatsApp number and re-assign all the user chats to a new user\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/team');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  id: 'agent.name@company.com',\n  action: 'reassign',\n  assign: 'NEW USER ID TO ASSIGN'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Revoke user access by ID in the current WhatsApp number and resolve all the user assigned chats\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/team', [\n  'body' => '{\"id\":\"0f096004d10c300010500e41\",\"action\":\"resolve\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Revoke user access by email in the current WhatsApp number and unassign all the user chats\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/team', [\n  'body' => '{\"id\":\"agent.name@company.com\",\"action\":\"unassign\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Revoke user access by email in the current WhatsApp number and re-assign all the user chats to a new user\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/team', [\n  'body' => '{\"id\":\"agent.name@company.com\",\"action\":\"reassign\",\"assign\":\"NEW USER ID TO ASSIGN\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Revoke user access by ID in the current WhatsApp number and resolve all the user assigned chats\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'id' => '0f096004d10c300010500e41',\n  'action' => 'resolve'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/team');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Revoke user access by email in the current WhatsApp number and unassign all the user chats\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'id' => 'agent.name@company.com',\n  'action' => 'unassign'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/team');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Revoke user access by email in the current WhatsApp number and re-assign all the user chats to a new user\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'id' => 'agent.name@company.com',\n  'action' => 'reassign',\n  'assign' => 'NEW USER ID TO ASSIGN'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/team');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Revoke user access by ID in the current WhatsApp number and resolve all the user assigned chats\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/team\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'id' => '0f096004d10c300010500e41',\n    'action' => 'resolve'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Revoke user access by email in the current WhatsApp number and unassign all the user chats\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/team\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'id' => 'agent.name@company.com',\n    'action' => 'unassign'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Revoke user access by email in the current WhatsApp number and re-assign all the user chats to a new user\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/team\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'id' => 'agent.name@company.com',\n    'action' => 'reassign',\n    'assign' => 'NEW USER ID TO ASSIGN'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Revoke user access by ID in the current WhatsApp number and resolve all the user assigned chats\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/team\"\n\npayload = {\n    \"id\": \"0f096004d10c300010500e41\",\n    \"action\": \"resolve\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Revoke user access by email in the current WhatsApp number and unassign all the user chats\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/team\"\n\npayload = {\n    \"id\": \"agent.name@company.com\",\n    \"action\": \"unassign\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Revoke user access by email in the current WhatsApp number and re-assign all the user chats to a new user\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/team\"\n\npayload = {\n    \"id\": \"agent.name@company.com\",\n    \"action\": \"reassign\",\n    \"assign\": \"NEW USER ID TO ASSIGN\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Revoke user access by ID in the current WhatsApp number and resolve all the user assigned chats\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/team';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"id\":\"0f096004d10c300010500e41\",\"action\":\"resolve\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Revoke user access by email in the current WhatsApp number and unassign all the user chats\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/team';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"id\":\"agent.name@company.com\",\"action\":\"unassign\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Revoke user access by email in the current WhatsApp number and re-assign all the user chats to a new user\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/team';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"id\":\"agent.name@company.com\",\"action\":\"reassign\",\"assign\":\"NEW USER ID TO ASSIGN\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Revoke user access by ID in the current WhatsApp number and resolve all the user assigned chats\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/team',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"id\":\"0f096004d10c300010500e41\",\"action\":\"resolve\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Revoke user access by email in the current WhatsApp number and unassign all the user chats\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/team',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"id\":\"agent.name@company.com\",\"action\":\"unassign\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Revoke user access by email in the current WhatsApp number and re-assign all the user chats to a new user\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/team',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"id\":\"agent.name@company.com\",\"action\":\"reassign\",\"assign\":\"NEW USER ID TO ASSIGN\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Revoke user access by ID in the current WhatsApp number and resolve all the user assigned chats\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/team\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"id\\\":\\\"0f096004d10c300010500e41\\\",\\\"action\\\":\\\"resolve\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Revoke user access by email in the current WhatsApp number and unassign all the user chats\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/team\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"id\\\":\\\"agent.name@company.com\\\",\\\"action\\\":\\\"unassign\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Revoke user access by email in the current WhatsApp number and re-assign all the user chats to a new user\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/team\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"id\\\":\\\"agent.name@company.com\\\",\\\"action\\\":\\\"reassign\\\",\\\"assign\\\":\\\"NEW USER ID TO ASSIGN\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Revoke user access by ID in the current WhatsApp number and resolve all the user assigned chats\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/team\"\n\n\tpayload := strings.NewReader(\"{\\\"id\\\":\\\"0f096004d10c300010500e41\\\",\\\"action\\\":\\\"resolve\\\"}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Revoke user access by email in the current WhatsApp number and unassign all the user chats\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/team\"\n\n\tpayload := strings.NewReader(\"{\\\"id\\\":\\\"agent.name@company.com\\\",\\\"action\\\":\\\"unassign\\\"}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Revoke user access by email in the current WhatsApp number and re-assign all the user chats to a new user\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/team\"\n\n\tpayload := strings.NewReader(\"{\\\"id\\\":\\\"agent.name@company.com\\\",\\\"action\\\":\\\"reassign\\\",\\\"assign\\\":\\\"NEW USER ID TO ASSIGN\\\"}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Revoke user access by ID in the current WhatsApp number and resolve all the user assigned chats\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/team\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"id\\\":\\\"0f096004d10c300010500e41\\\",\\\"action\\\":\\\"resolve\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Revoke user access by email in the current WhatsApp number and unassign all the user chats\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/team\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"id\\\":\\\"agent.name@company.com\\\",\\\"action\\\":\\\"unassign\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Revoke user access by email in the current WhatsApp number and re-assign all the user chats to a new user\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/team\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"id\\\":\\\"agent.name@company.com\\\",\\\"action\\\":\\\"reassign\\\",\\\"assign\\\":\\\"NEW USER ID TO ASSIGN\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Revoke user access by ID in the current WhatsApp number and resolve all the user assigned chats\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/team\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"id\\\":\\\"0f096004d10c300010500e41\\\",\\\"action\\\":\\\"resolve\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Revoke user access by email in the current WhatsApp number and unassign all the user chats\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/team\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"id\\\":\\\"agent.name@company.com\\\",\\\"action\\\":\\\"unassign\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Revoke user access by email in the current WhatsApp number and re-assign all the user chats to a new user\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/team\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"id\\\":\\\"agent.name@company.com\\\",\\\"action\\\":\\\"reassign\\\",\\\"assign\\\":\\\"NEW USER ID TO ASSIGN\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Revoke user access by ID in the current WhatsApp number and resolve all the user assigned chats\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/devices/{deviceId}/team\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"id\\\":\\\"0f096004d10c300010500e41\\\",\\\"action\\\":\\\"resolve\\\"}\")\n  .asString();\n\n\n// Revoke user access by email in the current WhatsApp number and unassign all the user chats\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/devices/{deviceId}/team\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"id\\\":\\\"agent.name@company.com\\\",\\\"action\\\":\\\"unassign\\\"}\")\n  .asString();\n\n\n// Revoke user access by email in the current WhatsApp number and re-assign all the user chats to a new user\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/devices/{deviceId}/team\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"id\\\":\\\"agent.name@company.com\\\",\\\"action\\\":\\\"reassign\\\",\\\"assign\\\":\\\"NEW USER ID TO ASSIGN\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Revoke user access by ID in the current WhatsApp number and resolve all the user assigned chats\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"id\\\":\\\"0f096004d10c300010500e41\\\",\\\"action\\\":\\\"resolve\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/team\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Revoke user access by email in the current WhatsApp number and unassign all the user chats\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"id\\\":\\\"agent.name@company.com\\\",\\\"action\\\":\\\"unassign\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/team\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Revoke user access by email in the current WhatsApp number and re-assign all the user chats to a new user\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"id\\\":\\\"agent.name@company.com\\\",\\\"action\\\":\\\"reassign\\\",\\\"assign\\\":\\\"NEW USER ID TO ASSIGN\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/team\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Revoke user access by ID in the current WhatsApp number and resolve all the user assigned chats\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/team\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"id\\\":\\\"0f096004d10c300010500e41\\\",\\\"action\\\":\\\"resolve\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Revoke user access by email in the current WhatsApp number and unassign all the user chats\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/team\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"id\\\":\\\"agent.name@company.com\\\",\\\"action\\\":\\\"unassign\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Revoke user access by email in the current WhatsApp number and re-assign all the user chats to a new user\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/team\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"id\\\":\\\"agent.name@company.com\\\",\\\"action\\\":\\\"reassign\\\",\\\"assign\\\":\\\"NEW USER ID TO ASSIGN\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Revoke user access by ID in the current WhatsApp number and resolve all the user assigned chats\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/team' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"id\":\"0f096004d10c300010500e41\",\"action\":\"resolve\"}'\n\n\n# Revoke user access by email in the current WhatsApp number and unassign all the user chats\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/team' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"id\":\"agent.name@company.com\",\"action\":\"unassign\"}'\n\n\n# Revoke user access by email in the current WhatsApp number and re-assign all the user chats to a new user\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/team' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"id\":\"agent.name@company.com\",\"action\":\"reassign\",\"assign\":\"NEW USER ID TO ASSIGN\"}'"},{"lang":"ObjC","source":"// Revoke user access by ID in the current WhatsApp number and resolve all the user assigned chats\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"id\": @\"0f096004d10c300010500e41\",\n                              @\"action\": @\"resolve\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/team\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Revoke user access by email in the current WhatsApp number and unassign all the user chats\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"id\": @\"agent.name@company.com\",\n                              @\"action\": @\"unassign\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/team\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Revoke user access by email in the current WhatsApp number and re-assign all the user chats to a new user\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"id\": @\"agent.name@company.com\",\n                              @\"action\": @\"reassign\",\n                              @\"assign\": @\"NEW USER ID TO ASSIGN\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/team\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Revoke user access by ID in the current WhatsApp number and resolve all the user assigned chats\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"id\": \"0f096004d10c300010500e41\",\n  \"action\": \"resolve\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/team\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Revoke user access by email in the current WhatsApp number and unassign all the user chats\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"id\": \"agent.name@company.com\",\n  \"action\": \"unassign\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/team\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Revoke user access by email in the current WhatsApp number and re-assign all the user chats to a new user\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"id\": \"agent.name@company.com\",\n  \"action\": \"reassign\",\n  \"assign\": \"NEW USER ID TO ASSIGN\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/team\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/sync":{"parameters":[],"get":{"description":"Force WhatsApp session status synchronization.\n\nA single session synchronization is allowed every 60 seconds, otherwise the API will return a `429 - Too Many Requests` error response.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fsync)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"syncSession","security":[{"apiKey":[]}],"tags":["Session"],"consumes":["application/json"],"parameters":[],"responses":{"200":{"description":"Synchronization information","schema":{"type":"object","properties":{"id":{"type":"string","description":"Device ID"},"alias":{"type":"string","description":"Device alias"},"phone":{"type":"string","description":"Device phone number in E.164 format"},"numberId":{"type":"string","description":"WhatsApp Business Account Number ID"},"connector":{"type":"string","description":"Connector type"},"healthy":{"type":"boolean","description":"Whether the session is healthy (online) or not"},"status":{"type":"string","description":"Device internal status. Allowed values are: operative, pending, removed, disabled, invalid"},"sessionStatus":{"type":"string","description":"WhatsApp session status. Allowed values are: new, authorize, authorizing, online, offline, timeout, timeout_sync, conflict"},"lastSyncAt":{"type":"string","description":"Last WhatsApp session synchronization time in standard date RFC3339 format"},"lastSyncSeconds":{"type":"integer","format":"int32","description":"Last WhatsApp session synchronization time in seconds"},"cached":{"type":"boolean","description":"Whether the response is cached or live from synchronization"},"waba":{"type":"object","description":"WhatsApp Business Account information, only for WABA enabled numbers","properties":{"id":{"type":"string","description":"WABA ID"},"name":{"type":"string","description":"WABA name"},"businessId":{"type":"string","description":"Business Manager ID"},"businessName":{"type":"string","description":"Business Manager name"},"status":{"type":"string","description":"Number connection status"},"accountStatus":{"type":"string","description":"WABA account status"},"connectionStatus":{"type":"string","description":"WABA connection status"},"sendMessageStatus":{"type":"string","description":"Send message capability/status for the WABA"},"reviewStatus":{"type":"string","description":"Review status for the WABA (e.g., pending, approved)"},"stage":{"type":"string","description":"WABA stage"},"timezone":{"type":"string","description":"WABA configured timezone"},"insights":{"type":"boolean","description":"Whether insights are enabled for this WABA"},"adAccountLinked":{"type":"boolean","description":"Whether a Facebook/Meta ad account is linked to this WABA"},"hasPaymentIssue":{"type":"boolean","description":"Whether the WABA has any payment issues"},"healthUnavailable":{"type":"boolean","description":"True when the connection to Meta can no longer be read (incomplete credentials, removed or expired) until the number is reconnected. hasPaymentIssue, sendMessageStatus and issues then come back as false, null and empty: unknown, not a clean reading."},"webhook":{"type":"object","description":"Last check of the subscription that makes WhatsApp send the notifications of this number (delivery statuses and inbound messages). Null until the number has been checked.","properties":{"state":{"type":"string","enum":["ok","missing","wrong_override","no_credentials","no_access"],"description":"ok: notifications are subscribed. missing: the subscription is gone and no notifications arrive until the number is reconnected. wrong_override: subscribed with a callback other than the one of this number. no_credentials and no_access: the WhatsApp Business Account could not be asked."},"checkedAt":{"type":"string","format":"date-time","description":"When the subscription was last checked"},"subscribedAt":{"type":"string","format":"date-time","description":"When the subscription was last made"}}},"issues":{"type":"array","description":"Detected issues related to this connection","items":{"type":"object","properties":{"entity":{"type":"string","description":"Issue entity type"},"entityId":{"type":"string","description":"Related entity ID"},"code":{"type":"string","description":"Issue code"},"description":{"type":"string","description":"Human readable issue description"},"solution":{"type":"string","description":"Suggested solution for the issue"}}}},"rejectReasons":{"type":"array","description":"Reasons for rejection if any","items":{"type":"string"}},"banState":{"type":"string","description":"Ban state for the WABA, if any"},"banDate":{"type":"string","description":"Date when the WABA was banned (RFC3339)"},"violationType":{"type":"string","description":"Type of violation that caused a ban, if applicable"}}}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Already synchronizing","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many synchronization requests","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"summary":"Sync session","produces":["application/json"],"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Synchronize session\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/sync \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Synchronize session\nhttp GET https://api.wassenger.com/v1/devices/{deviceId}/sync \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Synchronize session\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/sync';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Synchronize session\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/sync',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Synchronize session\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/sync');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Synchronize session\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/sync', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Synchronize session\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/sync');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Synchronize session\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/sync\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Synchronize session\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/sync\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Synchronize session\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/sync';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Synchronize session\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/sync',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Synchronize session\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/sync\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Synchronize session\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/sync\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Synchronize session\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/sync\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Synchronize session\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/sync\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Synchronize session\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/sync\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Synchronize session\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/sync\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Synchronize session\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/sync\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Synchronize session\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/sync' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Synchronize session\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/sync\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Synchronize session\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/sync\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/start":{"parameters":[],"post":{"summary":"Start session","description":"Force to start device session during non-operative hours, if enabled. If the device is already operative or during operative hours, calling this endpoint has no action.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fstart&method=POST&params=%5B%7B%22key%22%3A%22wait%22%2C%22value%22%3Atrue%7D%5D&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"startDevice","security":[{"apiKey":[]}],"tags":["Session"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"query","name":"wait","type":"boolean","default":false,"description":"Wait the device session to be available. This may delay the server response up to 90 seconds. Remember to increase the HTTP request timeout tolerance to more than 90 seconds."}],"responses":{"200":{"description":"Device model","schema":{"$ref":"#/definitions/device"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Device not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Device session temporarely not available","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Start device session, optionally waiting for it to be operative\ncurl --request POST \\\n  --url 'https://api.wassenger.com/v1/devices/{deviceId}/start?wait=true' \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Start device session, optionally waiting for it to be operative\nhttp POST 'https://api.wassenger.com/v1/devices/{deviceId}/start?wait=true' \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Start device session, optionally waiting for it to be operative\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/start?wait=true';\nconst options = {method: 'POST', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Start device session, optionally waiting for it to be operative\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/start',\n  params: {wait: 'true'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Start device session, optionally waiting for it to be operative\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/start');\n\nreq.query({\n  wait: 'true'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Start device session, optionally waiting for it to be operative\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/start?wait=true', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Start device session, optionally waiting for it to be operative\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/start');\n$request->setRequestMethod('POST');\n$request->setQuery(new http\\QueryString([\n  'wait' => 'true'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Start device session, optionally waiting for it to be operative\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/start?wait=true\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Start device session, optionally waiting for it to be operative\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/start\"\n\nquerystring = {\"wait\":\"true\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.post(url, headers=headers, params=querystring)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Start device session, optionally waiting for it to be operative\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/start?wait=true';\nconst options = {method: 'POST', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Start device session, optionally waiting for it to be operative\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/start?wait=true',\n  method: 'POST',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Start device session, optionally waiting for it to be operative\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/start?wait=true\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Start device session, optionally waiting for it to be operative\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/start?wait=true\"\n\n\treq, _ := http.NewRequest(\"POST\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Start device session, optionally waiting for it to be operative\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/start?wait=true\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Start device session, optionally waiting for it to be operative\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/start?wait=true\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Start device session, optionally waiting for it to be operative\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/start?wait=true\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Start device session, optionally waiting for it to be operative\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/start?wait=true\")\n  .post(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Start device session, optionally waiting for it to be operative\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/start?wait=true\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Start device session, optionally waiting for it to be operative\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/start?wait=true' -Method POST -Headers $headers"},{"lang":"ObjC","source":"// Start device session, optionally waiting for it to be operative\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/start?wait=true\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Start device session, optionally waiting for it to be operative\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/start?wait=true\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/scan":{"parameters":[],"get":{"description":"Get the QR image to scan in order to link the WhatsApp number session to the system.\n\n\n\nThe image is by default returned in SVG format (`image/svg+xml`) as plain text. Use `encoding=json` to get the SVG image content as JSON.\n\n\n\nYou can change this behavior by using the `encoding` optional query param. See below for more details.\n\n\n\nIf the session is already authenticated, the API will return an error unless you specify the query param `?force=true`, in which case the previous session will be closed and a new one will be created.\n\n\n\nOnce the QR is scanned, the API answers `409` with `errorCode: session:syncing` while WhatsApp loads the first synchronization, which can take a few minutes: stop requesting the QR and wait until the number is online.\n\n\n\n\n\nYou can alternatively retrieve the QR image in Base64, Base64 URI compatible string and raw URI formats by specifying the optional query param `?encoding=base64|base64_uri|uri`.\n\n\n\n> ❗ **Important**: in recent Chrome versions, displaying large SVG images as Base64 stopped working, use `encoding=image` or `encoding=json` instead.\n\n\n\nFor example, by specifying `base64_uri` or `uri` encoding, you can easily display the QR image to the user in HTML code like this:\n\n\n\n`<img src=\"data:image/svg+xml;base64,...image data in base64...\">`\n\n\n\nOr also using CSS:\n\n\n\n`background-image: url(\"data:image/svg+xml;base64,...image data in base64...\");`\n\n\n\n\n\n**Note**: this endpoint may return an error when the number session is initializating and the the QR code is not yet available. You should retry the request multiple times until you get a valid `200` response status.\n\n\n\n#### How to display the QR to the user?\n\n\n\nIf you want to display the QR to the user, like in a web application, you should request a new QR every 2 seconds and display it quickly to the user, given the QR changes frequently and scanning an obsolete QR one will show a scan error to the user.\n\n\n\nWe recommend getting the QR in SVG format, as it is easier to display in raw HTML code in any web application.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fscan)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"scanQR","security":[{"apiKey":[]}],"tags":["Session"],"produces":["image/xml+svg","application/json"],"parameters":[{"in":"query","name":"force","type":"boolean","default":false,"description":"If `true`, forces to destroy and log out the existing WhatsApp session, and request a new QR code. This will cause the session to forcely become unauthorized and manualy QR scan authorization will be required."},{"in":"query","name":"encoding","type":"string","default":"image","enum":["image","json","uri","base64","base64_uri"],"description":"Optional. Return the QR image in different encoding formats as JSON, useful if you need to display the image to the end user in a web browser."}],"responses":{"200":{"description":"Scan QR image"},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Number already linked: online, or scanned and still syncing (`errorCode: session:syncing`)","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many scan requests","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"summary":"Scan QR image","x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get QR code\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/scan \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get QR code\nhttp GET https://api.wassenger.com/v1/devices/{deviceId}/scan \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get QR code\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/scan';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get QR code\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/scan',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get QR code\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/scan');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get QR code\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/scan', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get QR code\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/scan');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get QR code\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/scan\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get QR code\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/scan\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get QR code\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/scan';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get QR code\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/scan',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get QR code\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/scan\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get QR code\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/scan\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get QR code\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/scan\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get QR code\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/scan\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get QR code\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/scan\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get QR code\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/scan\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get QR code\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/scan\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get QR code\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/scan' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get QR code\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/scan\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get QR code\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/scan\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/reset":{"parameters":[],"post":{"summary":"Disconnect session","description":"Disconnect WhatsApp number session, optionally deleting queued messages and stored synced data, including all chats, contacts and messages.\n\n\n\n- No synchronized data (chats, messages & contacts) will be deleted unless the `data` param is set to `true`\n\n- Queued messages will remain in the queue by default, unless the `emptyQueue` param is set to `true`.\n\n\n\n**Important**:\n\nThis action will make the number non-operative for about 2 minutes.\n\nSession QR reconnection will be required in order to turn the number operational again.\n\n\n\nTo learn how to retrieve the QR code image via API, check out the [Scan QR endpoint](#tag/Session/operation/scanQR).\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Freset&method=POST&params=%5B%7B%22key%22%3A%22wait%22%2C%22value%22%3Afalse%7D%2C%7B%22key%22%3A%22emptyQueue%22%2C%22value%22%3Afalse%7D%5D&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"resetDevice","security":[{"apiKey":[]}],"tags":["Session"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"query","name":"data","type":"boolean","default":false,"description":"Delete all stored chats/messages/contacts data. Only use it if you want to delete all stored historical data."},{"in":"query","name":"wait","type":"boolean","default":false,"description":"Wait the device to be available. This may delay the server response up to 2 minutes. Please, increase the HTTP request response timeout tolerance."},{"in":"query","name":"emptyQueue","type":"boolean","default":false,"description":"Delete all existent queued messages in the current device."}],"responses":{"200":{"description":"Disconnected successfully","schema":{"$ref":"#/definitions/device"}},"400":{"description":"Invalid query params","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized operation","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Device not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Logout WhatsApp number session\ncurl --request POST \\\n  --url 'https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=false' \\\n  --header 'Token: <api token goes here>'\n\n\n// Logout WhatsApp number session deleting all queued messages\ncurl --request POST \\\n  --url 'https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=true' \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Logout WhatsApp number session\nhttp POST 'https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=false' \\\n  Token:'<api token goes here>'\n\n\n// Logout WhatsApp number session deleting all queued messages\nhttp POST 'https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=true' \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Logout WhatsApp number session\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=false';\nconst options = {method: 'POST', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Logout WhatsApp number session deleting all queued messages\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=true';\nconst options = {method: 'POST', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Logout WhatsApp number session\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/reset',\n  params: {wait: 'false', emptyQueue: 'false'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Logout WhatsApp number session deleting all queued messages\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/reset',\n  params: {wait: 'false', emptyQueue: 'true'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Logout WhatsApp number session\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/reset');\n\nreq.query({\n  wait: 'false',\n  emptyQueue: 'false'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Logout WhatsApp number session deleting all queued messages\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/reset');\n\nreq.query({\n  wait: 'false',\n  emptyQueue: 'true'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Logout WhatsApp number session\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=false', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Logout WhatsApp number session deleting all queued messages\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=true', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Logout WhatsApp number session\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/reset');\n$request->setRequestMethod('POST');\n$request->setQuery(new http\\QueryString([\n  'wait' => 'false',\n  'emptyQueue' => 'false'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Logout WhatsApp number session deleting all queued messages\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/reset');\n$request->setRequestMethod('POST');\n$request->setQuery(new http\\QueryString([\n  'wait' => 'false',\n  'emptyQueue' => 'true'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Logout WhatsApp number session\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=false\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Logout WhatsApp number session deleting all queued messages\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=true\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Logout WhatsApp number session\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/reset\"\n\nquerystring = {\"wait\":\"false\",\"emptyQueue\":\"false\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.post(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Logout WhatsApp number session deleting all queued messages\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/reset\"\n\nquerystring = {\"wait\":\"false\",\"emptyQueue\":\"true\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.post(url, headers=headers, params=querystring)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Logout WhatsApp number session\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=false';\nconst options = {method: 'POST', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Logout WhatsApp number session deleting all queued messages\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=true';\nconst options = {method: 'POST', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Logout WhatsApp number session\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=false',\n  method: 'POST',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Logout WhatsApp number session deleting all queued messages\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=true',\n  method: 'POST',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Logout WhatsApp number session\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=false\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Logout WhatsApp number session deleting all queued messages\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=true\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Logout WhatsApp number session\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=false\"\n\n\treq, _ := http.NewRequest(\"POST\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Logout WhatsApp number session deleting all queued messages\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=true\"\n\n\treq, _ := http.NewRequest(\"POST\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Logout WhatsApp number session\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=false\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Logout WhatsApp number session deleting all queued messages\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=true\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Logout WhatsApp number session\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=false\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Logout WhatsApp number session deleting all queued messages\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=true\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Logout WhatsApp number session\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=false\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Logout WhatsApp number session deleting all queued messages\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=true\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Logout WhatsApp number session\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=false\")\n  .post(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Logout WhatsApp number session deleting all queued messages\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=true\")\n  .post(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Logout WhatsApp number session\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=false\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Logout WhatsApp number session deleting all queued messages\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=true\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Logout WhatsApp number session\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=false' -Method POST -Headers $headers\n\n\n# Logout WhatsApp number session deleting all queued messages\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=true' -Method POST -Headers $headers"},{"lang":"ObjC","source":"// Logout WhatsApp number session\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=false\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Logout WhatsApp number session deleting all queued messages\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=true\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Logout WhatsApp number session\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=false\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Logout WhatsApp number session deleting all queued messages\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/reset?wait=false&emptyQueue=true\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/removechats":{"parameters":[],"post":{"summary":"Automatic chats deletion","description":"Configure automatic oldests chats clean up/removal task in your WhatsApp number.\n\n\n\nThis feature is particularly useful when you sending thousands of messages to different numbers or your number receives many messages from third-party users.\n\nWhen enabled, the system would take care of automatically removing old chats every few minutes from your device session.\n\n#### Why does this feature exist?\n\nHaving many chats open would decrease the performance or even make your device non-operative. We recommend enabling this feature if you plan to deliver messages to thousands of different users.\n\nWe recommend customers with medium to high delivery volume to enable this feature.\n\n#### How often would the chats be removed?\n\nChats would be removed every 2 minutes.\n\nIf the device session is not online, chats will be removed as long as the session is operative again.\n\n#### What is the default maximum open chats limit?\n\nEach number keeps its own limit: a request without `max` keeps the current one. It takes one of the values listed in the `max` field, from 100 to 5000 chats.\n\n#### How does having hundreds of chat affect performance?\n\nAccording to our tests, having more than 500 open chat can impact the performance of your device and decrease message delivery speed.\n\nUnless strictly necessary, please consider a lower value.\n\n#### I do not want to remove all chats. Can I skip some of them?\n\nYes, you can.\n\nIn case you do not want to remove certain chats, you can add up to 100 phone numbers to the whitelist.\n\nA request without `whitelist` keeps the current one. Send an empty `whitelist` to clear it.\n\n#### What kind of chats would be removed?\n\nOnly user chats are affected by this.\n\nGroup chats, broadcast lists and pinned user chats are ignored and will not be deleted.\n\n#### How does the clean up criteria works?\n\nIt is quite simple: the system deletes oldest chats automatically once the maximum allowed chats is exceeded.\n\nIt is worth noting that group/broadcast/pinned chats are ignored and will not be deleted.\n\n#### What device plans support this feature?\n\nAll available plans support this feature.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fremovechats&method=POST&body=%7B%0A%20%20%22enable%22%3A%20true%2C%0A%20%20%22max%22%3A%20500%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deviceAutoremoveChats","security":[{"apiKey":[]}],"tags":["Devices"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"message","schema":{"type":"object","properties":{"enable":{"type":"boolean","description":"Enable or disable automatic chat deletion.","default":true},"max":{"type":"number","format":"float","minimum":100,"enum":[100,200,300,400,500,600,700,800,900,1000,1250,1500,1750,2000,2500,3000,3500,4000,4500,5000],"description":"Maximum most recent active chats to keep, delete the rest, starting by the oldest ones."},"whitelist":{"type":"array","items":{"type":"object","properties":{"phone":{"type":"string","minLength":8,"maxLength":16},"alias":{"type":"string","minLength":0,"maxLength":30}},"additionalProperties":false},"maxItems":100,"description":"Optional white list of phone numbers to NOT be deleted by the automatic chat deletion."}},"additionalProperties":false}}],"responses":{"200":{"description":"Device model","schema":{"type":"object"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Enable automatic chats removal, allowing a maximum of 500 open chat at a time\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/removechats \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"enable\":true,\"max\":500}'\n\n\n// Disable automatic chats removal in the device\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/removechats \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"enable\":false}'\n\n\n// Enable chats clean up with some whitelist numbers\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/removechats \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"enable\":true,\"whitelist\":[{\"phone\":\"+1234567890\",\"alias\":\"Boss\"},{\"phone\":\"+9876543210\",\"alias\":\"Support team\"}]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Enable automatic chats removal, allowing a maximum of 500 open chat at a time\necho '{\"enable\":true,\"max\":500}' |  \\\n  http POST https://api.wassenger.com/v1/devices/{deviceId}/removechats \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Disable automatic chats removal in the device\necho '{\"enable\":false}' |  \\\n  http POST https://api.wassenger.com/v1/devices/{deviceId}/removechats \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Enable chats clean up with some whitelist numbers\necho '{\"enable\":true,\"whitelist\":[{\"phone\":\"+1234567890\",\"alias\":\"Boss\"},{\"phone\":\"+9876543210\",\"alias\":\"Support team\"}]}' |  \\\n  http POST https://api.wassenger.com/v1/devices/{deviceId}/removechats \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Enable automatic chats removal, allowing a maximum of 500 open chat at a time\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/removechats';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"enable\":true,\"max\":500}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Disable automatic chats removal in the device\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/removechats';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"enable\":false}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Enable chats clean up with some whitelist numbers\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/removechats';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"enable\":true,\"whitelist\":[{\"phone\":\"+1234567890\",\"alias\":\"Boss\"},{\"phone\":\"+9876543210\",\"alias\":\"Support team\"}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Enable automatic chats removal, allowing a maximum of 500 open chat at a time\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/removechats',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {enable: true, max: 500}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Disable automatic chats removal in the device\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/removechats',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {enable: false}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Enable chats clean up with some whitelist numbers\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/removechats',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    enable: true,\n    whitelist: [\n      {phone: '+1234567890', alias: 'Boss'},\n      {phone: '+9876543210', alias: 'Support team'}\n    ]\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Enable automatic chats removal, allowing a maximum of 500 open chat at a time\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/removechats');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  enable: true,\n  max: 500\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Disable automatic chats removal in the device\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/removechats');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  enable: false\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Enable chats clean up with some whitelist numbers\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/removechats');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  enable: true,\n  whitelist: [\n    {\n      phone: '+1234567890',\n      alias: 'Boss'\n    },\n    {\n      phone: '+9876543210',\n      alias: 'Support team'\n    }\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Enable automatic chats removal, allowing a maximum of 500 open chat at a time\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/removechats', [\n  'body' => '{\"enable\":true,\"max\":500}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Disable automatic chats removal in the device\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/removechats', [\n  'body' => '{\"enable\":false}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Enable chats clean up with some whitelist numbers\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/removechats', [\n  'body' => '{\"enable\":true,\"whitelist\":[{\"phone\":\"+1234567890\",\"alias\":\"Boss\"},{\"phone\":\"+9876543210\",\"alias\":\"Support team\"}]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Enable automatic chats removal, allowing a maximum of 500 open chat at a time\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'enable' => null,\n  'max' => 500\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/removechats');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Disable automatic chats removal in the device\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'enable' => null\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/removechats');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Enable chats clean up with some whitelist numbers\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'enable' => null,\n  'whitelist' => [\n    [\n        'phone' => '+1234567890',\n        'alias' => 'Boss'\n    ],\n    [\n        'phone' => '+9876543210',\n        'alias' => 'Support team'\n    ]\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/removechats');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Enable automatic chats removal, allowing a maximum of 500 open chat at a time\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/removechats\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'enable' => null,\n    'max' => 500\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Disable automatic chats removal in the device\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/removechats\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'enable' => null\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Enable chats clean up with some whitelist numbers\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/removechats\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'enable' => null,\n    'whitelist' => [\n        [\n                'phone' => '+1234567890',\n                'alias' => 'Boss'\n        ],\n        [\n                'phone' => '+9876543210',\n                'alias' => 'Support team'\n        ]\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Enable automatic chats removal, allowing a maximum of 500 open chat at a time\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/removechats\"\n\npayload = {\n    \"enable\": True,\n    \"max\": 500\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Disable automatic chats removal in the device\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/removechats\"\n\npayload = { \"enable\": False }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Enable chats clean up with some whitelist numbers\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/removechats\"\n\npayload = {\n    \"enable\": True,\n    \"whitelist\": [\n        {\n            \"phone\": \"+1234567890\",\n            \"alias\": \"Boss\"\n        },\n        {\n            \"phone\": \"+9876543210\",\n            \"alias\": \"Support team\"\n        }\n    ]\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Enable automatic chats removal, allowing a maximum of 500 open chat at a time\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/removechats';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"enable\":true,\"max\":500}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Disable automatic chats removal in the device\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/removechats';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"enable\":false}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Enable chats clean up with some whitelist numbers\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/removechats';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"enable\":true,\"whitelist\":[{\"phone\":\"+1234567890\",\"alias\":\"Boss\"},{\"phone\":\"+9876543210\",\"alias\":\"Support team\"}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Enable automatic chats removal, allowing a maximum of 500 open chat at a time\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/removechats',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"enable\":true,\"max\":500}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Disable automatic chats removal in the device\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/removechats',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"enable\":false}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Enable chats clean up with some whitelist numbers\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/removechats',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"enable\":true,\"whitelist\":[{\"phone\":\"+1234567890\",\"alias\":\"Boss\"},{\"phone\":\"+9876543210\",\"alias\":\"Support team\"}]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Enable automatic chats removal, allowing a maximum of 500 open chat at a time\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/removechats\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"enable\\\":true,\\\"max\\\":500}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Disable automatic chats removal in the device\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/removechats\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"enable\\\":false}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Enable chats clean up with some whitelist numbers\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/removechats\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"enable\\\":true,\\\"whitelist\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"alias\\\":\\\"Boss\\\"},{\\\"phone\\\":\\\"+9876543210\\\",\\\"alias\\\":\\\"Support team\\\"}]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Enable automatic chats removal, allowing a maximum of 500 open chat at a time\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/removechats\"\n\n\tpayload := strings.NewReader(\"{\\\"enable\\\":true,\\\"max\\\":500}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Disable automatic chats removal in the device\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/removechats\"\n\n\tpayload := strings.NewReader(\"{\\\"enable\\\":false}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Enable chats clean up with some whitelist numbers\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/removechats\"\n\n\tpayload := strings.NewReader(\"{\\\"enable\\\":true,\\\"whitelist\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"alias\\\":\\\"Boss\\\"},{\\\"phone\\\":\\\"+9876543210\\\",\\\"alias\\\":\\\"Support team\\\"}]}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Enable automatic chats removal, allowing a maximum of 500 open chat at a time\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/removechats\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"enable\\\":true,\\\"max\\\":500}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Disable automatic chats removal in the device\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/removechats\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"enable\\\":false}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Enable chats clean up with some whitelist numbers\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/removechats\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"enable\\\":true,\\\"whitelist\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"alias\\\":\\\"Boss\\\"},{\\\"phone\\\":\\\"+9876543210\\\",\\\"alias\\\":\\\"Support team\\\"}]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Enable automatic chats removal, allowing a maximum of 500 open chat at a time\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/removechats\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"enable\\\":true,\\\"max\\\":500}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Disable automatic chats removal in the device\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/removechats\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"enable\\\":false}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Enable chats clean up with some whitelist numbers\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/removechats\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"enable\\\":true,\\\"whitelist\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"alias\\\":\\\"Boss\\\"},{\\\"phone\\\":\\\"+9876543210\\\",\\\"alias\\\":\\\"Support team\\\"}]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Enable automatic chats removal, allowing a maximum of 500 open chat at a time\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/removechats\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"enable\\\":true,\\\"max\\\":500}\")\n  .asString();\n\n\n// Disable automatic chats removal in the device\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/removechats\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"enable\\\":false}\")\n  .asString();\n\n\n// Enable chats clean up with some whitelist numbers\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/removechats\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"enable\\\":true,\\\"whitelist\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"alias\\\":\\\"Boss\\\"},{\\\"phone\\\":\\\"+9876543210\\\",\\\"alias\\\":\\\"Support team\\\"}]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Enable automatic chats removal, allowing a maximum of 500 open chat at a time\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"enable\\\":true,\\\"max\\\":500}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/removechats\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Disable automatic chats removal in the device\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"enable\\\":false}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/removechats\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Enable chats clean up with some whitelist numbers\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"enable\\\":true,\\\"whitelist\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"alias\\\":\\\"Boss\\\"},{\\\"phone\\\":\\\"+9876543210\\\",\\\"alias\\\":\\\"Support team\\\"}]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/removechats\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Enable automatic chats removal, allowing a maximum of 500 open chat at a time\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/removechats\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"enable\\\":true,\\\"max\\\":500}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Disable automatic chats removal in the device\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/removechats\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"enable\\\":false}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Enable chats clean up with some whitelist numbers\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/removechats\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"enable\\\":true,\\\"whitelist\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"alias\\\":\\\"Boss\\\"},{\\\"phone\\\":\\\"+9876543210\\\",\\\"alias\\\":\\\"Support team\\\"}]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Enable automatic chats removal, allowing a maximum of 500 open chat at a time\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/removechats' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"enable\":true,\"max\":500}'\n\n\n# Disable automatic chats removal in the device\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/removechats' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"enable\":false}'\n\n\n# Enable chats clean up with some whitelist numbers\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/removechats' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"enable\":true,\"whitelist\":[{\"phone\":\"+1234567890\",\"alias\":\"Boss\"},{\"phone\":\"+9876543210\",\"alias\":\"Support team\"}]}'"},{"lang":"ObjC","source":"// Enable automatic chats removal, allowing a maximum of 500 open chat at a time\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"enable\": @YES,\n                              @\"max\": @500 };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/removechats\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Disable automatic chats removal in the device\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"enable\": @NO };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/removechats\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Enable chats clean up with some whitelist numbers\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"enable\": @YES,\n                              @\"whitelist\": @[ @{ @\"phone\": @\"+1234567890\", @\"alias\": @\"Boss\" }, @{ @\"phone\": @\"+9876543210\", @\"alias\": @\"Support team\" } ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/removechats\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Enable automatic chats removal, allowing a maximum of 500 open chat at a time\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"enable\": true,\n  \"max\": 500\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/removechats\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Disable automatic chats removal in the device\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"enable\": false] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/removechats\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Enable chats clean up with some whitelist numbers\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"enable\": true,\n  \"whitelist\": [\n    [\n      \"phone\": \"+1234567890\",\n      \"alias\": \"Boss\"\n    ],\n    [\n      \"phone\": \"+9876543210\",\n      \"alias\": \"Support team\"\n    ]\n  ]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/removechats\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/reboot":{"parameters":[],"post":{"summary":"Reboot session","description":"Reboot the WhatsApp session without deleting any data.\n\n\n\nAll queued messages will not be deleted and be delivered as soon as the session is back online.\n\n\n\n**Important**: this action will make the device unavailable for up to 90 seconds and no messages will be sent or received during that time.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Freboott&method=POST&params=%5B%7B%22key%22%3A%22wait%22%2C%22value%22%3Atrue%7D%5D&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"rebootDevice","security":[{"apiKey":[]}],"tags":["Session"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"query","name":"force","type":"boolean","default":false,"description":"Force device reboot even if it is already stopped. With `sync`, restarts a number that is still starting up instead of answering 503."},{"in":"query","name":"wait","type":"boolean","default":false,"description":"Wait the device session to be available. This may delay the server response up to 90 seconds. Please, increase the HTTP request response timeout tolerance to more than 90 seconds."},{"in":"query","name":"sync","type":"boolean","default":false,"description":"Force device sync. A number that is still starting up is left alone and answered with 503 (`container:sync_deferred`) unless `force` is set."}],"responses":{"200":{"description":"Device model","schema":{"$ref":"#/definitions/device"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Device not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Reboot device session, optionally waiting for it to be operative\ncurl --request POST \\\n  --url 'https://api.wassenger.com/v1/devices/{deviceId}/reboott?wait=true' \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Reboot device session, optionally waiting for it to be operative\nhttp POST 'https://api.wassenger.com/v1/devices/{deviceId}/reboott?wait=true' \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Reboot device session, optionally waiting for it to be operative\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/reboott?wait=true';\nconst options = {method: 'POST', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Reboot device session, optionally waiting for it to be operative\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/reboott',\n  params: {wait: 'true'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Reboot device session, optionally waiting for it to be operative\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/reboott');\n\nreq.query({\n  wait: 'true'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Reboot device session, optionally waiting for it to be operative\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/reboott?wait=true', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Reboot device session, optionally waiting for it to be operative\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/reboott');\n$request->setRequestMethod('POST');\n$request->setQuery(new http\\QueryString([\n  'wait' => 'true'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Reboot device session, optionally waiting for it to be operative\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/reboott?wait=true\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Reboot device session, optionally waiting for it to be operative\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/reboott\"\n\nquerystring = {\"wait\":\"true\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.post(url, headers=headers, params=querystring)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Reboot device session, optionally waiting for it to be operative\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/reboott?wait=true';\nconst options = {method: 'POST', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Reboot device session, optionally waiting for it to be operative\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/reboott?wait=true',\n  method: 'POST',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Reboot device session, optionally waiting for it to be operative\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/reboott?wait=true\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Reboot device session, optionally waiting for it to be operative\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/reboott?wait=true\"\n\n\treq, _ := http.NewRequest(\"POST\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Reboot device session, optionally waiting for it to be operative\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/reboott?wait=true\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Reboot device session, optionally waiting for it to be operative\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/reboott?wait=true\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Reboot device session, optionally waiting for it to be operative\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/reboott?wait=true\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Reboot device session, optionally waiting for it to be operative\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/reboott?wait=true\")\n  .post(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Reboot device session, optionally waiting for it to be operative\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/reboott?wait=true\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Reboot device session, optionally waiting for it to be operative\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/reboott?wait=true' -Method POST -Headers $headers"},{"lang":"ObjC","source":"// Reboot device session, optionally waiting for it to be operative\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/reboott?wait=true\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Reboot device session, optionally waiting for it to be operative\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/reboott?wait=true\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/readchats":{"parameters":[],"post":{"summary":"Read chat messages","description":"Report on-demand unread messages within one or multiple chats as read messages, simulating user-behavior with the blue double-check after reading messages.\n\n\n\nBy calling this endpoint, you can arbitrary report as read messages all unread messages within one or multiple chats.\n\n\n\n**Important**: this API endpoint may take up to 90 seconds to provide a response, please increase the timeout tolerance in your HTTP client.\n\n\n\nAlternatively, you can report read messages per chat everytime you send a message to a user/group target by simply adding the JSON field `sendReadAck: true` in the API request body.\n\nFor more details, see the [Messages > Send message endpoint](#operation/createMessage) documentation.\n\n\n\n**Note**: in case you have disabled read confirmation in WhatsApp Settings > Account > Privacy, this action will have no effect.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Freadchats&method=POST&body=%7B%0A%20%20%22chats%22%3A%20%5B%0A%20%20%20%20%221234567890%22%2C%0A%20%20%20%20%221234567890%40c.us%22%2C%0A%20%20%20%20%221234567890-100000000%40g.us%22%2C%0A%20%20%20%20%22120000000000000000%40g.us%22%0A%20%20%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deviceReadChats","security":[{"apiKey":[]}],"tags":["Devices"],"produces":["application/json"],"parameters":[{"in":"body","name":"chats","schema":{"type":"object","properties":{"chats":{"type":"array","items":{"type":"string","minLength":8,"maxLength":30},"minItems":1,"maxItems":20,"description":"Chat IDs with WhatsApp native notation or chat international phone number. E.g: 1234567890, 442384927503@c.us, 0482349343-232322332@g.us or 120000000000000000@g.us"}},"required":["chats"],"additionalProperties":false}}],"responses":{"200":{"description":"Results with pair-value","schema":{"type":"object"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Device session is not currently available","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Notify multiple chats as read by the user\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/readchats \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"chats\":[\"1234567890\",\"1234567890@c.us\",\"1234567890-100000000@g.us\",\"120000000000000000@g.us\"]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Notify multiple chats as read by the user\necho '{\"chats\":[\"1234567890\",\"1234567890@c.us\",\"1234567890-100000000@g.us\",\"120000000000000000@g.us\"]}' |  \\\n  http POST https://api.wassenger.com/v1/devices/{deviceId}/readchats \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Notify multiple chats as read by the user\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/readchats';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"chats\":[\"1234567890\",\"1234567890@c.us\",\"1234567890-100000000@g.us\",\"120000000000000000@g.us\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Notify multiple chats as read by the user\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/readchats',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    chats: [\n      '1234567890',\n      '1234567890@c.us',\n      '1234567890-100000000@g.us',\n      '120000000000000000@g.us'\n    ]\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Notify multiple chats as read by the user\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/readchats');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  chats: [\n    '1234567890',\n    '1234567890@c.us',\n    '1234567890-100000000@g.us',\n    '120000000000000000@g.us'\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Notify multiple chats as read by the user\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/readchats', [\n  'body' => '{\"chats\":[\"1234567890\",\"1234567890@c.us\",\"1234567890-100000000@g.us\",\"120000000000000000@g.us\"]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Notify multiple chats as read by the user\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'chats' => [\n    '1234567890',\n    '1234567890@c.us',\n    '1234567890-100000000@g.us',\n    '120000000000000000@g.us'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/readchats');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Notify multiple chats as read by the user\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/readchats\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'chats' => [\n        '1234567890',\n        '1234567890@c.us',\n        '1234567890-100000000@g.us',\n        '120000000000000000@g.us'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Notify multiple chats as read by the user\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/readchats\"\n\npayload = { \"chats\": [\"1234567890\", \"1234567890@c.us\", \"1234567890-100000000@g.us\", \"120000000000000000@g.us\"] }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Notify multiple chats as read by the user\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/readchats';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"chats\":[\"1234567890\",\"1234567890@c.us\",\"1234567890-100000000@g.us\",\"120000000000000000@g.us\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Notify multiple chats as read by the user\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/readchats',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"chats\":[\"1234567890\",\"1234567890@c.us\",\"1234567890-100000000@g.us\",\"120000000000000000@g.us\"]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Notify multiple chats as read by the user\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/readchats\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"chats\\\":[\\\"1234567890\\\",\\\"1234567890@c.us\\\",\\\"1234567890-100000000@g.us\\\",\\\"120000000000000000@g.us\\\"]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Notify multiple chats as read by the user\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/readchats\"\n\n\tpayload := strings.NewReader(\"{\\\"chats\\\":[\\\"1234567890\\\",\\\"1234567890@c.us\\\",\\\"1234567890-100000000@g.us\\\",\\\"120000000000000000@g.us\\\"]}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Notify multiple chats as read by the user\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/readchats\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"chats\\\":[\\\"1234567890\\\",\\\"1234567890@c.us\\\",\\\"1234567890-100000000@g.us\\\",\\\"120000000000000000@g.us\\\"]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Notify multiple chats as read by the user\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/readchats\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"chats\\\":[\\\"1234567890\\\",\\\"1234567890@c.us\\\",\\\"1234567890-100000000@g.us\\\",\\\"120000000000000000@g.us\\\"]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Notify multiple chats as read by the user\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/readchats\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"chats\\\":[\\\"1234567890\\\",\\\"1234567890@c.us\\\",\\\"1234567890-100000000@g.us\\\",\\\"120000000000000000@g.us\\\"]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Notify multiple chats as read by the user\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"chats\\\":[\\\"1234567890\\\",\\\"1234567890@c.us\\\",\\\"1234567890-100000000@g.us\\\",\\\"120000000000000000@g.us\\\"]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/readchats\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Notify multiple chats as read by the user\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/readchats\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"chats\\\":[\\\"1234567890\\\",\\\"1234567890@c.us\\\",\\\"1234567890-100000000@g.us\\\",\\\"120000000000000000@g.us\\\"]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Notify multiple chats as read by the user\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/readchats' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"chats\":[\"1234567890\",\"1234567890@c.us\",\"1234567890-100000000@g.us\",\"120000000000000000@g.us\"]}'"},{"lang":"ObjC","source":"// Notify multiple chats as read by the user\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"chats\": @[ @\"1234567890\", @\"1234567890@c.us\", @\"1234567890-100000000@g.us\", @\"120000000000000000@g.us\" ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/readchats\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Notify multiple chats as read by the user\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"chats\": [\"1234567890\", \"1234567890@c.us\", \"1234567890-100000000@g.us\", \"120000000000000000@g.us\"]] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/readchats\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/quickReplies":{"parameters":[],"get":{"summary":"List quick replies","description":"Retrieve a list of available quick replies configuration for the specific device.\n\n\n\nQuick replies works with both WhatsApp Personal & Business numbers.\n\n\n\nQuick replies entries are automatically synced with your WhatsApp Business number, however you can create and use quick replies without creating them in the WhatsApp app.\n\n\n\nNote that WhatsApp Personal numbers does not support quick replies natively, but you can create and use quick replies directly from the platform chat.\n\n\n\nYou can also create platform-level quick replies that will be only accessible within the chat app.\n\n\n\nWhatsApp Personal numbers can also create and use quick replies feature from the chat app.\n\n\n\n**Permissions**:\n\n\n\nPlatform-level created quick replies via API or from the web app can have one of the following team permissions:\n\n\n\n- **public**: everyone on the team can use, edit and delete the quick reply.\n\n- **readonly**: everyone on the team can use the quick reply, but only the owner can edit or delete it.\n\n- **private**: only the owner can use, edit and delete the quick reply.\n\n\n\n\n\n**Note**: this endpoint is only available for devices running a Platform product plan. Otherwise, it will return a `403 - Forbidden` response status.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2FquickReplies)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getQuickReplies","security":[{"apiKey":[]}],"tags":["Quick Replies"],"parameters":[{"in":"query","name":"scope","type":"string","description":"Filter quick replies by definition scope (`wa` = WhatsApp Business synced read-only quick replies or `chat` = Chat created read-write quick replies).","default":"any","enum":["any","wa","chat"]},{"in":"query","name":"permissions","type":"array","collectionFormat":"csv","description":"Filter quick replies by permission level (public, readonly or private). Multiple values are allowed in this filter.","default":"any","items":{"type":"string","enum":["any","public","readonly","private"]}},{"in":"query","name":"agents","type":"array","collectionFormat":"csv","description":"Filter quick replies created by the given chat agent ID (24 characters hexadecimal identifier). If the agent does not exist or has no access to the chat, a `400 Bad Request` error will be returned. Multiple agent IDs are allowed separated by commas.","items":{"type":"string","maxLength":24,"minLength":24,"pattern":"^[0-9A-Fa-f]{24}$"},"maxItems":30},{"in":"query","name":"size","description":"Maximum size of entries to return","type":"number","format":"integer","default":100,"minimum":1,"maximum":500},{"in":"query","name":"page","description":"Results page number (starting from 0)","type":"number","format":"integer","default":0,"minimum":0,"maximum":100}],"responses":{"200":{"description":"List of quick replies available","schema":{"type":"array","items":{"$ref":"#/definitions/quickReply"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Feature not available in current plan","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Retrieve available quick replies\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/quickReplies \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Retrieve available quick replies\nhttp GET https://api.wassenger.com/v1/devices/{deviceId}/quickReplies \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Retrieve available quick replies\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Retrieve available quick replies\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Retrieve available quick replies\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Retrieve available quick replies\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Retrieve available quick replies\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/quickReplies');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Retrieve available quick replies\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Retrieve available quick replies\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Retrieve available quick replies\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Retrieve available quick replies\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Retrieve available quick replies\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Retrieve available quick replies\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Retrieve available quick replies\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Retrieve available quick replies\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Retrieve available quick replies\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Retrieve available quick replies\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Retrieve available quick replies\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Retrieve available quick replies\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Retrieve available quick replies\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Retrieve available quick replies\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"post":{"summary":"Create quick reply","description":"Create a new quick reply for the chat web app in the specific device.\n\n\n\nOptionally, you can create quick replies with specific team access permission:\n\n\n\n- **public**: everyone on the team can use, edit and delete the quick reply.\n\n- **readonly**: everyone on the team can use the quick reply, but only the owner can edit or delete it.\n\n- **private**: only the owner can use, edit and delete the quick reply.\n\n\n\n\n\n**Note**: feature restricted to Platform plan subscriptions.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2FquickReplies&method=POST&body=%7B%0A%20%20%22shortcut%22%3A%20%22welcome%22%2C%0A%20%20%22message%22%3A%20%22Hello%20there!%20We%20are%20proud%20to%20have%20you%20on%20board.%20If%20you%20have%20any%20questions%2C%20please%20let%20us%20know.%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"createQuickReply","security":[{"apiKey":[]}],"tags":["Quick Replies"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"quickreply","schema":{"type":"object","properties":{"shortcut":{"type":"string","maxLength":25,"minLength":2},"message":{"type":"string","minLength":4,"maxLength":6000},"permission":{"type":"string","enum":["public","readonly","private"],"default":"public"},"file":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","maxLength":24,"minLength":24,"description":"Optional media file ID for the quick reply, up to 3 MB in the Professional plan or up to 10 MB in the Business and Enterprise plans. Supported file formats are image (jpeg, png, webp), video (mp4) and documents (pdf, xlsx, docx, pptx, zip). Note: the file must be previously uploaded to the system. See [Upload file endpoint](#tag/Files/operation/uploadFile)"},"keywords":{"type":"array","items":{"type":"string","pattern":"^[a-zA-Z0-9]*$","maxLength":15,"minLength":1},"maxItems":3}},"required":["shortcut","message"],"additionalProperties":false}}],"responses":{"200":{"description":"New quick reply","schema":{"$ref":"#/definitions/quickReply"}},"400":{"description":"Invalid or missing body fields","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict - Quick reply shortcut already exists","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Create quick reply\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/quickReplies \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"shortcut\":\"welcome\",\"message\":\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Create quick reply\necho '{\"shortcut\":\"welcome\",\"message\":\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\"}' |  \\\n  http POST https://api.wassenger.com/v1/devices/{deviceId}/quickReplies \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Create quick reply\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"shortcut\":\"welcome\",\"message\":\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Create quick reply\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    shortcut: 'welcome',\n    message: 'Hello there! We are proud to have you on board. If you have any questions, please let us know.'\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Create quick reply\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  shortcut: 'welcome',\n  message: 'Hello there! We are proud to have you on board. If you have any questions, please let us know.'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Create quick reply\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies', [\n  'body' => '{\"shortcut\":\"welcome\",\"message\":\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Create quick reply\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'shortcut' => 'welcome',\n  'message' => 'Hello there! We are proud to have you on board. If you have any questions, please let us know.'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/quickReplies');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Create quick reply\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'shortcut' => 'welcome',\n    'message' => 'Hello there! We are proud to have you on board. If you have any questions, please let us know.'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Create quick reply\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\"\n\npayload = {\n    \"shortcut\": \"welcome\",\n    \"message\": \"Hello there! We are proud to have you on board. If you have any questions, please let us know.\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create quick reply\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"shortcut\":\"welcome\",\"message\":\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create quick reply\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"shortcut\":\"welcome\",\"message\":\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Create quick reply\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"shortcut\\\":\\\"welcome\\\",\\\"message\\\":\\\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Create quick reply\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\"\n\n\tpayload := strings.NewReader(\"{\\\"shortcut\\\":\\\"welcome\\\",\\\"message\\\":\\\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Create quick reply\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"shortcut\\\":\\\"welcome\\\",\\\"message\\\":\\\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Create quick reply\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"shortcut\\\":\\\"welcome\\\",\\\"message\\\":\\\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Create quick reply\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"shortcut\\\":\\\"welcome\\\",\\\"message\\\":\\\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Create quick reply\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"shortcut\\\":\\\"welcome\\\",\\\"message\\\":\\\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Create quick reply\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"shortcut\\\":\\\"welcome\\\",\\\"message\\\":\\\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Create quick reply\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"shortcut\":\"welcome\",\"message\":\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\"}'"},{"lang":"ObjC","source":"// Create quick reply\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"shortcut\": @\"welcome\",\n                              @\"message\": @\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Create quick reply\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"shortcut\": \"welcome\",\n  \"message\": \"Hello there! We are proud to have you on board. If you have any questions, please let us know.\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Update quick reply","description":"Update an existent quick reply by shortcut keyword or unique ID.\n\n\n\nYou cannot update read-only automatically synced quick replies created in the WhatsApp Business app: those quick replies has to be updated manually from the mobile app.\n\n\n\n**Permission limitations**: you can only delete quick replies created by you and by other team member that gave shared permissions, instead of private or read-only permissions, to a given quick reply entry.\n\n\n\n**Note**: feature restricted to Platform plan subscriptions.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2FquickReplies&method=PATCH&body=%7B%0A%20%20%22shortcut%22%3A%20%22welcome%22%2C%0A%20%20%22message%22%3A%20%22Hello%20there!%20We%20are%20proud%20to%20have%20you%20on%20board.%20If%20you%20have%20any%20questions%2C%20please%20let%20us%20know.%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateQuickReply","security":[{"apiKey":[]}],"tags":["Quick Replies"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"quickreply","schema":{"type":"object","properties":{"id":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","maxLength":24,"minLength":24},"shortcut":{"type":"string","maxLength":25,"minLength":2},"message":{"type":"string","minLength":4,"maxLength":6000},"file":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","maxLength":24,"minLength":24,"description":"Optional media file ID for the quick reply, up to 3 MB in the Professional plan or up to 10 MB in the Business and Enterprise plans. Supported file formats are image (jpeg, png, webp), video (mp4) and documents (pdf, xlsx, docx, pptx, zip). Note: the file must be previously uploaded to the system. See [Upload file endpoint](#tag/Files/operation/uploadFile)"},"permission":{"type":"string","enum":["public","readonly","private"]},"keywords":{"type":"array","items":{"type":"string","pattern":"^[a-zA-Z0-9]*$","maxLength":15,"minLength":1},"maxItems":3}},"required":["shortcut","message"],"additionalProperties":false}}],"responses":{"200":{"description":"Quick reply updated","schema":{"type":"array","items":{"$ref":"#/definitions/quickReply"}}},"400":{"description":"Invalid or missing body fields","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict - Quick reply shortcut already exists","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Update quick reply\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/quickReplies \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"shortcut\":\"welcome\",\"message\":\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Update quick reply\necho '{\"shortcut\":\"welcome\",\"message\":\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\"}' |  \\\n  http PATCH https://api.wassenger.com/v1/devices/{deviceId}/quickReplies \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Update quick reply\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"shortcut\":\"welcome\",\"message\":\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Update quick reply\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    shortcut: 'welcome',\n    message: 'Hello there! We are proud to have you on board. If you have any questions, please let us know.'\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Update quick reply\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  shortcut: 'welcome',\n  message: 'Hello there! We are proud to have you on board. If you have any questions, please let us know.'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Update quick reply\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies', [\n  'body' => '{\"shortcut\":\"welcome\",\"message\":\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Update quick reply\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'shortcut' => 'welcome',\n  'message' => 'Hello there! We are proud to have you on board. If you have any questions, please let us know.'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/quickReplies');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Update quick reply\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'shortcut' => 'welcome',\n    'message' => 'Hello there! We are proud to have you on board. If you have any questions, please let us know.'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Update quick reply\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\"\n\npayload = {\n    \"shortcut\": \"welcome\",\n    \"message\": \"Hello there! We are proud to have you on board. If you have any questions, please let us know.\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update quick reply\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"shortcut\":\"welcome\",\"message\":\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update quick reply\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"shortcut\":\"welcome\",\"message\":\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Update quick reply\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"shortcut\\\":\\\"welcome\\\",\\\"message\\\":\\\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Update quick reply\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\"\n\n\tpayload := strings.NewReader(\"{\\\"shortcut\\\":\\\"welcome\\\",\\\"message\\\":\\\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\\\"}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Update quick reply\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"shortcut\\\":\\\"welcome\\\",\\\"message\\\":\\\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Update quick reply\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"shortcut\\\":\\\"welcome\\\",\\\"message\\\":\\\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Update quick reply\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"shortcut\\\":\\\"welcome\\\",\\\"message\\\":\\\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Update quick reply\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"shortcut\\\":\\\"welcome\\\",\\\"message\\\":\\\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Update quick reply\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"shortcut\\\":\\\"welcome\\\",\\\"message\\\":\\\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Update quick reply\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"shortcut\":\"welcome\",\"message\":\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\"}'"},{"lang":"ObjC","source":"// Update quick reply\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"shortcut\": @\"welcome\",\n                              @\"message\": @\"Hello there! We are proud to have you on board. If you have any questions, please let us know.\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Update quick reply\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"shortcut\": \"welcome\",\n  \"message\": \"Hello there! We are proud to have you on board. If you have any questions, please let us know.\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Delete quick replies","description":"Delete one or multiple quick replies entries by shortcut value or ID (24 characters hexadecimal identifier).\n\n\n\nYou cannot delete read-only automatically synced quick replies created in the WhatsApp Business app: those quick replies has to be deleted manually from the mobile app.\n\n\n\n**Permission limitations**: you can only delete quick replies created by you and by other team member that gave shared permissions, instead of private or read-only permissions, to a given quick reply entry.\n\n\n\nIn case you require to delete all quick replies at once use the following JSON body data: `[{ all: true }]`\n\n\n\n**Note**: feature restricted to Platform plan subscriptions.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2FquickReplies&method=DELETE&body=%5B%0A%20%20%7B%0A%20%20%20%20%22shortcut%22%3A%20%22welcome%22%0A%20%20%7D%0A%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deleteQuickReplies","security":[{"apiKey":[]}],"tags":["Quick Replies"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"quickReplies","schema":{"type":"array","items":{"type":"object","properties":{"all":{"type":"boolean","description":"Set as `true` if you want delete all quick replies at once.","default":false},"id":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","maxLength":24,"minLength":24,"description":"Delete quick reply by unique ID. Required if `shortcut` and `all` fields are not present."},"shortcut":{"type":"string","maxLength":25,"minLength":2,"description":"Delete quick reply by shortcut exact match. Required if `id` and `all` fields are not present."}},"additionalProperties":false},"minItems":0,"maxItems":300}}],"responses":{"204":{"description":"Quick replies deleted successfully"},"400":{"description":"Invalid or missing body fields","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict - Quick reply shortcut already exists","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Delete one quick reply by shortcut\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/quickReplies \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '[{\"shortcut\":\"welcome\"}]'\n\n\n// Delete one quick reply by ID\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/quickReplies \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '[{\"id\":\"5f71e388ab870508354c0123\"}]'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Delete one quick reply by shortcut\necho '[{\"shortcut\":\"welcome\"}]' |  \\\n  http DELETE https://api.wassenger.com/v1/devices/{deviceId}/quickReplies \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Delete one quick reply by ID\necho '[{\"id\":\"5f71e388ab870508354c0123\"}]' |  \\\n  http DELETE https://api.wassenger.com/v1/devices/{deviceId}/quickReplies \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Delete one quick reply by shortcut\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"shortcut\":\"welcome\"}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete one quick reply by ID\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"id\":\"5f71e388ab870508354c0123\"}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Delete one quick reply by shortcut\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: [{shortcut: 'welcome'}]\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete one quick reply by ID\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: [{id: '5f71e388ab870508354c0123'}]\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Delete one quick reply by shortcut\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send([\n  {\n    shortcut: 'welcome'\n  }\n]);\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Delete one quick reply by ID\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send([\n  {\n    id: '5f71e388ab870508354c0123'\n  }\n]);\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Delete one quick reply by shortcut\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies', [\n  'body' => '[{\"shortcut\":\"welcome\"}]',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Delete one quick reply by ID\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies', [\n  'body' => '[{\"id\":\"5f71e388ab870508354c0123\"}]',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Delete one quick reply by shortcut\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  [\n    'shortcut' => 'welcome'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/quickReplies');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Delete one quick reply by ID\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  [\n    'id' => '5f71e388ab870508354c0123'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/quickReplies');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Delete one quick reply by shortcut\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    [\n        'shortcut' => 'welcome'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Delete one quick reply by ID\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    [\n        'id' => '5f71e388ab870508354c0123'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Delete one quick reply by shortcut\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\"\n\npayload = [{ \"shortcut\": \"welcome\" }]\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Delete one quick reply by ID\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\"\n\npayload = [{ \"id\": \"5f71e388ab870508354c0123\" }]\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete one quick reply by shortcut\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"shortcut\":\"welcome\"}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete one quick reply by ID\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"id\":\"5f71e388ab870508354c0123\"}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete one quick reply by shortcut\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '[{\"shortcut\":\"welcome\"}]'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Delete one quick reply by ID\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '[{\"id\":\"5f71e388ab870508354c0123\"}]'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Delete one quick reply by shortcut\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"[{\\\"shortcut\\\":\\\"welcome\\\"}]\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Delete one quick reply by ID\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"[{\\\"id\\\":\\\"5f71e388ab870508354c0123\\\"}]\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Delete one quick reply by shortcut\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\"\n\n\tpayload := strings.NewReader(\"[{\\\"shortcut\\\":\\\"welcome\\\"}]\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Delete one quick reply by ID\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\"\n\n\tpayload := strings.NewReader(\"[{\\\"id\\\":\\\"5f71e388ab870508354c0123\\\"}]\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Delete one quick reply by shortcut\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"[{\\\"shortcut\\\":\\\"welcome\\\"}]\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Delete one quick reply by ID\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"[{\\\"id\\\":\\\"5f71e388ab870508354c0123\\\"}]\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Delete one quick reply by shortcut\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"[{\\\"shortcut\\\":\\\"welcome\\\"}]\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Delete one quick reply by ID\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"[{\\\"id\\\":\\\"5f71e388ab870508354c0123\\\"}]\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Delete one quick reply by shortcut\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"[{\\\"shortcut\\\":\\\"welcome\\\"}]\")\n  .asString();\n\n\n// Delete one quick reply by ID\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"[{\\\"id\\\":\\\"5f71e388ab870508354c0123\\\"}]\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Delete one quick reply by shortcut\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"[{\\\"shortcut\\\":\\\"welcome\\\"}]\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Delete one quick reply by ID\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"[{\\\"id\\\":\\\"5f71e388ab870508354c0123\\\"}]\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Delete one quick reply by shortcut\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"[{\\\"shortcut\\\":\\\"welcome\\\"}]\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Delete one quick reply by ID\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"[{\\\"id\\\":\\\"5f71e388ab870508354c0123\\\"}]\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Delete one quick reply by shortcut\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '[{\"shortcut\":\"welcome\"}]'\n\n\n# Delete one quick reply by ID\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/quickReplies' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '[{\"id\":\"5f71e388ab870508354c0123\"}]'"},{"lang":"ObjC","source":"// Delete one quick reply by shortcut\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @[ @{ @\"shortcut\": @\"welcome\" } ];\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Delete one quick reply by ID\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @[ @{ @\"id\": @\"5f71e388ab870508354c0123\" } ];\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Delete one quick reply by shortcut\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [[\"shortcut\": \"welcome\"]] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Delete one quick reply by ID\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [[\"id\": \"5f71e388ab870508354c0123\"]] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/quickReplies\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/queue":{"parameters":[],"get":{"summary":"Queue stats","description":"Get WhatsApp number queue messages stats information.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fqueue)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getQueueStatus","security":[{"apiKey":[]}],"tags":["Queue"],"produces":["application/json"],"parameters":[],"responses":{"200":{"description":"Device queue stats","schema":{"type":"object","properties":{"queue":{"type":"object","properties":{"status":{"type":"string","description":"Messages queue processing status"},"statusUpdatedAt":{"type":"string","format":"date-time","description":"Queue status lastest update as ISO date format"},"total":{"type":"number","description":"Total queue messages capacity for the device"},"size":{"type":"number","description":"Messages currently stored in the queue"},"available":{"type":"number","description":"Currently available messages free slots in the queue"},"force":{"type":"boolean","description":"Whether if the queue messages delivery is forced or not. If `true` messages will be delivered with high prority and no retry delay."}}}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get messages queue information\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get messages queue information\nhttp GET https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get messages queue information\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get messages queue information\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get messages queue information\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/queue');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get messages queue information\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/queue', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get messages queue information\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/queue');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get messages queue information\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/queue\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get messages queue information\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get messages queue information\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get messages queue information\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get messages queue information\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get messages queue information\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get messages queue information\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get messages queue information\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get messages queue information\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get messages queue information\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get messages queue information\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get messages queue information\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/queue' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get messages queue information\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get messages queue information\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/queue\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"post":{"summary":"Update queue status","description":"Update WhatsApp number queue processing status.\n\n\n\n**Supported queue statuses**\n\n\n\n- `active`: The queue will deliver messages and accept new messages to be queued\n\n- `pause`: The queue will not deliver messages but it will accept new messages to be queued\n\n- `reject`: The queue will deliver existing queued messages but it will not accept new messages to be queued\n\n- `freeze`: The queue will not deliver existing queued messages and will not accept more messages to be queued\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fqueue&method=POST&body=%7B%0A%20%20%22status%22%3A%20%22pause%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"setQueueStatus","security":[{"apiKey":[]}],"tags":["Queue"],"produces":["application/json"],"parameters":[{"in":"body","name":"status","description":"Set device's queue status","schema":{"type":"object","properties":{"status":{"type":"string","enum":["pause","active","reject","freeze"],"description":"Set messages queue processing status."},"force":{"type":"boolean","description":"Force to deliver all queued messages with no delay for 30 minutes. Queue status must be \"active\" or \"reject\" in order to force messages, otherwise forcing the queue will be ignored."}},"required":["status"],"additionalProperties":false}}],"responses":{"200":{"description":"Updated queue status","schema":{"type":"object","properties":{"queue":{"type":"object","properties":{"status":{"type":"string","description":"Messages queue processing status"},"statusUpdatedAt":{"type":"string","format":"date-time","description":"Queue status lastest update as ISO date format"},"total":{"type":"number","description":"Total queue messages capacity for the device"},"size":{"type":"number","description":"Messages currently stored in the queue"},"available":{"type":"number","description":"Currently available messages free slots in the queue"},"force":{"type":"boolean","description":"Whether if the queue messages delivery is forced or not. If `true` messages will be delivered with high prority and no retry delay."}}}}}},"400":{"description":"Missing body or invalid queue status","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Pause queue messages processing\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"status\":\"pause\"}'\n\n\n// Activate and force queue mesages processing\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"status\":\"active\",\"force\":true}'\n\n\n// Freeze queue messages processing\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"status\":\"freeze\"}'\n\n\n// Reject new messages to be queued\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"status\":\"reject\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Pause queue messages processing\necho '{\"status\":\"pause\"}' |  \\\n  http POST https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Activate and force queue mesages processing\necho '{\"status\":\"active\",\"force\":true}' |  \\\n  http POST https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Freeze queue messages processing\necho '{\"status\":\"freeze\"}' |  \\\n  http POST https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Reject new messages to be queued\necho '{\"status\":\"reject\"}' |  \\\n  http POST https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Pause queue messages processing\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"status\":\"pause\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Activate and force queue mesages processing\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"status\":\"active\",\"force\":true}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Freeze queue messages processing\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"status\":\"freeze\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Reject new messages to be queued\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"status\":\"reject\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Pause queue messages processing\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {status: 'pause'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Activate and force queue mesages processing\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {status: 'active', force: true}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Freeze queue messages processing\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {status: 'freeze'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Reject new messages to be queued\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {status: 'reject'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Pause queue messages processing\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/queue');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  status: 'pause'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Activate and force queue mesages processing\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/queue');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  status: 'active',\n  force: true\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Freeze queue messages processing\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/queue');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  status: 'freeze'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Reject new messages to be queued\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/queue');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  status: 'reject'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Pause queue messages processing\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/queue', [\n  'body' => '{\"status\":\"pause\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Activate and force queue mesages processing\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/queue', [\n  'body' => '{\"status\":\"active\",\"force\":true}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Freeze queue messages processing\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/queue', [\n  'body' => '{\"status\":\"freeze\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Reject new messages to be queued\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/queue', [\n  'body' => '{\"status\":\"reject\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Pause queue messages processing\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'status' => 'pause'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/queue');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Activate and force queue mesages processing\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'status' => 'active',\n  'force' => null\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/queue');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Freeze queue messages processing\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'status' => 'freeze'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/queue');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Reject new messages to be queued\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'status' => 'reject'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/queue');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Pause queue messages processing\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/queue\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'status' => 'pause'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Activate and force queue mesages processing\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/queue\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'status' => 'active',\n    'force' => null\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Freeze queue messages processing\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/queue\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'status' => 'freeze'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Reject new messages to be queued\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/queue\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'status' => 'reject'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Pause queue messages processing\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\npayload = { \"status\": \"pause\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Activate and force queue mesages processing\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\npayload = {\n    \"status\": \"active\",\n    \"force\": True\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Freeze queue messages processing\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\npayload = { \"status\": \"freeze\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Reject new messages to be queued\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\npayload = { \"status\": \"reject\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Pause queue messages processing\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"status\":\"pause\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Activate and force queue mesages processing\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"status\":\"active\",\"force\":true}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Freeze queue messages processing\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"status\":\"freeze\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Reject new messages to be queued\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"status\":\"reject\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Pause queue messages processing\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"status\":\"pause\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Activate and force queue mesages processing\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"status\":\"active\",\"force\":true}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Freeze queue messages processing\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"status\":\"freeze\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Reject new messages to be queued\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"status\":\"reject\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Pause queue messages processing\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"status\\\":\\\"pause\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Activate and force queue mesages processing\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"status\\\":\\\"active\\\",\\\"force\\\":true}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Freeze queue messages processing\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"status\\\":\\\"freeze\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Reject new messages to be queued\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"status\\\":\\\"reject\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Pause queue messages processing\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\n\tpayload := strings.NewReader(\"{\\\"status\\\":\\\"pause\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Activate and force queue mesages processing\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\n\tpayload := strings.NewReader(\"{\\\"status\\\":\\\"active\\\",\\\"force\\\":true}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Freeze queue messages processing\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\n\tpayload := strings.NewReader(\"{\\\"status\\\":\\\"freeze\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Reject new messages to be queued\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\n\tpayload := strings.NewReader(\"{\\\"status\\\":\\\"reject\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Pause queue messages processing\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"status\\\":\\\"pause\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Activate and force queue mesages processing\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"status\\\":\\\"active\\\",\\\"force\\\":true}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Freeze queue messages processing\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"status\\\":\\\"freeze\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Reject new messages to be queued\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"status\\\":\\\"reject\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Pause queue messages processing\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"status\\\":\\\"pause\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Activate and force queue mesages processing\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"status\\\":\\\"active\\\",\\\"force\\\":true}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Freeze queue messages processing\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"status\\\":\\\"freeze\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Reject new messages to be queued\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"status\\\":\\\"reject\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Pause queue messages processing\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"status\\\":\\\"pause\\\"}\")\n  .asString();\n\n\n// Activate and force queue mesages processing\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"status\\\":\\\"active\\\",\\\"force\\\":true}\")\n  .asString();\n\n\n// Freeze queue messages processing\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"status\\\":\\\"freeze\\\"}\")\n  .asString();\n\n\n// Reject new messages to be queued\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"status\\\":\\\"reject\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Pause queue messages processing\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"status\\\":\\\"pause\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Activate and force queue mesages processing\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"status\\\":\\\"active\\\",\\\"force\\\":true}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Freeze queue messages processing\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"status\\\":\\\"freeze\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Reject new messages to be queued\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"status\\\":\\\"reject\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Pause queue messages processing\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"status\\\":\\\"pause\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Activate and force queue mesages processing\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"status\\\":\\\"active\\\",\\\"force\\\":true}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Freeze queue messages processing\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"status\\\":\\\"freeze\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Reject new messages to be queued\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"status\\\":\\\"reject\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Pause queue messages processing\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/queue' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"status\":\"pause\"}'\n\n\n# Activate and force queue mesages processing\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/queue' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"status\":\"active\",\"force\":true}'\n\n\n# Freeze queue messages processing\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/queue' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"status\":\"freeze\"}'\n\n\n# Reject new messages to be queued\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/queue' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"status\":\"reject\"}'"},{"lang":"ObjC","source":"// Pause queue messages processing\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"status\": @\"pause\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Activate and force queue mesages processing\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"status\": @\"active\",\n                              @\"force\": @YES };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Freeze queue messages processing\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"status\": @\"freeze\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Reject new messages to be queued\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"status\": @\"reject\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Pause queue messages processing\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"status\": \"pause\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/queue\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Activate and force queue mesages processing\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"status\": \"active\",\n  \"force\": true\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/queue\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Freeze queue messages processing\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"status\": \"freeze\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/queue\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Reject new messages to be queued\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"status\": \"reject\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/queue\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Transfer queued messages","description":"Re-route and transfer queued messages to be delivered through a different WhatsApp number connected in your account by specifying the WhatsApp Device ID (24 characters hexadecimal value).\n\n\n\nNote the target WhatsApp number must be operative, otherwise the API will return an error.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fqueue&method=PATCH&body=%7B%0A%20%20%22device%22%3A%20%22DEVICE%20ID%20GOES%20HERE%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"routeQueue","security":[{"apiKey":[]}],"tags":["Queue"],"produces":["application/json"],"parameters":[{"in":"body","name":"route","description":"Route queued messages through a new device","schema":{"type":"object","properties":{"device":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Target device ID to reroute queued messages. Target device status must be operative."}},"required":["device"],"additionalProperties":false}}],"responses":{"200":{"description":"Messages were routed","schema":{"type":"object","properties":{"queue":{"type":"object","properties":{"status":{"type":"string","description":"Messages queue processing status"},"statusUpdatedAt":{"type":"string","format":"date-time","description":"Queue status lastest update as ISO date format"},"total":{"type":"number","description":"Total queue messages capacity for the device"},"size":{"type":"number","description":"Messages currently stored in the queue"},"available":{"type":"number","description":"Currently available messages free slots in the queue"},"force":{"type":"boolean","description":"Whether if the queue messages delivery is forced or not. If `true` messages will be delivered with high prority and no retry delay."}}}}}},"400":{"description":"Missing or invalid body params","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid API token or missing permissions","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Route queued messages through another WhatsApp device\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"device\":\"DEVICE ID GOES HERE\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Route queued messages through another WhatsApp device\necho '{\"device\":\"DEVICE ID GOES HERE\"}' |  \\\n  http PATCH https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Route queued messages through another WhatsApp device\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"device\":\"DEVICE ID GOES HERE\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Route queued messages through another WhatsApp device\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {device: 'DEVICE ID GOES HERE'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Route queued messages through another WhatsApp device\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/queue');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  device: 'DEVICE ID GOES HERE'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Route queued messages through another WhatsApp device\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/queue', [\n  'body' => '{\"device\":\"DEVICE ID GOES HERE\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Route queued messages through another WhatsApp device\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'device' => 'DEVICE ID GOES HERE'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/queue');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Route queued messages through another WhatsApp device\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/queue\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'device' => 'DEVICE ID GOES HERE'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Route queued messages through another WhatsApp device\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\npayload = { \"device\": \"DEVICE ID GOES HERE\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Route queued messages through another WhatsApp device\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"device\":\"DEVICE ID GOES HERE\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Route queued messages through another WhatsApp device\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"device\":\"DEVICE ID GOES HERE\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Route queued messages through another WhatsApp device\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"device\\\":\\\"DEVICE ID GOES HERE\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Route queued messages through another WhatsApp device\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\n\tpayload := strings.NewReader(\"{\\\"device\\\":\\\"DEVICE ID GOES HERE\\\"}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Route queued messages through another WhatsApp device\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"device\\\":\\\"DEVICE ID GOES HERE\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Route queued messages through another WhatsApp device\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"device\\\":\\\"DEVICE ID GOES HERE\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Route queued messages through another WhatsApp device\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"device\\\":\\\"DEVICE ID GOES HERE\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Route queued messages through another WhatsApp device\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"device\\\":\\\"DEVICE ID GOES HERE\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Route queued messages through another WhatsApp device\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"device\\\":\\\"DEVICE ID GOES HERE\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Route queued messages through another WhatsApp device\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/queue' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"device\":\"DEVICE ID GOES HERE\"}'"},{"lang":"ObjC","source":"// Route queued messages through another WhatsApp device\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"device\": @\"DEVICE ID GOES HERE\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Route queued messages through another WhatsApp device\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"device\": \"DEVICE ID GOES HERE\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/queue\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Empty queue","description":"Remove all or a subset of queued messages in the specified WhatsApp number by ID.\n\n\n\n**Note**: only messages with `queued` status will be removed.\n\nMessages with `processing`, `failed` or `processed` status will not be affected by this operation.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fqueue&method=DELETE&body=%7B%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"emptyQueue","security":[{"apiKey":[]}],"tags":["Queue"],"produces":["application/json"],"parameters":[{"in":"body","name":"empty","description":"Delete queued messages optionally based on the specific filters","schema":{"type":"object","properties":{"skipScheduled":{"type":"boolean","description":"Do not delete scheduled messages that will be delivered in the future. By default, scheduled messages will be also deleted."},"ids":{"type":"array","items":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24},"maxItems":500,"description":"Optionally delete queued messages by message IDs (hexadecimal 24 length value)."},"phones":{"type":"array","items":{"type":"string","minLength":8,"maxLength":17},"maxItems":500,"description":"Optionally delete queued messages by target phone numbers in E164 format. E.g: +1234567890"},"numbers":{"type":"array","items":{"type":"string","minLength":8,"maxLength":17},"maxItems":500,"description":"Deprecated alias of `phones`, kept because the web console sends it. The generated JSON schema forbids unknown fields, so omitting it here made every console request that filtered by phone number fail validation with a 400."},"groups":{"type":"array","items":{"type":"string","minLength":8,"maxLength":50},"maxItems":500,"description":"Optionally delete queued messages by target group/broadcast list WhatsApp IDs. E.g: 1234567890-000000000@g.us or 120000000000000000@g.us"},"before":{"type":"string","format":"date-time","maxLength":30,"description":"Optionally delete all queued messages created before the given ISO 8601 date. E.g: 2022-01-03T18:25:32+00:00"},"after":{"type":"string","format":"date-time","maxLength":30,"description":"Optionally delete all queued messages created after the given ISO 8601 date. E.g: 2022-02-03T18:25:32+00:00"}},"additionalProperties":false}},{"name":"wait","in":"query","type":"boolean","default":false,"description":"Wait until all queued messages are deleted. The API response may take up 90 seconds if there are thousands of queued messages. Consider using a higher request timeout if using this option."}],"responses":{"200":{"description":"New device queue stats","schema":{"type":"object","properties":{"queue":{"type":"object","properties":{"status":{"type":"string","description":"Messages queue processing status"},"statusUpdatedAt":{"type":"string","format":"date-time","description":"Queue status lastest update as ISO date format"},"total":{"type":"number","description":"Total queue messages capacity for the device"},"size":{"type":"number","description":"Messages currently stored in the queue"},"available":{"type":"number","description":"Currently available messages free slots in the queue"},"force":{"type":"boolean","description":"Whether if the queue messages delivery is forced or not. If `true` messages will be delivered with high prority and no retry delay."}}}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Remove all queued messages in the current WhatsApp number queue.\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{}'\n\n\n// Remove only a subset of queued messages by date range in the current WhatsApp number queue.\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"after\":\"2023-01-01T00:00:00.000Z\",\"before\":\"2023-03-01T00:00:00.000Z\"}'\n\n\n// Remove all queued messages except scheduled messages that will be delivered in a future date\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"skipScheduled\":true}'\n\n\n// Remove only a subset of queued messages by target phone numbers in the current WhatsApp number queue.\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"phones\":[\"+1234567890\",\"+1234567890\",\"+1234567890\",\"+1234567890\"]}'\n\n\n// Remove only a subset of queued messages by target group chats in the current WhatsApp number queue.\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"groups\":[\"123456789000000000@g.us\",\"123456789000000000@g.us\",\"123456789000000000@g.us\",\"123456789000000000@g.us\"]}'\n\n\n// Remove only a subset of queued messages by target message IDs in the current WhatsApp number queue.\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"ids\":[\"61b371029cb10d10dfc85750\",\"61b371029cb10d10dfc85751\",\"61b371029cb10d10dfc85752\",\"61b371029cb10d10dfc85753\"]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Remove all queued messages in the current WhatsApp number queue.\necho '{}' |  \\\n  http DELETE https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Remove only a subset of queued messages by date range in the current WhatsApp number queue.\necho '{\"after\":\"2023-01-01T00:00:00.000Z\",\"before\":\"2023-03-01T00:00:00.000Z\"}' |  \\\n  http DELETE https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Remove all queued messages except scheduled messages that will be delivered in a future date\necho '{\"skipScheduled\":true}' |  \\\n  http DELETE https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Remove only a subset of queued messages by target phone numbers in the current WhatsApp number queue.\necho '{\"phones\":[\"+1234567890\",\"+1234567890\",\"+1234567890\",\"+1234567890\"]}' |  \\\n  http DELETE https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Remove only a subset of queued messages by target group chats in the current WhatsApp number queue.\necho '{\"groups\":[\"123456789000000000@g.us\",\"123456789000000000@g.us\",\"123456789000000000@g.us\",\"123456789000000000@g.us\"]}' |  \\\n  http DELETE https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Remove only a subset of queued messages by target message IDs in the current WhatsApp number queue.\necho '{\"ids\":[\"61b371029cb10d10dfc85750\",\"61b371029cb10d10dfc85751\",\"61b371029cb10d10dfc85752\",\"61b371029cb10d10dfc85753\"]}' |  \\\n  http DELETE https://api.wassenger.com/v1/devices/{deviceId}/queue \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Remove all queued messages in the current WhatsApp number queue.\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Remove only a subset of queued messages by date range in the current WhatsApp number queue.\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"after\":\"2023-01-01T00:00:00.000Z\",\"before\":\"2023-03-01T00:00:00.000Z\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Remove all queued messages except scheduled messages that will be delivered in a future date\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"skipScheduled\":true}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Remove only a subset of queued messages by target phone numbers in the current WhatsApp number queue.\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phones\":[\"+1234567890\",\"+1234567890\",\"+1234567890\",\"+1234567890\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Remove only a subset of queued messages by target group chats in the current WhatsApp number queue.\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"groups\":[\"123456789000000000@g.us\",\"123456789000000000@g.us\",\"123456789000000000@g.us\",\"123456789000000000@g.us\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Remove only a subset of queued messages by target message IDs in the current WhatsApp number queue.\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"ids\":[\"61b371029cb10d10dfc85750\",\"61b371029cb10d10dfc85751\",\"61b371029cb10d10dfc85752\",\"61b371029cb10d10dfc85753\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Remove all queued messages in the current WhatsApp number queue.\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Remove only a subset of queued messages by date range in the current WhatsApp number queue.\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {after: '2023-01-01T00:00:00.000Z', before: '2023-03-01T00:00:00.000Z'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Remove all queued messages except scheduled messages that will be delivered in a future date\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {skipScheduled: true}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Remove only a subset of queued messages by target phone numbers in the current WhatsApp number queue.\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {phones: ['+1234567890', '+1234567890', '+1234567890', '+1234567890']}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Remove only a subset of queued messages by target group chats in the current WhatsApp number queue.\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    groups: [\n      '123456789000000000@g.us',\n      '123456789000000000@g.us',\n      '123456789000000000@g.us',\n      '123456789000000000@g.us'\n    ]\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Remove only a subset of queued messages by target message IDs in the current WhatsApp number queue.\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    ids: [\n      '61b371029cb10d10dfc85750',\n      '61b371029cb10d10dfc85751',\n      '61b371029cb10d10dfc85752',\n      '61b371029cb10d10dfc85753'\n    ]\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Remove all queued messages in the current WhatsApp number queue.\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/queue');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Remove only a subset of queued messages by date range in the current WhatsApp number queue.\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/queue');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  after: '2023-01-01T00:00:00.000Z',\n  before: '2023-03-01T00:00:00.000Z'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Remove all queued messages except scheduled messages that will be delivered in a future date\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/queue');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  skipScheduled: true\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Remove only a subset of queued messages by target phone numbers in the current WhatsApp number queue.\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/queue');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  phones: [\n    '+1234567890',\n    '+1234567890',\n    '+1234567890',\n    '+1234567890'\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Remove only a subset of queued messages by target group chats in the current WhatsApp number queue.\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/queue');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  groups: [\n    '123456789000000000@g.us',\n    '123456789000000000@g.us',\n    '123456789000000000@g.us',\n    '123456789000000000@g.us'\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Remove only a subset of queued messages by target message IDs in the current WhatsApp number queue.\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/queue');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  ids: [\n    '61b371029cb10d10dfc85750',\n    '61b371029cb10d10dfc85751',\n    '61b371029cb10d10dfc85752',\n    '61b371029cb10d10dfc85753'\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Remove all queued messages in the current WhatsApp number queue.\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/queue', [\n  'body' => '{}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Remove only a subset of queued messages by date range in the current WhatsApp number queue.\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/queue', [\n  'body' => '{\"after\":\"2023-01-01T00:00:00.000Z\",\"before\":\"2023-03-01T00:00:00.000Z\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Remove all queued messages except scheduled messages that will be delivered in a future date\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/queue', [\n  'body' => '{\"skipScheduled\":true}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Remove only a subset of queued messages by target phone numbers in the current WhatsApp number queue.\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/queue', [\n  'body' => '{\"phones\":[\"+1234567890\",\"+1234567890\",\"+1234567890\",\"+1234567890\"]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Remove only a subset of queued messages by target group chats in the current WhatsApp number queue.\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/queue', [\n  'body' => '{\"groups\":[\"123456789000000000@g.us\",\"123456789000000000@g.us\",\"123456789000000000@g.us\",\"123456789000000000@g.us\"]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Remove only a subset of queued messages by target message IDs in the current WhatsApp number queue.\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/queue', [\n  'body' => '{\"ids\":[\"61b371029cb10d10dfc85750\",\"61b371029cb10d10dfc85751\",\"61b371029cb10d10dfc85752\",\"61b371029cb10d10dfc85753\"]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Remove all queued messages in the current WhatsApp number queue.\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  \n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/queue');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Remove only a subset of queued messages by date range in the current WhatsApp number queue.\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'after' => '2023-01-01T00:00:00.000Z',\n  'before' => '2023-03-01T00:00:00.000Z'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/queue');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Remove all queued messages except scheduled messages that will be delivered in a future date\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'skipScheduled' => null\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/queue');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Remove only a subset of queued messages by target phone numbers in the current WhatsApp number queue.\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'phones' => [\n    '+1234567890',\n    '+1234567890',\n    '+1234567890',\n    '+1234567890'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/queue');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Remove only a subset of queued messages by target group chats in the current WhatsApp number queue.\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'groups' => [\n    '123456789000000000@g.us',\n    '123456789000000000@g.us',\n    '123456789000000000@g.us',\n    '123456789000000000@g.us'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/queue');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Remove only a subset of queued messages by target message IDs in the current WhatsApp number queue.\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'ids' => [\n    '61b371029cb10d10dfc85750',\n    '61b371029cb10d10dfc85751',\n    '61b371029cb10d10dfc85752',\n    '61b371029cb10d10dfc85753'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/queue');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Remove all queued messages in the current WhatsApp number queue.\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/queue\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    \n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Remove only a subset of queued messages by date range in the current WhatsApp number queue.\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/queue\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'after' => '2023-01-01T00:00:00.000Z',\n    'before' => '2023-03-01T00:00:00.000Z'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Remove all queued messages except scheduled messages that will be delivered in a future date\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/queue\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'skipScheduled' => null\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Remove only a subset of queued messages by target phone numbers in the current WhatsApp number queue.\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/queue\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'phones' => [\n        '+1234567890',\n        '+1234567890',\n        '+1234567890',\n        '+1234567890'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Remove only a subset of queued messages by target group chats in the current WhatsApp number queue.\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/queue\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'groups' => [\n        '123456789000000000@g.us',\n        '123456789000000000@g.us',\n        '123456789000000000@g.us',\n        '123456789000000000@g.us'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Remove only a subset of queued messages by target message IDs in the current WhatsApp number queue.\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/queue\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'ids' => [\n        '61b371029cb10d10dfc85750',\n        '61b371029cb10d10dfc85751',\n        '61b371029cb10d10dfc85752',\n        '61b371029cb10d10dfc85753'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Remove all queued messages in the current WhatsApp number queue.\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\npayload = {}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Remove only a subset of queued messages by date range in the current WhatsApp number queue.\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\npayload = {\n    \"after\": \"2023-01-01T00:00:00.000Z\",\n    \"before\": \"2023-03-01T00:00:00.000Z\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Remove all queued messages except scheduled messages that will be delivered in a future date\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\npayload = { \"skipScheduled\": True }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Remove only a subset of queued messages by target phone numbers in the current WhatsApp number queue.\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\npayload = { \"phones\": [\"+1234567890\", \"+1234567890\", \"+1234567890\", \"+1234567890\"] }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Remove only a subset of queued messages by target group chats in the current WhatsApp number queue.\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\npayload = { \"groups\": [\"123456789000000000@g.us\", \"123456789000000000@g.us\", \"123456789000000000@g.us\", \"123456789000000000@g.us\"] }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Remove only a subset of queued messages by target message IDs in the current WhatsApp number queue.\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\npayload = { \"ids\": [\"61b371029cb10d10dfc85750\", \"61b371029cb10d10dfc85751\", \"61b371029cb10d10dfc85752\", \"61b371029cb10d10dfc85753\"] }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Remove all queued messages in the current WhatsApp number queue.\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Remove only a subset of queued messages by date range in the current WhatsApp number queue.\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"after\":\"2023-01-01T00:00:00.000Z\",\"before\":\"2023-03-01T00:00:00.000Z\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Remove all queued messages except scheduled messages that will be delivered in a future date\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"skipScheduled\":true}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Remove only a subset of queued messages by target phone numbers in the current WhatsApp number queue.\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phones\":[\"+1234567890\",\"+1234567890\",\"+1234567890\",\"+1234567890\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Remove only a subset of queued messages by target group chats in the current WhatsApp number queue.\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"groups\":[\"123456789000000000@g.us\",\"123456789000000000@g.us\",\"123456789000000000@g.us\",\"123456789000000000@g.us\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Remove only a subset of queued messages by target message IDs in the current WhatsApp number queue.\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/queue';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"ids\":[\"61b371029cb10d10dfc85750\",\"61b371029cb10d10dfc85751\",\"61b371029cb10d10dfc85752\",\"61b371029cb10d10dfc85753\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Remove all queued messages in the current WhatsApp number queue.\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Remove only a subset of queued messages by date range in the current WhatsApp number queue.\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"after\":\"2023-01-01T00:00:00.000Z\",\"before\":\"2023-03-01T00:00:00.000Z\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Remove all queued messages except scheduled messages that will be delivered in a future date\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"skipScheduled\":true}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Remove only a subset of queued messages by target phone numbers in the current WhatsApp number queue.\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"phones\":[\"+1234567890\",\"+1234567890\",\"+1234567890\",\"+1234567890\"]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Remove only a subset of queued messages by target group chats in the current WhatsApp number queue.\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"groups\":[\"123456789000000000@g.us\",\"123456789000000000@g.us\",\"123456789000000000@g.us\",\"123456789000000000@g.us\"]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Remove only a subset of queued messages by target message IDs in the current WhatsApp number queue.\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/queue',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"ids\":[\"61b371029cb10d10dfc85750\",\"61b371029cb10d10dfc85751\",\"61b371029cb10d10dfc85752\",\"61b371029cb10d10dfc85753\"]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Remove all queued messages in the current WhatsApp number queue.\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Remove only a subset of queued messages by date range in the current WhatsApp number queue.\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"after\\\":\\\"2023-01-01T00:00:00.000Z\\\",\\\"before\\\":\\\"2023-03-01T00:00:00.000Z\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Remove all queued messages except scheduled messages that will be delivered in a future date\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"skipScheduled\\\":true}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Remove only a subset of queued messages by target phone numbers in the current WhatsApp number queue.\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"phones\\\":[\\\"+1234567890\\\",\\\"+1234567890\\\",\\\"+1234567890\\\",\\\"+1234567890\\\"]}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Remove only a subset of queued messages by target group chats in the current WhatsApp number queue.\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"groups\\\":[\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\"]}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Remove only a subset of queued messages by target message IDs in the current WhatsApp number queue.\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"ids\\\":[\\\"61b371029cb10d10dfc85750\\\",\\\"61b371029cb10d10dfc85751\\\",\\\"61b371029cb10d10dfc85752\\\",\\\"61b371029cb10d10dfc85753\\\"]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Remove all queued messages in the current WhatsApp number queue.\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\n\tpayload := strings.NewReader(\"{}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Remove only a subset of queued messages by date range in the current WhatsApp number queue.\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\n\tpayload := strings.NewReader(\"{\\\"after\\\":\\\"2023-01-01T00:00:00.000Z\\\",\\\"before\\\":\\\"2023-03-01T00:00:00.000Z\\\"}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Remove all queued messages except scheduled messages that will be delivered in a future date\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\n\tpayload := strings.NewReader(\"{\\\"skipScheduled\\\":true}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Remove only a subset of queued messages by target phone numbers in the current WhatsApp number queue.\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\n\tpayload := strings.NewReader(\"{\\\"phones\\\":[\\\"+1234567890\\\",\\\"+1234567890\\\",\\\"+1234567890\\\",\\\"+1234567890\\\"]}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Remove only a subset of queued messages by target group chats in the current WhatsApp number queue.\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\n\tpayload := strings.NewReader(\"{\\\"groups\\\":[\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\"]}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Remove only a subset of queued messages by target message IDs in the current WhatsApp number queue.\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/queue\"\n\n\tpayload := strings.NewReader(\"{\\\"ids\\\":[\\\"61b371029cb10d10dfc85750\\\",\\\"61b371029cb10d10dfc85751\\\",\\\"61b371029cb10d10dfc85752\\\",\\\"61b371029cb10d10dfc85753\\\"]}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Remove all queued messages in the current WhatsApp number queue.\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Remove only a subset of queued messages by date range in the current WhatsApp number queue.\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"after\\\":\\\"2023-01-01T00:00:00.000Z\\\",\\\"before\\\":\\\"2023-03-01T00:00:00.000Z\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Remove all queued messages except scheduled messages that will be delivered in a future date\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"skipScheduled\\\":true}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Remove only a subset of queued messages by target phone numbers in the current WhatsApp number queue.\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"phones\\\":[\\\"+1234567890\\\",\\\"+1234567890\\\",\\\"+1234567890\\\",\\\"+1234567890\\\"]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Remove only a subset of queued messages by target group chats in the current WhatsApp number queue.\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"groups\\\":[\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\"]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Remove only a subset of queued messages by target message IDs in the current WhatsApp number queue.\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"ids\\\":[\\\"61b371029cb10d10dfc85750\\\",\\\"61b371029cb10d10dfc85751\\\",\\\"61b371029cb10d10dfc85752\\\",\\\"61b371029cb10d10dfc85753\\\"]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Remove all queued messages in the current WhatsApp number queue.\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Remove only a subset of queued messages by date range in the current WhatsApp number queue.\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"after\\\":\\\"2023-01-01T00:00:00.000Z\\\",\\\"before\\\":\\\"2023-03-01T00:00:00.000Z\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Remove all queued messages except scheduled messages that will be delivered in a future date\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"skipScheduled\\\":true}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Remove only a subset of queued messages by target phone numbers in the current WhatsApp number queue.\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"phones\\\":[\\\"+1234567890\\\",\\\"+1234567890\\\",\\\"+1234567890\\\",\\\"+1234567890\\\"]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Remove only a subset of queued messages by target group chats in the current WhatsApp number queue.\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"groups\\\":[\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\"]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Remove only a subset of queued messages by target message IDs in the current WhatsApp number queue.\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"ids\\\":[\\\"61b371029cb10d10dfc85750\\\",\\\"61b371029cb10d10dfc85751\\\",\\\"61b371029cb10d10dfc85752\\\",\\\"61b371029cb10d10dfc85753\\\"]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Remove all queued messages in the current WhatsApp number queue.\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{}\")\n  .asString();\n\n\n// Remove only a subset of queued messages by date range in the current WhatsApp number queue.\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"after\\\":\\\"2023-01-01T00:00:00.000Z\\\",\\\"before\\\":\\\"2023-03-01T00:00:00.000Z\\\"}\")\n  .asString();\n\n\n// Remove all queued messages except scheduled messages that will be delivered in a future date\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"skipScheduled\\\":true}\")\n  .asString();\n\n\n// Remove only a subset of queued messages by target phone numbers in the current WhatsApp number queue.\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"phones\\\":[\\\"+1234567890\\\",\\\"+1234567890\\\",\\\"+1234567890\\\",\\\"+1234567890\\\"]}\")\n  .asString();\n\n\n// Remove only a subset of queued messages by target group chats in the current WhatsApp number queue.\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"groups\\\":[\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\"]}\")\n  .asString();\n\n\n// Remove only a subset of queued messages by target message IDs in the current WhatsApp number queue.\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"ids\\\":[\\\"61b371029cb10d10dfc85750\\\",\\\"61b371029cb10d10dfc85751\\\",\\\"61b371029cb10d10dfc85752\\\",\\\"61b371029cb10d10dfc85753\\\"]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Remove all queued messages in the current WhatsApp number queue.\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Remove only a subset of queued messages by date range in the current WhatsApp number queue.\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"after\\\":\\\"2023-01-01T00:00:00.000Z\\\",\\\"before\\\":\\\"2023-03-01T00:00:00.000Z\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Remove all queued messages except scheduled messages that will be delivered in a future date\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"skipScheduled\\\":true}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Remove only a subset of queued messages by target phone numbers in the current WhatsApp number queue.\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"phones\\\":[\\\"+1234567890\\\",\\\"+1234567890\\\",\\\"+1234567890\\\",\\\"+1234567890\\\"]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Remove only a subset of queued messages by target group chats in the current WhatsApp number queue.\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"groups\\\":[\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\"]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Remove only a subset of queued messages by target message IDs in the current WhatsApp number queue.\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"ids\\\":[\\\"61b371029cb10d10dfc85750\\\",\\\"61b371029cb10d10dfc85751\\\",\\\"61b371029cb10d10dfc85752\\\",\\\"61b371029cb10d10dfc85753\\\"]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/queue\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Remove all queued messages in the current WhatsApp number queue.\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Remove only a subset of queued messages by date range in the current WhatsApp number queue.\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"after\\\":\\\"2023-01-01T00:00:00.000Z\\\",\\\"before\\\":\\\"2023-03-01T00:00:00.000Z\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Remove all queued messages except scheduled messages that will be delivered in a future date\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"skipScheduled\\\":true}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Remove only a subset of queued messages by target phone numbers in the current WhatsApp number queue.\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"phones\\\":[\\\"+1234567890\\\",\\\"+1234567890\\\",\\\"+1234567890\\\",\\\"+1234567890\\\"]}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Remove only a subset of queued messages by target group chats in the current WhatsApp number queue.\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"groups\\\":[\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\"]}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Remove only a subset of queued messages by target message IDs in the current WhatsApp number queue.\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/queue\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"ids\\\":[\\\"61b371029cb10d10dfc85750\\\",\\\"61b371029cb10d10dfc85751\\\",\\\"61b371029cb10d10dfc85752\\\",\\\"61b371029cb10d10dfc85753\\\"]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Remove all queued messages in the current WhatsApp number queue.\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/queue' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{}'\n\n\n# Remove only a subset of queued messages by date range in the current WhatsApp number queue.\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/queue' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"after\":\"2023-01-01T00:00:00.000Z\",\"before\":\"2023-03-01T00:00:00.000Z\"}'\n\n\n# Remove all queued messages except scheduled messages that will be delivered in a future date\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/queue' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"skipScheduled\":true}'\n\n\n# Remove only a subset of queued messages by target phone numbers in the current WhatsApp number queue.\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/queue' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"phones\":[\"+1234567890\",\"+1234567890\",\"+1234567890\",\"+1234567890\"]}'\n\n\n# Remove only a subset of queued messages by target group chats in the current WhatsApp number queue.\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/queue' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"groups\":[\"123456789000000000@g.us\",\"123456789000000000@g.us\",\"123456789000000000@g.us\",\"123456789000000000@g.us\"]}'\n\n\n# Remove only a subset of queued messages by target message IDs in the current WhatsApp number queue.\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/queue' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"ids\":[\"61b371029cb10d10dfc85750\",\"61b371029cb10d10dfc85751\",\"61b371029cb10d10dfc85752\",\"61b371029cb10d10dfc85753\"]}'"},{"lang":"ObjC","source":"// Remove all queued messages in the current WhatsApp number queue.\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{  };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Remove only a subset of queued messages by date range in the current WhatsApp number queue.\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"after\": @\"2023-01-01T00:00:00.000Z\",\n                              @\"before\": @\"2023-03-01T00:00:00.000Z\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Remove all queued messages except scheduled messages that will be delivered in a future date\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"skipScheduled\": @YES };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Remove only a subset of queued messages by target phone numbers in the current WhatsApp number queue.\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"phones\": @[ @\"+1234567890\", @\"+1234567890\", @\"+1234567890\", @\"+1234567890\" ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Remove only a subset of queued messages by target group chats in the current WhatsApp number queue.\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"groups\": @[ @\"123456789000000000@g.us\", @\"123456789000000000@g.us\", @\"123456789000000000@g.us\", @\"123456789000000000@g.us\" ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Remove only a subset of queued messages by target message IDs in the current WhatsApp number queue.\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"ids\": @[ @\"61b371029cb10d10dfc85750\", @\"61b371029cb10d10dfc85751\", @\"61b371029cb10d10dfc85752\", @\"61b371029cb10d10dfc85753\" ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/queue\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Remove all queued messages in the current WhatsApp number queue.\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/queue\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Remove only a subset of queued messages by date range in the current WhatsApp number queue.\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"after\": \"2023-01-01T00:00:00.000Z\",\n  \"before\": \"2023-03-01T00:00:00.000Z\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/queue\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Remove all queued messages except scheduled messages that will be delivered in a future date\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"skipScheduled\": true] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/queue\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Remove only a subset of queued messages by target phone numbers in the current WhatsApp number queue.\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"phones\": [\"+1234567890\", \"+1234567890\", \"+1234567890\", \"+1234567890\"]] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/queue\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Remove only a subset of queued messages by target group chats in the current WhatsApp number queue.\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"groups\": [\"123456789000000000@g.us\", \"123456789000000000@g.us\", \"123456789000000000@g.us\", \"123456789000000000@g.us\"]] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/queue\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Remove only a subset of queued messages by target message IDs in the current WhatsApp number queue.\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"ids\": [\"61b371029cb10d10dfc85750\", \"61b371029cb10d10dfc85751\", \"61b371029cb10d10dfc85752\", \"61b371029cb10d10dfc85753\"]] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/queue\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/profile/image":{"parameters":[],"get":{"summary":"Profile image","description":"Get WhatsApp number account profile image in JPEG format. Only authorized devices can return the profile image.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fprofile%2Fimage)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deviceProfileImage","security":[{"apiKey":[]}],"tags":["Profile"],"produces":["image/jpeg","application/json"],"parameters":[],"responses":{"200":{"description":"WhastApp profile image"},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not found WhatsApp number","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get device WhatsApp account profile image\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/profile/image \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get device WhatsApp account profile image\nhttp GET https://api.wassenger.com/v1/devices/{deviceId}/profile/image \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get device WhatsApp account profile image\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get device WhatsApp account profile image\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get device WhatsApp account profile image\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get device WhatsApp account profile image\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get device WhatsApp account profile image\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/profile/image');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get device WhatsApp account profile image\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get device WhatsApp account profile image\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get device WhatsApp account profile image\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get device WhatsApp account profile image\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get device WhatsApp account profile image\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get device WhatsApp account profile image\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get device WhatsApp account profile image\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get device WhatsApp account profile image\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get device WhatsApp account profile image\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get device WhatsApp account profile image\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get device WhatsApp account profile image\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get device WhatsApp account profile image\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get device WhatsApp account profile image\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get device WhatsApp account profile image\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"put":{"summary":"Update profile image","description":"Update profile avatar image for the WhatsApp number account. Image must be JPEG or PNG format, no bigger than 1MB. The minimum allowed image size is 192x192 pixels. The device session must be authorized and online, otherwise the API call will return an error. This endpoints accepts JSON or raw binary post bodies (application/octet-stream, image/*). For JSON bodies, you can define the image via remote URL (see \"url\" body field) or via data URI Base64 string (see \"image\" field) \n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fprofile%2Fimage&method=PUT&body=%7B%0A%20%20%22url%22%3A%20%22https%3A%2F%2Fvia.placeholder.com%2F280%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateProfileImage","security":[{"apiKey":[]}],"tags":["Profile"],"consumes":["image/jpeg","image/png","application/octet-stream","application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"image","description":"Image to update in JPEG or PNG format. Maximum 1MB. Minimum resolution is 192x192. Image can be uploaded via remote URL (JSON), data URI base64 (JSON) or binary raw content (application/octet-stream).","schema":{"type":"object","properties":{"url":{"type":"string","minLength":6,"maxLength":2000,"description":"URL of the image to download. It must be `http` or `https` valid URL pointing to a server accessible from the Internet."},"image":{"type":"string","maxLength":1300000,"description":"Image content as Data URI Base64 encoded string. See [data URI schema](https://en.wikipedia.org/wiki/Data_URI_scheme) for more information."}},"additionalProperties":false}}],"responses":{"200":{"description":"Image updated successfully","schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Field will be `true` if the operation succeed, otherwise `false`"},"image":{"type":"string","description":"New uploaded image public URL provided by WhatsApp"}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing permissions or API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Update WhatsApp account profile avatar image\ncurl --request PUT \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/profile/image \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"url\":\"https://via.placeholder.com/280\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Update WhatsApp account profile avatar image\necho '{\"url\":\"https://via.placeholder.com/280\"}' |  \\\n  http PUT https://api.wassenger.com/v1/devices/{deviceId}/profile/image \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Update WhatsApp account profile avatar image\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image';\nconst options = {\n  method: 'PUT',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"url\":\"https://via.placeholder.com/280\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Update WhatsApp account profile avatar image\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PUT',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {url: 'https://via.placeholder.com/280'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Update WhatsApp account profile avatar image\nconst unirest = require('unirest');\n\nconst req = unirest('PUT', 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  url: 'https://via.placeholder.com/280'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Update WhatsApp account profile avatar image\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PUT', 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image', [\n  'body' => '{\"url\":\"https://via.placeholder.com/280\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Update WhatsApp account profile avatar image\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'url' => 'https://via.placeholder.com/280'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/profile/image');\n$request->setRequestMethod('PUT');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Update WhatsApp account profile avatar image\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PUT\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'url' => 'https://via.placeholder.com/280'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Update WhatsApp account profile avatar image\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\"\n\npayload = { \"url\": \"https://via.placeholder.com/280\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.put(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update WhatsApp account profile avatar image\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image';\nconst options = {\n  method: 'PUT',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"url\":\"https://via.placeholder.com/280\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update WhatsApp account profile avatar image\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image',\n  method: 'PUT',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"url\":\"https://via.placeholder.com/280\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Update WhatsApp account profile avatar image\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Put.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"url\\\":\\\"https://via.placeholder.com/280\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Update WhatsApp account profile avatar image\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\"\n\n\tpayload := strings.NewReader(\"{\\\"url\\\":\\\"https://via.placeholder.com/280\\\"}\")\n\n\treq, _ := http.NewRequest(\"PUT\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Update WhatsApp account profile avatar image\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\");\nvar request = new RestRequest(Method.PUT);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"url\\\":\\\"https://via.placeholder.com/280\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Update WhatsApp account profile avatar image\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Put,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"url\\\":\\\"https://via.placeholder.com/280\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Update WhatsApp account profile avatar image\nHttpResponse<String> response = Unirest.put(\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"url\\\":\\\"https://via.placeholder.com/280\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Update WhatsApp account profile avatar image\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"url\\\":\\\"https://via.placeholder.com/280\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\")\n  .put(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Update WhatsApp account profile avatar image\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PUT\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"url\\\":\\\"https://via.placeholder.com/280\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Update WhatsApp account profile avatar image\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{\"url\":\"https://via.placeholder.com/280\"}'"},{"lang":"ObjC","source":"// Update WhatsApp account profile avatar image\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"url\": @\"https://via.placeholder.com/280\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PUT\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Update WhatsApp account profile avatar image\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"url\": \"https://via.placeholder.com/280\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PUT\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/profile":{"parameters":[],"get":{"summary":"Get profile","description":"Get device WhatsApp profile information, including public alias, status description and profile image.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fprofile)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deviceProfile","security":[{"apiKey":[]}],"tags":["Profile"],"produces":["application/json"],"parameters":[{"in":"query","type":"string","name":"include","enum":["profileImage"]}],"responses":{"200":{"description":"WhatsApp profile information","schema":{"type":"object","properties":{"name":{"type":"string"},"status":{"type":"string"},"hasImage":{"type":"boolean"},"image":{"type":"string"}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get device WhatsApp account profile information\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/profile \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get device WhatsApp account profile information\nhttp GET https://api.wassenger.com/v1/devices/{deviceId}/profile \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get device WhatsApp account profile information\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/profile';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get device WhatsApp account profile information\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/profile',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get device WhatsApp account profile information\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/profile');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get device WhatsApp account profile information\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/profile', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get device WhatsApp account profile information\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/profile');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get device WhatsApp account profile information\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/profile\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get device WhatsApp account profile information\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/profile\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get device WhatsApp account profile information\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/profile';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get device WhatsApp account profile information\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/profile',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get device WhatsApp account profile information\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/profile\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get device WhatsApp account profile information\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/profile\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get device WhatsApp account profile information\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/profile\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get device WhatsApp account profile information\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/profile\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get device WhatsApp account profile information\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/profile\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get device WhatsApp account profile information\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/profile\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get device WhatsApp account profile information\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/profile\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get device WhatsApp account profile information\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/profile' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get device WhatsApp account profile information\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/profile\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get device WhatsApp account profile information\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/profile\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Update profile","description":"Update device WhatsApp profile information. Device must be authorized and online in order to update the profile information in the WhatApp account.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fprofile&method=PATCH&body=%7B%0A%20%20%22name%22%3A%20%22John%20Doe%22%2C%0A%20%20%22status%22%3A%20%22Hey%20there%2C%20this%20is%20me%20updating%20my%20WhatsApp%20profile%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deviceProfileUpdate","security":[{"apiKey":[]}],"tags":["Profile"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"updateProfile","schema":{"type":"object","properties":{"name":{"type":["string","null"],"minLength":1,"maxLength":25,"description":"WhatsApp profile public name"},"status":{"type":["string","null"],"minLength":1,"maxLength":130,"description":"WhatsApp profile public status description"},"businessProfile":{"type":"object","properties":{"address":{"type":["string","null"],"minLength":1,"maxLength":256,"description":"Business physical address. E.g: 20W 34th St, New York, NY 10001, USA"},"description":{"type":["string","null"],"minLength":1,"maxLength":256,"description":"Optional business activity description"},"email":{"type":"string","format":"email","minLength":1,"maxLength":128,"description":"Optional business contact email"},"websites":{"type":"array","items":{"type":"string","minLength":1,"maxLength":256},"maxItems":2,"description":"Optional business website URL. Up to 2 websites are allowed."},"categories":{"type":"array","items":{"type":"string","enum":["other_category","automotive_service","clothing_and_accessories","art_and_entertainment","beauty_cosmetics_and_personal_care","education","event_organizer","finance","grocery","hotel","medicine_and_health","non_profit","restaurant","retail_purchases_and_sales","travel_and_transportation"]},"maxItems":3,"description":"Optional bussiness categories according to WhatsApp, up to 3 categories."},"businessHours":{"type":"object","properties":{"timezone":{"type":["string","null"],"minLength":1,"maxLength":100,"description":"Optional opening hours time zone. [See the list of allowed time zones values here](https://bit.ly/3wvIqJC)"},"monday":{"type":"object","properties":{"mode":{"type":"string","enum":["specific_hours","open_24h","appointment_only"],"default":"specific_hours"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"integer","minimum":0,"maximum":24,"description":"Open hour time in 24h format. It can be a number between 0 and 24"},"minute":{"type":"integer","minimum":0,"maximum":59,"description":"Open minute time. It can a number betwen 0 and 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"integer","minimum":0,"maximum":24,"description":"Close hour time in 24h format. It can be a number between 0 and 24"},"minute":{"type":"integer","minimum":0,"maximum":59,"description":"Close minute time. It can a number betwen 0 and 59"}},"additionalProperties":false}},"additionalProperties":false,"description":"Specifies the opening and closing hours time range in 24h format. You can define up to two hours range. E.g: 9:00 to 13:00 and 16:00 to 20:00."},"maxItems":2,"description":"Optional business opening hours, only when using `mode` = `specific_hours`, otherwise ignored."}},"additionalProperties":false},"tuesday":{"type":"object","properties":{"mode":{"type":"string","enum":["specific_hours","open_24h","appointment_only"],"default":"specific_hours"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"integer","minimum":0,"maximum":24,"description":"Open hour time in 24h format. It can be a number between 0 and 24"},"minute":{"type":"integer","minimum":0,"maximum":59,"description":"Open minute time. It can a number betwen 0 and 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"integer","minimum":0,"maximum":24,"description":"Close hour time in 24h format. It can be a number between 0 and 24"},"minute":{"type":"integer","minimum":0,"maximum":59,"description":"Close minute time. It can a number betwen 0 and 59"}},"additionalProperties":false}},"additionalProperties":false,"description":"Specifies the opening and closing hours time range in 24h format. You can define up to two hours range. E.g: 9:00 to 13:00 and 16:00 to 20:00."},"maxItems":2,"description":"Optional business opening hours, only when using `mode` = `specific_hours`, otherwise ignored."}},"additionalProperties":false},"wednesday":{"type":"object","properties":{"mode":{"type":"string","enum":["specific_hours","open_24h","appointment_only"],"default":"specific_hours"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"integer","minimum":0,"maximum":24,"description":"Open hour time in 24h format. It can be a number between 0 and 24"},"minute":{"type":"integer","minimum":0,"maximum":59,"description":"Open minute time. It can a number betwen 0 and 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"integer","minimum":0,"maximum":24,"description":"Close hour time in 24h format. It can be a number between 0 and 24"},"minute":{"type":"integer","minimum":0,"maximum":59,"description":"Close minute time. It can a number betwen 0 and 59"}},"additionalProperties":false}},"additionalProperties":false,"description":"Specifies the opening and closing hours time range in 24h format. You can define up to two hours range. E.g: 9:00 to 13:00 and 16:00 to 20:00."},"maxItems":2,"description":"Optional business opening hours, only when using `mode` = `specific_hours`, otherwise ignored."}},"additionalProperties":false},"thursday":{"type":"object","properties":{"mode":{"type":"string","enum":["specific_hours","open_24h","appointment_only"],"default":"specific_hours"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"integer","minimum":0,"maximum":24,"description":"Open hour time in 24h format. It can be a number between 0 and 24"},"minute":{"type":"integer","minimum":0,"maximum":59,"description":"Open minute time. It can a number betwen 0 and 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"integer","minimum":0,"maximum":24,"description":"Close hour time in 24h format. It can be a number between 0 and 24"},"minute":{"type":"integer","minimum":0,"maximum":59,"description":"Close minute time. It can a number betwen 0 and 59"}},"additionalProperties":false}},"additionalProperties":false,"description":"Specifies the opening and closing hours time range in 24h format. You can define up to two hours range. E.g: 9:00 to 13:00 and 16:00 to 20:00."},"maxItems":2,"description":"Optional business opening hours, only when using `mode` = `specific_hours`, otherwise ignored."}},"additionalProperties":false},"friday":{"type":"object","properties":{"mode":{"type":"string","enum":["specific_hours","open_24h","appointment_only"],"default":"specific_hours"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"integer","minimum":0,"maximum":24,"description":"Open hour time in 24h format. It can be a number between 0 and 24"},"minute":{"type":"integer","minimum":0,"maximum":59,"description":"Open minute time. It can a number betwen 0 and 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"integer","minimum":0,"maximum":24,"description":"Close hour time in 24h format. It can be a number between 0 and 24"},"minute":{"type":"integer","minimum":0,"maximum":59,"description":"Close minute time. It can a number betwen 0 and 59"}},"additionalProperties":false}},"additionalProperties":false,"description":"Specifies the opening and closing hours time range in 24h format. You can define up to two hours range. E.g: 9:00 to 13:00 and 16:00 to 20:00."},"maxItems":2,"description":"Optional business opening hours, only when using `mode` = `specific_hours`, otherwise ignored."}},"additionalProperties":false},"saturday":{"type":"object","properties":{"mode":{"type":"string","enum":["specific_hours","open_24h","appointment_only"],"default":"specific_hours"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"integer","minimum":0,"maximum":24,"description":"Open hour time in 24h format. It can be a number between 0 and 24"},"minute":{"type":"integer","minimum":0,"maximum":59,"description":"Open minute time. It can a number betwen 0 and 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"integer","minimum":0,"maximum":24,"description":"Close hour time in 24h format. It can be a number between 0 and 24"},"minute":{"type":"integer","minimum":0,"maximum":59,"description":"Close minute time. It can a number betwen 0 and 59"}},"additionalProperties":false}},"additionalProperties":false,"description":"Specifies the opening and closing hours time range in 24h format. You can define up to two hours range. E.g: 9:00 to 13:00 and 16:00 to 20:00."},"maxItems":2,"description":"Optional business opening hours, only when using `mode` = `specific_hours`, otherwise ignored."}},"additionalProperties":false},"sunday":{"type":"object","properties":{"mode":{"type":"string","enum":["specific_hours","open_24h","appointment_only"],"default":"specific_hours"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"integer","minimum":0,"maximum":24,"description":"Open hour time in 24h format. It can be a number between 0 and 24"},"minute":{"type":"integer","minimum":0,"maximum":59,"description":"Open minute time. It can a number betwen 0 and 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"integer","minimum":0,"maximum":24,"description":"Close hour time in 24h format. It can be a number between 0 and 24"},"minute":{"type":"integer","minimum":0,"maximum":59,"description":"Close minute time. It can a number betwen 0 and 59"}},"additionalProperties":false}},"additionalProperties":false,"description":"Specifies the opening and closing hours time range in 24h format. You can define up to two hours range. E.g: 9:00 to 13:00 and 16:00 to 20:00."},"maxItems":2,"description":"Optional business opening hours, only when using `mode` = `specific_hours`, otherwise ignored."}},"additionalProperties":false}},"additionalProperties":false,"description":"Optional business opening hours per week day."}},"additionalProperties":false,"description":"Update business profile public information. **Note**: only supported in WhatsApp Business numbers"}},"additionalProperties":false}}],"responses":{"200":{"description":"WhatsApp profile updated","schema":{"type":"object","properties":{"name":{"type":"string"},"status":{"type":"string"},"hasImage":{"type":"boolean"},"image":{"type":"string"}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Device session is not available or online","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get device WhatsApp account profile information\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/profile \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"name\":\"John Doe\",\"status\":\"Hey there, this is me updating my WhatsApp profile\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get device WhatsApp account profile information\necho '{\"name\":\"John Doe\",\"status\":\"Hey there, this is me updating my WhatsApp profile\"}' |  \\\n  http PATCH https://api.wassenger.com/v1/devices/{deviceId}/profile \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get device WhatsApp account profile information\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/profile';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"John Doe\",\"status\":\"Hey there, this is me updating my WhatsApp profile\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get device WhatsApp account profile information\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/profile',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {name: 'John Doe', status: 'Hey there, this is me updating my WhatsApp profile'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get device WhatsApp account profile information\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/profile');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  name: 'John Doe',\n  status: 'Hey there, this is me updating my WhatsApp profile'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get device WhatsApp account profile information\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/profile', [\n  'body' => '{\"name\":\"John Doe\",\"status\":\"Hey there, this is me updating my WhatsApp profile\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get device WhatsApp account profile information\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'name' => 'John Doe',\n  'status' => 'Hey there, this is me updating my WhatsApp profile'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/profile');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get device WhatsApp account profile information\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/profile\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'name' => 'John Doe',\n    'status' => 'Hey there, this is me updating my WhatsApp profile'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get device WhatsApp account profile information\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/profile\"\n\npayload = {\n    \"name\": \"John Doe\",\n    \"status\": \"Hey there, this is me updating my WhatsApp profile\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get device WhatsApp account profile information\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/profile';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"John Doe\",\"status\":\"Hey there, this is me updating my WhatsApp profile\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get device WhatsApp account profile information\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/profile',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"name\":\"John Doe\",\"status\":\"Hey there, this is me updating my WhatsApp profile\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get device WhatsApp account profile information\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/profile\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"name\\\":\\\"John Doe\\\",\\\"status\\\":\\\"Hey there, this is me updating my WhatsApp profile\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get device WhatsApp account profile information\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/profile\"\n\n\tpayload := strings.NewReader(\"{\\\"name\\\":\\\"John Doe\\\",\\\"status\\\":\\\"Hey there, this is me updating my WhatsApp profile\\\"}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get device WhatsApp account profile information\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/profile\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"name\\\":\\\"John Doe\\\",\\\"status\\\":\\\"Hey there, this is me updating my WhatsApp profile\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get device WhatsApp account profile information\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/profile\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"name\\\":\\\"John Doe\\\",\\\"status\\\":\\\"Hey there, this is me updating my WhatsApp profile\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get device WhatsApp account profile information\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/devices/{deviceId}/profile\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"name\\\":\\\"John Doe\\\",\\\"status\\\":\\\"Hey there, this is me updating my WhatsApp profile\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get device WhatsApp account profile information\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"name\\\":\\\"John Doe\\\",\\\"status\\\":\\\"Hey there, this is me updating my WhatsApp profile\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/profile\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get device WhatsApp account profile information\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/profile\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"name\\\":\\\"John Doe\\\",\\\"status\\\":\\\"Hey there, this is me updating my WhatsApp profile\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get device WhatsApp account profile information\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/profile' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"name\":\"John Doe\",\"status\":\"Hey there, this is me updating my WhatsApp profile\"}'"},{"lang":"ObjC","source":"// Get device WhatsApp account profile information\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"name\": @\"John Doe\",\n                              @\"status\": @\"Hey there, this is me updating my WhatsApp profile\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/profile\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get device WhatsApp account profile information\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"name\": \"John Doe\",\n  \"status\": \"Hey there, this is me updating my WhatsApp profile\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/profile\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/meta-ai-terms/accept":{"parameters":[],"post":{"summary":"Accept Meta's AI terms","description":"Accepts Meta's AI Terms (https://www.facebook.com/legal/ai-terms) and Privacy Policy (https://www.facebook.com/privacy/policy) for this number.\n\nCalling this endpoint is your acceptance, on behalf of the number owner, and it cannot be undone.\n\nWhatsApp asks each number to accept this notice once before it can text businesses that use AI from Meta. Until then those texts are held; they are sent right after the acceptance.\n\nSend the notice id from the number's `session.notices.metaAiTerms.noticeId`. If WhatsApp is showing a different notice the call fails with 409 and nothing is accepted.\n\nOnly the number owner or an admin can accept. Numbers connected by QR only.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fmeta-ai-terms%2Faccept&method=POST&body=%7B%0A%20%20%22accept%22%3A%20true%2C%0A%20%20%22noticeId%22%3A%20%2220231027%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"acceptMetaAiTerms","security":[{"apiKey":[]}],"tags":["Session"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"body","required":true,"schema":{"type":"object","required":["accept","noticeId"],"properties":{"accept":{"type":"boolean","enum":[true],"description":"Must be true: you accept Meta's AI terms for this number"},"noticeId":{"type":"string","pattern":"^\\d{1,20}$","description":"Id of the WhatsApp notice being accepted"}}}}],"responses":{"200":{"description":"Accepted, or nothing needed to be accepted","schema":{"type":"object","properties":{"accepted":{"type":"boolean"},"alreadyAccepted":{"type":"boolean"},"required":{"type":"boolean","description":"False when WhatsApp no longer asks this number to accept"},"noticeId":{"type":"string"},"released":{"type":"object","properties":{"messages":{"type":"number","description":"Held messages sent now"},"campaignMessages":{"type":"number","description":"Held campaign messages sent now"}}}}}},"400":{"description":"Missing accept or notice id, or not a QR number","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Only the number owner or an admin can accept","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"WhatsApp is showing a different notice; nothing was accepted","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"WhatsApp did not confirm the acceptance or the session is not available; try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Accept Meta's AI terms for this number\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/meta-ai-terms/accept \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"accept\":true,\"noticeId\":\"20231027\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Accept Meta's AI terms for this number\necho '{\"accept\":true,\"noticeId\":\"20231027\"}' |  \\\n  http POST https://api.wassenger.com/v1/devices/{deviceId}/meta-ai-terms/accept \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Accept Meta's AI terms for this number\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/meta-ai-terms/accept';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"accept\":true,\"noticeId\":\"20231027\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Accept Meta's AI terms for this number\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/meta-ai-terms/accept',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {accept: true, noticeId: '20231027'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Accept Meta's AI terms for this number\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/meta-ai-terms/accept');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  accept: true,\n  noticeId: '20231027'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Accept Meta's AI terms for this number\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/meta-ai-terms/accept', [\n  'body' => '{\"accept\":true,\"noticeId\":\"20231027\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Accept Meta's AI terms for this number\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'accept' => null,\n  'noticeId' => '20231027'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/meta-ai-terms/accept');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Accept Meta's AI terms for this number\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/meta-ai-terms/accept\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'accept' => null,\n    'noticeId' => '20231027'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Accept Meta's AI terms for this number\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/meta-ai-terms/accept\"\n\npayload = {\n    \"accept\": True,\n    \"noticeId\": \"20231027\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Accept Meta's AI terms for this number\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/meta-ai-terms/accept';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"accept\":true,\"noticeId\":\"20231027\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Accept Meta's AI terms for this number\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/meta-ai-terms/accept',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"accept\":true,\"noticeId\":\"20231027\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Accept Meta's AI terms for this number\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/meta-ai-terms/accept\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"accept\\\":true,\\\"noticeId\\\":\\\"20231027\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Accept Meta's AI terms for this number\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/meta-ai-terms/accept\"\n\n\tpayload := strings.NewReader(\"{\\\"accept\\\":true,\\\"noticeId\\\":\\\"20231027\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Accept Meta's AI terms for this number\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/meta-ai-terms/accept\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"accept\\\":true,\\\"noticeId\\\":\\\"20231027\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Accept Meta's AI terms for this number\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/meta-ai-terms/accept\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"accept\\\":true,\\\"noticeId\\\":\\\"20231027\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Accept Meta's AI terms for this number\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/meta-ai-terms/accept\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"accept\\\":true,\\\"noticeId\\\":\\\"20231027\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Accept Meta's AI terms for this number\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"accept\\\":true,\\\"noticeId\\\":\\\"20231027\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/meta-ai-terms/accept\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Accept Meta's AI terms for this number\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/meta-ai-terms/accept\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"accept\\\":true,\\\"noticeId\\\":\\\"20231027\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Accept Meta's AI terms for this number\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/meta-ai-terms/accept' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"accept\":true,\"noticeId\":\"20231027\"}'"},{"lang":"ObjC","source":"// Accept Meta's AI terms for this number\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"accept\": @YES,\n                              @\"noticeId\": @\"20231027\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/meta-ai-terms/accept\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Accept Meta's AI terms for this number\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"accept\": true,\n  \"noticeId\": \"20231027\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/meta-ai-terms/accept\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/meeting-links":{"parameters":[],"get":{"summary":"Get meeting links","description":"Get active meeting links generated for the specific WhatsApp number.\n\n\n\nOptionally use the search filters to find specific links by URL, token, message, creation or expiration date.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fmeeting-links&params=%5B%7B%22key%22%3A%22size%22%2C%22value%22%3A50%7D%2C%7B%22key%22%3A%22page%22%2C%22value%22%3A0%7D%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getMeetingLinks","security":[{"apiKey":[]}],"tags":["Meeting Links"],"parameters":[{"in":"query","name":"search","type":"string","maxLength":100,"description":"Search links by URL, token or message"},{"in":"query","name":"before","description":"Filter links created before a specific date","type":"string","format":"date-time"},{"in":"query","name":"after","description":"Filter links created before a specific date","type":"string","format":"date-time"},{"in":"query","name":"expiresBefore","description":"Filter links that expire before a specific date","type":"string","format":"date-time"},{"in":"query","name":"expiresAfter","description":"Filter links that expire after a specific date","type":"string","format":"date-time"},{"in":"query","name":"kind","type":"array","description":"Meeting link type: voice or video","collectionFormat":"csv","items":{"type":"string","enum":["voice","video"]},"maxItems":2},{"in":"query","name":"size","description":"Results page size","type":"number","format":"integer","default":200,"minimum":1,"maximum":200},{"in":"query","name":"page","description":"Results page number (starting from 0)","type":"number","format":"integer","default":0,"minimum":0,"maximum":20}],"responses":{"200":{"description":"List of available meeting links","schema":{"type":"array","items":{"$ref":"#/definitions/meetingLink"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get meeting links\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links?size=50&page=0' \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get meeting links\nhttp GET 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links?size=50&page=0' \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get meeting links\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links?size=50&page=0';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get meeting links\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links',\n  params: {size: '50', page: '0'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get meeting links\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links');\n\nreq.query({\n  size: '50',\n  page: '0'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get meeting links\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links?size=50&page=0', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get meeting links\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/meeting-links');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'size' => '50',\n  'page' => '0'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get meeting links\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links?size=50&page=0\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get meeting links\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\"\n\nquerystring = {\"size\":\"50\",\"page\":\"0\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get meeting links\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links?size=50&page=0';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get meeting links\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links?size=50&page=0',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get meeting links\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links?size=50&page=0\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get meeting links\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links?size=50&page=0\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get meeting links\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links?size=50&page=0\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get meeting links\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links?size=50&page=0\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get meeting links\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links?size=50&page=0\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get meeting links\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links?size=50&page=0\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get meeting links\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links?size=50&page=0\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get meeting links\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links?size=50&page=0' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get meeting links\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links?size=50&page=0\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get meeting links\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links?size=50&page=0\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"post":{"summary":"Create meeting link","description":"Create a new WhatsApp meeting link for voice or video call.\n\n\n\nUse Meeting Links to create a new voice or video call session with any WhatsApp user with a simple URL link.\n\nExample URL link: `https://call.whatsapp.com/voice/AhF2Ddl9j32Hf01`\n\n\n\nOptionally you can set a message description to remind you the purpose of the call and expiration time.\n\n\n\nBy default, meeting links will expire in 15 days if not used. When a meeeting link is used, it will expire automatically.\n\n\n\n> **Important**: the number session must be online in order to generate a new meeting link, otherwise the API will return a `503 Not Available` error.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fmeeting-links&method=POST&body=%7B%0A%20%20%22kind%22%3A%20%22video%22%2C%0A%20%20%22message%22%3A%20%22Sample%20call%20purpose%20description%2C%20up%20to%20500%20characters%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"createMeetingLink","security":[{"apiKey":[]}],"consumes":["application/json"],"produces":["application/json"],"tags":["Meeting Links"],"parameters":[{"in":"body","name":"call","description":"Optional meeting link creation parameters","schema":{"type":"object","properties":{"kind":{"type":"string","enum":["voice","video"],"description":"Call kind: video or voice","default":"voice"},"message":{"type":"string","maxLength":500,"description":"Optional call message private note describing the purpose of the call"},"expiration":{"type":"string","enum":["1h","2h","8h","12h","24h","2d","3d","4d","5d","6d","7d","15d","30d"],"description":"Call link expiration time","default":"30d"}},"required":["kind"],"additionalProperties":false}}],"responses":{"200":{"description":"Meeting link created","schema":{"$ref":"#/definitions/meetingLink"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unsupported operation - plan upgrade required","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Channel already exists with the same name","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Create a new video meeting link\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/meeting-links \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"kind\":\"video\",\"message\":\"Sample call purpose description, up to 500 characters\"}'\n\n\n// Create a new voice meeting link\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/meeting-links \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"kind\":\"voice\",\"message\":\"Sample call purpose description, up to 500 characters\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Create a new video meeting link\necho '{\"kind\":\"video\",\"message\":\"Sample call purpose description, up to 500 characters\"}' |  \\\n  http POST https://api.wassenger.com/v1/devices/{deviceId}/meeting-links \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Create a new voice meeting link\necho '{\"kind\":\"voice\",\"message\":\"Sample call purpose description, up to 500 characters\"}' |  \\\n  http POST https://api.wassenger.com/v1/devices/{deviceId}/meeting-links \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Create a new video meeting link\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"kind\":\"video\",\"message\":\"Sample call purpose description, up to 500 characters\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Create a new voice meeting link\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"kind\":\"voice\",\"message\":\"Sample call purpose description, up to 500 characters\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Create a new video meeting link\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    kind: 'video',\n    message: 'Sample call purpose description, up to 500 characters'\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Create a new voice meeting link\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    kind: 'voice',\n    message: 'Sample call purpose description, up to 500 characters'\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Create a new video meeting link\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  kind: 'video',\n  message: 'Sample call purpose description, up to 500 characters'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Create a new voice meeting link\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  kind: 'voice',\n  message: 'Sample call purpose description, up to 500 characters'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Create a new video meeting link\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links', [\n  'body' => '{\"kind\":\"video\",\"message\":\"Sample call purpose description, up to 500 characters\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Create a new voice meeting link\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links', [\n  'body' => '{\"kind\":\"voice\",\"message\":\"Sample call purpose description, up to 500 characters\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Create a new video meeting link\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'kind' => 'video',\n  'message' => 'Sample call purpose description, up to 500 characters'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/meeting-links');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Create a new voice meeting link\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'kind' => 'voice',\n  'message' => 'Sample call purpose description, up to 500 characters'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/meeting-links');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Create a new video meeting link\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'kind' => 'video',\n    'message' => 'Sample call purpose description, up to 500 characters'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Create a new voice meeting link\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'kind' => 'voice',\n    'message' => 'Sample call purpose description, up to 500 characters'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Create a new video meeting link\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\"\n\npayload = {\n    \"kind\": \"video\",\n    \"message\": \"Sample call purpose description, up to 500 characters\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Create a new voice meeting link\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\"\n\npayload = {\n    \"kind\": \"voice\",\n    \"message\": \"Sample call purpose description, up to 500 characters\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create a new video meeting link\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"kind\":\"video\",\"message\":\"Sample call purpose description, up to 500 characters\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Create a new voice meeting link\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"kind\":\"voice\",\"message\":\"Sample call purpose description, up to 500 characters\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create a new video meeting link\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"kind\":\"video\",\"message\":\"Sample call purpose description, up to 500 characters\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Create a new voice meeting link\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"kind\":\"voice\",\"message\":\"Sample call purpose description, up to 500 characters\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Create a new video meeting link\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"kind\\\":\\\"video\\\",\\\"message\\\":\\\"Sample call purpose description, up to 500 characters\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Create a new voice meeting link\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"kind\\\":\\\"voice\\\",\\\"message\\\":\\\"Sample call purpose description, up to 500 characters\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Create a new video meeting link\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\"\n\n\tpayload := strings.NewReader(\"{\\\"kind\\\":\\\"video\\\",\\\"message\\\":\\\"Sample call purpose description, up to 500 characters\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Create a new voice meeting link\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\"\n\n\tpayload := strings.NewReader(\"{\\\"kind\\\":\\\"voice\\\",\\\"message\\\":\\\"Sample call purpose description, up to 500 characters\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Create a new video meeting link\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"kind\\\":\\\"video\\\",\\\"message\\\":\\\"Sample call purpose description, up to 500 characters\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Create a new voice meeting link\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"kind\\\":\\\"voice\\\",\\\"message\\\":\\\"Sample call purpose description, up to 500 characters\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Create a new video meeting link\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"kind\\\":\\\"video\\\",\\\"message\\\":\\\"Sample call purpose description, up to 500 characters\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Create a new voice meeting link\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"kind\\\":\\\"voice\\\",\\\"message\\\":\\\"Sample call purpose description, up to 500 characters\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Create a new video meeting link\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"kind\\\":\\\"video\\\",\\\"message\\\":\\\"Sample call purpose description, up to 500 characters\\\"}\")\n  .asString();\n\n\n// Create a new voice meeting link\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"kind\\\":\\\"voice\\\",\\\"message\\\":\\\"Sample call purpose description, up to 500 characters\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Create a new video meeting link\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"kind\\\":\\\"video\\\",\\\"message\\\":\\\"Sample call purpose description, up to 500 characters\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Create a new voice meeting link\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"kind\\\":\\\"voice\\\",\\\"message\\\":\\\"Sample call purpose description, up to 500 characters\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Create a new video meeting link\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"kind\\\":\\\"video\\\",\\\"message\\\":\\\"Sample call purpose description, up to 500 characters\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Create a new voice meeting link\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"kind\\\":\\\"voice\\\",\\\"message\\\":\\\"Sample call purpose description, up to 500 characters\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Create a new video meeting link\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"kind\":\"video\",\"message\":\"Sample call purpose description, up to 500 characters\"}'\n\n\n# Create a new voice meeting link\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"kind\":\"voice\",\"message\":\"Sample call purpose description, up to 500 characters\"}'"},{"lang":"ObjC","source":"// Create a new video meeting link\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"kind\": @\"video\",\n                              @\"message\": @\"Sample call purpose description, up to 500 characters\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Create a new voice meeting link\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"kind\": @\"voice\",\n                              @\"message\": @\"Sample call purpose description, up to 500 characters\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Create a new video meeting link\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"kind\": \"video\",\n  \"message\": \"Sample call purpose description, up to 500 characters\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Create a new voice meeting link\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"kind\": \"voice\",\n  \"message\": \"Sample call purpose description, up to 500 characters\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Delete meeting links","description":"Delete one or multiple meeting links by ID, URL, token or creation date.\n\n\n\n**Note**: meeting links are only deleted internally, but cannot be revoked on WhatsApp. If you have shared the link with other people, they will still be able to use it if the link did not expire.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fmeeting-links&method=DELETE&body=%7B%0A%20%20%22ids%22%3A%20%5B%0A%20%20%20%20%22%22%0A%20%20%5D%2C%0A%20%20%22urls%22%3A%20%5B%0A%20%20%20%20%22WhatsApp%22%0A%20%20%5D%2C%0A%20%20%22createdBefore%22%3A%20%22%22%2C%0A%20%20%22createdAfter%22%3A%20%22%22%2C%0A%20%20%22expiresBefore%22%3A%20%22%22%2C%0A%20%20%22expiresAfter%22%3A%20%22%22%2C%0A%20%20%22limit%22%3A%205%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deleteMeetingLinks","security":[{"apiKey":[]}],"tags":["Meeting Links"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"delete","description":"Deletion filters","schema":{"type":"object","properties":{"all":{"type":"boolean","description":"Remove all call links","default":false},"ids":{"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","maxLength":24,"minLength":24},"minItems":1,"maxItems":200,"description":"Call link IDs to remove"},"urls":{"type":"array","items":{"type":"string","maxLength":100},"minItems":1,"maxItems":200,"description":"Call link URLs to remove. E.g: `https://call.whatsapp.com/voice/1234567890`"},"createdBefore":{"type":"string","format":"date-time","description":"Remove call links created before this date"},"createdAfter":{"type":"string","format":"date-time","description":"Remove call links created after this date"},"expiresBefore":{"type":"string","format":"date-time","description":"Remove call links that expire before this date"},"expiresAfter":{"type":"string","format":"date-time","description":"Remove call links that expire after this date"}},"additionalProperties":false}}],"responses":{"200":{"description":"Meeting links deleted successfully","schema":{"type":"object","properties":{"total":{"type":"number","description":"Total number of meeting links deleted"}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Mising required channel permissions or feature not supported in current plan","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Search publicly available channels\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/meeting-links \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"ids\":[\"\"],\"urls\":[\"WhatsApp\"],\"createdBefore\":\"\",\"createdAfter\":\"\",\"expiresBefore\":\"\",\"expiresAfter\":\"\",\"limit\":5}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Search publicly available channels\necho '{\"ids\":[\"\"],\"urls\":[\"WhatsApp\"],\"createdBefore\":\"\",\"createdAfter\":\"\",\"expiresBefore\":\"\",\"expiresAfter\":\"\",\"limit\":5}' |  \\\n  http DELETE https://api.wassenger.com/v1/devices/{deviceId}/meeting-links \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Search publicly available channels\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"ids\":[\"\"],\"urls\":[\"WhatsApp\"],\"createdBefore\":\"\",\"createdAfter\":\"\",\"expiresBefore\":\"\",\"expiresAfter\":\"\",\"limit\":5}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Search publicly available channels\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    ids: [''],\n    urls: ['WhatsApp'],\n    createdBefore: '',\n    createdAfter: '',\n    expiresBefore: '',\n    expiresAfter: '',\n    limit: 5\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Search publicly available channels\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  ids: [\n    ''\n  ],\n  urls: [\n    'WhatsApp'\n  ],\n  createdBefore: '',\n  createdAfter: '',\n  expiresBefore: '',\n  expiresAfter: '',\n  limit: 5\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Search publicly available channels\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links', [\n  'body' => '{\"ids\":[\"\"],\"urls\":[\"WhatsApp\"],\"createdBefore\":\"\",\"createdAfter\":\"\",\"expiresBefore\":\"\",\"expiresAfter\":\"\",\"limit\":5}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Search publicly available channels\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'ids' => [\n    ''\n  ],\n  'urls' => [\n    'WhatsApp'\n  ],\n  'createdBefore' => '',\n  'createdAfter' => '',\n  'expiresBefore' => '',\n  'expiresAfter' => '',\n  'limit' => 5\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/meeting-links');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Search publicly available channels\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'ids' => [\n        ''\n    ],\n    'urls' => [\n        'WhatsApp'\n    ],\n    'createdBefore' => '',\n    'createdAfter' => '',\n    'expiresBefore' => '',\n    'expiresAfter' => '',\n    'limit' => 5\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Search publicly available channels\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\"\n\npayload = {\n    \"ids\": [\"\"],\n    \"urls\": [\"WhatsApp\"],\n    \"createdBefore\": \"\",\n    \"createdAfter\": \"\",\n    \"expiresBefore\": \"\",\n    \"expiresAfter\": \"\",\n    \"limit\": 5\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Search publicly available channels\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"ids\":[\"\"],\"urls\":[\"WhatsApp\"],\"createdBefore\":\"\",\"createdAfter\":\"\",\"expiresBefore\":\"\",\"expiresAfter\":\"\",\"limit\":5}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Search publicly available channels\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"ids\":[\"\"],\"urls\":[\"WhatsApp\"],\"createdBefore\":\"\",\"createdAfter\":\"\",\"expiresBefore\":\"\",\"expiresAfter\":\"\",\"limit\":5}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Search publicly available channels\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"ids\\\":[\\\"\\\"],\\\"urls\\\":[\\\"WhatsApp\\\"],\\\"createdBefore\\\":\\\"\\\",\\\"createdAfter\\\":\\\"\\\",\\\"expiresBefore\\\":\\\"\\\",\\\"expiresAfter\\\":\\\"\\\",\\\"limit\\\":5}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Search publicly available channels\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\"\n\n\tpayload := strings.NewReader(\"{\\\"ids\\\":[\\\"\\\"],\\\"urls\\\":[\\\"WhatsApp\\\"],\\\"createdBefore\\\":\\\"\\\",\\\"createdAfter\\\":\\\"\\\",\\\"expiresBefore\\\":\\\"\\\",\\\"expiresAfter\\\":\\\"\\\",\\\"limit\\\":5}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Search publicly available channels\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"ids\\\":[\\\"\\\"],\\\"urls\\\":[\\\"WhatsApp\\\"],\\\"createdBefore\\\":\\\"\\\",\\\"createdAfter\\\":\\\"\\\",\\\"expiresBefore\\\":\\\"\\\",\\\"expiresAfter\\\":\\\"\\\",\\\"limit\\\":5}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Search publicly available channels\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"ids\\\":[\\\"\\\"],\\\"urls\\\":[\\\"WhatsApp\\\"],\\\"createdBefore\\\":\\\"\\\",\\\"createdAfter\\\":\\\"\\\",\\\"expiresBefore\\\":\\\"\\\",\\\"expiresAfter\\\":\\\"\\\",\\\"limit\\\":5}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Search publicly available channels\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"ids\\\":[\\\"\\\"],\\\"urls\\\":[\\\"WhatsApp\\\"],\\\"createdBefore\\\":\\\"\\\",\\\"createdAfter\\\":\\\"\\\",\\\"expiresBefore\\\":\\\"\\\",\\\"expiresAfter\\\":\\\"\\\",\\\"limit\\\":5}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Search publicly available channels\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"ids\\\":[\\\"\\\"],\\\"urls\\\":[\\\"WhatsApp\\\"],\\\"createdBefore\\\":\\\"\\\",\\\"createdAfter\\\":\\\"\\\",\\\"expiresBefore\\\":\\\"\\\",\\\"expiresAfter\\\":\\\"\\\",\\\"limit\\\":5}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Search publicly available channels\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"ids\\\":[\\\"\\\"],\\\"urls\\\":[\\\"WhatsApp\\\"],\\\"createdBefore\\\":\\\"\\\",\\\"createdAfter\\\":\\\"\\\",\\\"expiresBefore\\\":\\\"\\\",\\\"expiresAfter\\\":\\\"\\\",\\\"limit\\\":5}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Search publicly available channels\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/meeting-links' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"ids\":[\"\"],\"urls\":[\"WhatsApp\"],\"createdBefore\":\"\",\"createdAfter\":\"\",\"expiresBefore\":\"\",\"expiresAfter\":\"\",\"limit\":5}'"},{"lang":"ObjC","source":"// Search publicly available channels\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"ids\": @[ @\"\" ],\n                              @\"urls\": @[ @\"WhatsApp\" ],\n                              @\"createdBefore\": @\"\",\n                              @\"createdAfter\": @\"\",\n                              @\"expiresBefore\": @\"\",\n                              @\"expiresAfter\": @\"\",\n                              @\"limit\": @5 };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Search publicly available channels\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"ids\": [\"\"],\n  \"urls\": [\"WhatsApp\"],\n  \"createdBefore\": \"\",\n  \"createdAfter\": \"\",\n  \"expiresBefore\": \"\",\n  \"expiresAfter\": \"\",\n  \"limit\": 5\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/meeting-links\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/labels":{"parameters":[],"get":{"summary":"List labels","description":"Get available labels configuration for the specific device.\n\nWorks with both WhatsApp Personal and Business numbers.\n\n\n\nLabel entries are automatically synced with your WhatsApp Business app.\n\nYou can also create platform-level chat labels that will be only accessible within the chat app.\n\n\n\nWhatsApp Personal numbers can also create and use chat labels feature from the platform chat, but not from WhatsApp Personal.\n\n\n\n**Note**: this endpoint is only available for devices running a Platform product plan.\n\nOtherwise, it will return a `403 - Forbidden` response status.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Flabels)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getLabels","security":[{"apiKey":[]}],"tags":["Labels"],"responses":{"200":{"description":"List of available labels","schema":{"type":"array","items":{"$ref":"#/definitions/label"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Feature not available in current plan","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get available labels per WhatsApp number\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/labels \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get available labels per WhatsApp number\nhttp GET https://api.wassenger.com/v1/devices/{deviceId}/labels \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get available labels per WhatsApp number\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/labels';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get available labels per WhatsApp number\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/labels',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get available labels per WhatsApp number\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/labels');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get available labels per WhatsApp number\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/labels', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get available labels per WhatsApp number\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/labels');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get available labels per WhatsApp number\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/labels\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get available labels per WhatsApp number\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/labels\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get available labels per WhatsApp number\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/labels';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get available labels per WhatsApp number\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/labels',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get available labels per WhatsApp number\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/labels\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get available labels per WhatsApp number\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/labels\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get available labels per WhatsApp number\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/labels\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get available labels per WhatsApp number\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/labels\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get available labels per WhatsApp number\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/labels\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get available labels per WhatsApp number\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/labels\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get available labels per WhatsApp number\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/labels\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get available labels per WhatsApp number\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/labels' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get available labels per WhatsApp number\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/labels\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get available labels per WhatsApp number\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/labels\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"post":{"summary":"Create label","description":"Create a new label for the chat app for the specific WhatsApp device.\n\n\n\nLabels created via API are not synced with the linked WhatsApp account, therefore labels will be only available via multi-agent chat and API.\n\n\n\n**Note**: this endpoint is limited to plans with multi-agent chat support.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Flabels&method=POST&body=%7B%0A%20%20%22name%22%3A%20%22welcome%22%2C%0A%20%20%22color%22%3A%20%22orange%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"createLabel","security":[{"apiKey":[]}],"tags":["Labels"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"label","schema":{"type":"object","properties":{"name":{"type":"string","maxLength":30,"minLength":1},"description":{"type":["string","null"],"maxLength":100,"minLength":2},"color":{"type":"string","enum":["ruby","tomato","orange","sunflower","bubble","rose","poppy","rouge","raspberry","purple","lavender","violet","pool","emerald","kelly","apple","turquoise","aqua","gold","latte","cocoa","iron"]}},"required":["name","color"],"additionalProperties":false}}],"responses":{"200":{"description":"Label created","schema":{"type":"object"}},"400":{"description":"Invalid or missing body fields","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict - label shortcut already exists","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Create label\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/labels \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"name\":\"welcome\",\"color\":\"orange\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Create label\necho '{\"name\":\"welcome\",\"color\":\"orange\"}' |  \\\n  http POST https://api.wassenger.com/v1/devices/{deviceId}/labels \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Create label\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/labels';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"welcome\",\"color\":\"orange\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Create label\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/labels',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {name: 'welcome', color: 'orange'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Create label\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/labels');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  name: 'welcome',\n  color: 'orange'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Create label\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/labels', [\n  'body' => '{\"name\":\"welcome\",\"color\":\"orange\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Create label\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'name' => 'welcome',\n  'color' => 'orange'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/labels');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Create label\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/labels\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'name' => 'welcome',\n    'color' => 'orange'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Create label\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/labels\"\n\npayload = {\n    \"name\": \"welcome\",\n    \"color\": \"orange\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create label\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/labels';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"welcome\",\"color\":\"orange\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create label\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/labels',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"name\":\"welcome\",\"color\":\"orange\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Create label\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/labels\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"name\\\":\\\"welcome\\\",\\\"color\\\":\\\"orange\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Create label\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/labels\"\n\n\tpayload := strings.NewReader(\"{\\\"name\\\":\\\"welcome\\\",\\\"color\\\":\\\"orange\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Create label\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/labels\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"name\\\":\\\"welcome\\\",\\\"color\\\":\\\"orange\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Create label\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/labels\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"name\\\":\\\"welcome\\\",\\\"color\\\":\\\"orange\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Create label\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/labels\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"name\\\":\\\"welcome\\\",\\\"color\\\":\\\"orange\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Create label\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"name\\\":\\\"welcome\\\",\\\"color\\\":\\\"orange\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/labels\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Create label\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/labels\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"name\\\":\\\"welcome\\\",\\\"color\\\":\\\"orange\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Create label\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/labels' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"name\":\"welcome\",\"color\":\"orange\"}'"},{"lang":"ObjC","source":"// Create label\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"name\": @\"welcome\",\n                              @\"color\": @\"orange\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/labels\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Create label\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"name\": \"welcome\",\n  \"color\": \"orange\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/labels\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Update label","description":"Update an existent label by name.\n\n\n\nOnly the label description and color can be updated. Label name is not editable, but you can delete a label and create a new one with a different name.\n\n\n\nLabels updated via API are not synced with the linked WhatsApp account, therefore labels updates will be only available via multi-agent chat and API.\n\n\n\n**Note**: this endpoint is limited to plans with multi-agent chat support.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Flabels&method=PATCH&body=%7B%0A%20%20%22name%22%3A%20%22welcome%22%2C%0A%20%20%22color%22%3A%20%22orange%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateLabel","security":[{"apiKey":[]}],"tags":["Labels"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"label","schema":{"type":"object","properties":{"name":{"type":"string","maxLength":30,"minLength":1},"description":{"type":["string","null"],"maxLength":100,"minLength":2},"color":{"type":"string","enum":["ruby","tomato","orange","sunflower","bubble","rose","poppy","rouge","raspberry","purple","lavender","violet","pool","emerald","kelly","apple","turquoise","aqua","gold","latte","cocoa","iron"]}},"required":["name","color"],"additionalProperties":false}}],"responses":{"200":{"description":"Labels updated","schema":{"type":"array"}},"400":{"description":"Invalid or missing body fields","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict - label shortcut already exists","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Update label\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/labels \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"name\":\"welcome\",\"color\":\"orange\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Update label\necho '{\"name\":\"welcome\",\"color\":\"orange\"}' |  \\\n  http PATCH https://api.wassenger.com/v1/devices/{deviceId}/labels \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Update label\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/labels';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"welcome\",\"color\":\"orange\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Update label\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/labels',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {name: 'welcome', color: 'orange'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Update label\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/labels');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  name: 'welcome',\n  color: 'orange'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Update label\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/labels', [\n  'body' => '{\"name\":\"welcome\",\"color\":\"orange\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Update label\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'name' => 'welcome',\n  'color' => 'orange'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/labels');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Update label\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/labels\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'name' => 'welcome',\n    'color' => 'orange'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Update label\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/labels\"\n\npayload = {\n    \"name\": \"welcome\",\n    \"color\": \"orange\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update label\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/labels';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"welcome\",\"color\":\"orange\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update label\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/labels',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"name\":\"welcome\",\"color\":\"orange\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Update label\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/labels\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"name\\\":\\\"welcome\\\",\\\"color\\\":\\\"orange\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Update label\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/labels\"\n\n\tpayload := strings.NewReader(\"{\\\"name\\\":\\\"welcome\\\",\\\"color\\\":\\\"orange\\\"}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Update label\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/labels\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"name\\\":\\\"welcome\\\",\\\"color\\\":\\\"orange\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Update label\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/labels\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"name\\\":\\\"welcome\\\",\\\"color\\\":\\\"orange\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Update label\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/devices/{deviceId}/labels\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"name\\\":\\\"welcome\\\",\\\"color\\\":\\\"orange\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Update label\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"name\\\":\\\"welcome\\\",\\\"color\\\":\\\"orange\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/labels\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Update label\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/labels\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"name\\\":\\\"welcome\\\",\\\"color\\\":\\\"orange\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Update label\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/labels' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"name\":\"welcome\",\"color\":\"orange\"}'"},{"lang":"ObjC","source":"// Update label\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"name\": @\"welcome\",\n                              @\"color\": @\"orange\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/labels\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Update label\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"name\": \"welcome\",\n  \"color\": \"orange\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/labels\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Delete label","description":"Delete one label by name.\n\n\n\nChats/contacts tagged with the deleted label name will be also updated.\n\n\n\n**Important**: only platform created labels can be deleted. Labels created from the WhatsApp Business app should be deleted manually directly from the app.\n\n\n\n**Note**: this endpoint is limited to plans with multi-agent chat support.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Flabels&method=DELETE&body=%7B%0A%20%20%22name%22%3A%20%22sales%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deletelabel","security":[{"apiKey":[]}],"tags":["Labels"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"label","schema":{"type":"object","properties":{"name":{"type":"string","maxLength":30,"minLength":1}},"required":["name"],"additionalProperties":false}}],"responses":{"200":{"description":"Label deleted","schema":{"type":"array"}},"400":{"description":"Invalid or missing body fields","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict - label shortcut already exists","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Delete label\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/labels \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"name\":\"sales\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Delete label\necho '{\"name\":\"sales\"}' |  \\\n  http DELETE https://api.wassenger.com/v1/devices/{deviceId}/labels \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Delete label\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/labels';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"sales\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Delete label\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/labels',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {name: 'sales'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Delete label\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/labels');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  name: 'sales'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Delete label\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/labels', [\n  'body' => '{\"name\":\"sales\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Delete label\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'name' => 'sales'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/labels');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Delete label\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/labels\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'name' => 'sales'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Delete label\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/labels\"\n\npayload = { \"name\": \"sales\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete label\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/labels';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"sales\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete label\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/labels',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"name\":\"sales\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Delete label\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/labels\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"name\\\":\\\"sales\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Delete label\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/labels\"\n\n\tpayload := strings.NewReader(\"{\\\"name\\\":\\\"sales\\\"}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Delete label\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/labels\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"name\\\":\\\"sales\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Delete label\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/labels\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"name\\\":\\\"sales\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Delete label\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/devices/{deviceId}/labels\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"name\\\":\\\"sales\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Delete label\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"name\\\":\\\"sales\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/labels\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Delete label\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/labels\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"name\\\":\\\"sales\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Delete label\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/labels' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"name\":\"sales\"}'"},{"lang":"ObjC","source":"// Delete label\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"name\": @\"sales\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/labels\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Delete label\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"name\": \"sales\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/labels\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/keypass":{"parameters":[],"post":{"summary":"Import keypass session credentials","description":"Ingest extracted WhatsApp session credentials for a number. Authorized via the keypassToken scheme (Authorization header): the resolved token holder must own/scope the device, be permitted to connect it, and it must not already be online.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fkeypass&method=POST&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"importDeviceKeypass","security":[{"keypassToken":[]}],"tags":["Keypass"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"payload","required":true,"schema":{"type":"object","description":"Extracted WhatsApp session credentials blob"}}],"responses":{"202":{"description":"Credentials accepted and stored (pending re-injection)"},"400":{"description":"Missing or invalid token or credentials payload","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Invalid or revoked keypass token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Not allowed to connect this number","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Number is already connected; reset before re-linking","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many keypass attempts","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n"},{"lang":"Node (axios)","source":""},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n"},{"lang":"PHP (curl)","source":""},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n"},{"lang":"Ruby","source":""},{"lang":"Go","source":""},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n"},{"lang":"C","source":""},{"lang":"Powershell","source":""},{"lang":"ObjC","source":""},{"lang":"Swift","source":""}]}},"/devices/{deviceId}/invoices/{invoiceId}/pdf":{"parameters":[],"get":{"summary":"Invoice PDF","description":"Download invoice PDF document by its reference ID\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Finvoices%2F%7BinvoiceId%7D%2Fpdf)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getDeviceInvoicePDF","security":[{"apiKey":[]}],"tags":["Billing"],"responses":{"200":{"description":"Device invoice PDF document"},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not found device or invoice","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Download PDF document\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/invoices/{invoiceId}/pdf \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Download PDF document\nhttp GET https://api.wassenger.com/v1/devices/{deviceId}/invoices/{invoiceId}/pdf \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Download PDF document\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/invoices/{invoiceId}/pdf';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Download PDF document\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/invoices/{invoiceId}/pdf',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Download PDF document\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/invoices/{invoiceId}/pdf');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Download PDF document\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/invoices/{invoiceId}/pdf', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Download PDF document\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/invoices/{invoiceId}/pdf');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Download PDF document\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/invoices/{invoiceId}/pdf\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Download PDF document\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/invoices/{invoiceId}/pdf\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Download PDF document\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/invoices/{invoiceId}/pdf';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Download PDF document\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/invoices/{invoiceId}/pdf',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Download PDF document\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/invoices/{invoiceId}/pdf\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Download PDF document\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/invoices/{invoiceId}/pdf\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Download PDF document\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/invoices/{invoiceId}/pdf\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Download PDF document\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/invoices/{invoiceId}/pdf\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Download PDF document\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/invoices/{invoiceId}/pdf\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Download PDF document\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/invoices/{invoiceId}/pdf\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Download PDF document\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/invoices/{invoiceId}/pdf\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Download PDF document\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/invoices/{invoiceId}/pdf' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Download PDF document\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/invoices/{invoiceId}/pdf\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Download PDF document\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/invoices/{invoiceId}/pdf\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/invoices":{"parameters":[],"get":{"description":"Get device invoices of current and past billing periods.\n\nInvoices can also be viewed as HTML and PDF.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Finvoices)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getDeviceInvoices","security":[{"apiKey":[]}],"tags":["Billing"],"consumes":["application/json"],"parameters":[{"name":"all","in":"query","type":"boolean","default":false},{"name":"limit","in":"query","type":"number","minimum":1,"maximum":100,"default":20}],"responses":{"200":{"description":"Device invoices","schema":{"type":"array"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"summary":"List invoices","x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get device invoices\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/invoices \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get device invoices\nhttp GET https://api.wassenger.com/v1/devices/{deviceId}/invoices \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get device invoices\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/invoices';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get device invoices\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/invoices',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get device invoices\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/invoices');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get device invoices\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/invoices', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get device invoices\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/invoices');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get device invoices\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/invoices\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get device invoices\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/invoices\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get device invoices\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/invoices';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get device invoices\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/invoices',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get device invoices\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/invoices\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get device invoices\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/invoices\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get device invoices\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/invoices\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get device invoices\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/invoices\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get device invoices\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/invoices\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get device invoices\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/invoices\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get device invoices\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/invoices\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get device invoices\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/invoices' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get device invoices\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/invoices\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get device invoices\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/invoices\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/health":{"parameters":[],"get":{"summary":"Session health","description":"Returns current device's session health status with further relevant information about the session, queue status and more.\n\n\n\nPossible session status are:\n\n\n\n- **online** - Session is online and operative.\n\n- **conflict** - Session has a conflict due to multiple WhatsApp Web sessions open at the same time. Closing one session will be needed.\n\n- **error** - Session failed multiple times and cannot operate normaly. Please contact support.\n\n- **timeout** - Session has persistent network timeout, usually because the device lost the connection to Internet.\n\n- **timeout_sync** - Session cannot sync due to device connectivity network issues or many open chats (+1000) that require much time.\n\n- **offline** - Session is offline and cannot be reached via network. This is typically an operational issue.\n\n- **authorize** - Session requires manual authorization by scanning the QR image in order to be operative.\n\n- **authorizing** - Session is authorizing and linking the number. This status is trasitorial to the `online` status.\n\n- **blocked** - Session is temporarely blocked due to an unexpected issue. Please contact support.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fhealth)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deviceHealth","security":[{"apiKey":[]}],"tags":["Session"],"produces":["application/json"],"parameters":[],"responses":{"200":{"description":"Device model","schema":{"type":"object","properties":{"ok":{"type":"boolean"},"status":{"type":"string","enum":["online","offline","timeout","timeout_sync","conflict","blocked","error","authorize","authorizing"]},"subscription":{"type":"string","description":"Number subscription plan status","enum":["active","disabled","cancelled","unpaid","past_due","trialing"]},"operative":{"type":"boolean","default":true,"description":"`true` if the device session is currently or can be operative within allowed week days/hours based on the operative hours settings, optionally defined by the user. By default a device will be operative under a 24/7 policy. The user can adjust the operative hours to fit, for example, common working hours. During non-operative days/hours, the device will not be able to send/receive messages unless explicitly forced to start."},"uptime":{"type":"integer","format":"int32","description":"WhatsApp session uptime"},"lastSyncAt":{"type":"string","format":"datetime","description":"Most recent date when the WhatsApp session was synced and the session status was updated"},"lastOnlineAt":{"type":"string","format":"datetime","description":"Most recent date when the WhatsApp session was reported as online"},"lastSyncSeconds":{"type":"integer","format":"int32","description":"Seconds elapsed from the last session synchronization"},"synced":{"type":"boolean","description":"Provides whether the session is currently synced (`true`) or not (`false`)"},"queue":{"type":"object","properties":{"status":{"type":"string","description":"Messages queue processing status"},"statusUpdatedAt":{"type":"string","format":"date-time","description":"Queue status lastest update as ISO date format"},"total":{"type":"number","description":"Total queue messages capacity for the device"},"size":{"type":"number","description":"Messages currently stored in the queue"},"available":{"type":"number","description":"Currently available messages free slots in the queue"}}}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get device health status\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/health \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get device health status\nhttp GET https://api.wassenger.com/v1/devices/{deviceId}/health \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get device health status\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/health';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get device health status\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/health',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get device health status\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/health');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get device health status\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/health', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get device health status\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/health');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get device health status\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/health\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get device health status\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/health\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get device health status\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/health';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get device health status\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/health',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get device health status\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/health\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get device health status\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/health\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get device health status\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/health\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get device health status\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/health\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get device health status\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/health\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get device health status\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/health\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get device health status\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/health\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get device health status\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/health' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get device health status\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/health\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get device health status\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/health\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/groups/{groupId}/participants":{"parameters":[],"post":{"summary":"Add participants","description":"Add new participants to a specific group by WhatsApp ID.\n\n\n\nIn order to prevent processing issues or errors, it is not recommended adding more than 10 participants at a time per API request.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fgroups%2F%7BgroupId%7D%2Fparticipants&method=POST&body=%7B%0A%20%20%22participants%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22phone%22%3A%20%22%2B1234567890%22%2C%0A%20%20%20%20%20%20%22admin%22%3A%20false%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22phone%22%3A%20%22%2B1234567890%22%2C%0A%20%20%20%20%20%20%22admin%22%3A%20true%0A%20%20%20%20%7D%0A%20%20%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"addGroupParticipants","security":[{"apiKey":[]}],"tags":["Groups"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"participants","description":"Add list of participants to add","schema":{"type":"object","properties":{"participants":{"type":"array","items":{"type":"object","properties":{"phone":{"type":"string","minLength":8,"maxLength":16},"admin":{"type":"boolean","default":false}},"required":["phone"],"additionalProperties":false},"minItems":1,"maxItems":256,"description":"Group participants by phone number."}},"required":["participants"],"additionalProperties":false}}],"responses":{"200":{"description":"Participants added","schema":{"type":"object","properties":{"message":{"type":"string","description":"Success message"}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Forbidden operation or feature not supported in current plan, or the operation was rejected by a temporary WhatsApp account restriction (`errorCode: account:restricted`, see `meta.reason` and `meta.expiresAt`)","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not found group or device","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Add participants\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"participants\":[{\"phone\":\"+1234567890\",\"admin\":false},{\"phone\":\"+1234567890\",\"admin\":true}]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Add participants\necho '{\"participants\":[{\"phone\":\"+1234567890\",\"admin\":false},{\"phone\":\"+1234567890\",\"admin\":true}]}' |  \\\n  http POST https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Add participants\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"participants\":[{\"phone\":\"+1234567890\",\"admin\":false},{\"phone\":\"+1234567890\",\"admin\":true}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Add participants\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    participants: [{phone: '+1234567890', admin: false}, {phone: '+1234567890', admin: true}]\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Add participants\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  participants: [\n    {\n      phone: '+1234567890',\n      admin: false\n    },\n    {\n      phone: '+1234567890',\n      admin: true\n    }\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Add participants\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants', [\n  'body' => '{\"participants\":[{\"phone\":\"+1234567890\",\"admin\":false},{\"phone\":\"+1234567890\",\"admin\":true}]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Add participants\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'participants' => [\n    [\n        'phone' => '+1234567890',\n        'admin' => null\n    ],\n    [\n        'phone' => '+1234567890',\n        'admin' => null\n    ]\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Add participants\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'participants' => [\n        [\n                'phone' => '+1234567890',\n                'admin' => null\n        ],\n        [\n                'phone' => '+1234567890',\n                'admin' => null\n        ]\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Add participants\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\"\n\npayload = { \"participants\": [\n        {\n            \"phone\": \"+1234567890\",\n            \"admin\": False\n        },\n        {\n            \"phone\": \"+1234567890\",\n            \"admin\": True\n        }\n    ] }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Add participants\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"participants\":[{\"phone\":\"+1234567890\",\"admin\":false},{\"phone\":\"+1234567890\",\"admin\":true}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Add participants\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"participants\":[{\"phone\":\"+1234567890\",\"admin\":false},{\"phone\":\"+1234567890\",\"admin\":true}]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Add participants\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"participants\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":false},{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":true}]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Add participants\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\"\n\n\tpayload := strings.NewReader(\"{\\\"participants\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":false},{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":true}]}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Add participants\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"participants\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":false},{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":true}]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Add participants\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"participants\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":false},{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":true}]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Add participants\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"participants\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":false},{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":true}]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Add participants\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"participants\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":false},{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":true}]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Add participants\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"participants\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":false},{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":true}]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Add participants\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"participants\":[{\"phone\":\"+1234567890\",\"admin\":false},{\"phone\":\"+1234567890\",\"admin\":true}]}'"},{"lang":"ObjC","source":"// Add participants\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"participants\": @[ @{ @\"phone\": @\"+1234567890\", @\"admin\": @NO }, @{ @\"phone\": @\"+1234567890\", @\"admin\": @YES } ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Add participants\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"participants\": [\n    [\n      \"phone\": \"+1234567890\",\n      \"admin\": false\n    ],\n    [\n      \"phone\": \"+1234567890\",\n      \"admin\": true\n    ]\n  ]] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Promote/demote participants","description":"Promote or demote participants as admin or member in a specific group by WhatsApp ID.\n\n\n\nIn order to prevent processing issues, it is not recommended updating more than 10 participants at a time per API request.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fgroups%2F%7BgroupId%7D%2Fparticipants&method=PATCH&body=%7B%0A%20%20%22participants%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22phone%22%3A%20%22%2B1234567890%22%2C%0A%20%20%20%20%20%20%22admin%22%3A%20false%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22phone%22%3A%20%22%2B1234567890%22%2C%0A%20%20%20%20%20%20%22admin%22%3A%20true%0A%20%20%20%20%7D%0A%20%20%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateParticipantsPermissions","security":[{"apiKey":[]}],"tags":["Groups"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"participants","description":"Promote or demote participants","schema":{"type":"object","properties":{"participants":{"type":"array","items":{"type":"object","properties":{"phone":{"type":"string","minLength":8,"maxLength":16},"admin":{"type":"boolean","default":false}},"required":["phone"],"additionalProperties":false},"minItems":1,"maxItems":256,"description":"Group participants by phone number."}},"required":["participants"],"additionalProperties":false}}],"responses":{"200":{"description":"Participants permissions updated","schema":{"type":"object"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required group permissions or feature not supported in current plan, or the operation was rejected by a temporary WhatsApp account restriction (`errorCode: account:restricted`, see `meta.reason` and `meta.expiresAt`)","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not found group or device","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Promote and demote participants\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"participants\":[{\"phone\":\"+1234567890\",\"admin\":false},{\"phone\":\"+1234567890\",\"admin\":true}]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Promote and demote participants\necho '{\"participants\":[{\"phone\":\"+1234567890\",\"admin\":false},{\"phone\":\"+1234567890\",\"admin\":true}]}' |  \\\n  http PATCH https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Promote and demote participants\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"participants\":[{\"phone\":\"+1234567890\",\"admin\":false},{\"phone\":\"+1234567890\",\"admin\":true}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Promote and demote participants\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    participants: [{phone: '+1234567890', admin: false}, {phone: '+1234567890', admin: true}]\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Promote and demote participants\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  participants: [\n    {\n      phone: '+1234567890',\n      admin: false\n    },\n    {\n      phone: '+1234567890',\n      admin: true\n    }\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Promote and demote participants\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants', [\n  'body' => '{\"participants\":[{\"phone\":\"+1234567890\",\"admin\":false},{\"phone\":\"+1234567890\",\"admin\":true}]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Promote and demote participants\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'participants' => [\n    [\n        'phone' => '+1234567890',\n        'admin' => null\n    ],\n    [\n        'phone' => '+1234567890',\n        'admin' => null\n    ]\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Promote and demote participants\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'participants' => [\n        [\n                'phone' => '+1234567890',\n                'admin' => null\n        ],\n        [\n                'phone' => '+1234567890',\n                'admin' => null\n        ]\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Promote and demote participants\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\"\n\npayload = { \"participants\": [\n        {\n            \"phone\": \"+1234567890\",\n            \"admin\": False\n        },\n        {\n            \"phone\": \"+1234567890\",\n            \"admin\": True\n        }\n    ] }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Promote and demote participants\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"participants\":[{\"phone\":\"+1234567890\",\"admin\":false},{\"phone\":\"+1234567890\",\"admin\":true}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Promote and demote participants\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"participants\":[{\"phone\":\"+1234567890\",\"admin\":false},{\"phone\":\"+1234567890\",\"admin\":true}]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Promote and demote participants\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"participants\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":false},{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":true}]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Promote and demote participants\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\"\n\n\tpayload := strings.NewReader(\"{\\\"participants\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":false},{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":true}]}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Promote and demote participants\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"participants\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":false},{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":true}]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Promote and demote participants\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"participants\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":false},{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":true}]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Promote and demote participants\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"participants\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":false},{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":true}]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Promote and demote participants\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"participants\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":false},{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":true}]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Promote and demote participants\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"participants\\\":[{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":false},{\\\"phone\\\":\\\"+1234567890\\\",\\\"admin\\\":true}]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Promote and demote participants\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"participants\":[{\"phone\":\"+1234567890\",\"admin\":false},{\"phone\":\"+1234567890\",\"admin\":true}]}'"},{"lang":"ObjC","source":"// Promote and demote participants\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"participants\": @[ @{ @\"phone\": @\"+1234567890\", @\"admin\": @NO }, @{ @\"phone\": @\"+1234567890\", @\"admin\": @YES } ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Promote and demote participants\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"participants\": [\n    [\n      \"phone\": \"+1234567890\",\n      \"admin\": false\n    ],\n    [\n      \"phone\": \"+1234567890\",\n      \"admin\": true\n    ]\n  ]] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Remove participants","description":"Remove participants from a specific group by WhatsApp ID.\n\n\n\nIn order to prevent processing issues, it is not recommended removing more than 10 participants at a time per API request.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fgroups%2F%7BgroupId%7D%2Fparticipants&method=DELETE&body=%5B%0A%20%20%22%2B1234567890%22%2C%0A%20%20%22%2B1234567890%22%0A%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"removeGroupParticipants","security":[{"apiKey":[]}],"tags":["Groups"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"participants","description":"List of participants' phone numbers to remove","schema":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":1,"maxItems":256,"description":"List of participants phone numbers with international prefix in E164 format. Example: +12345767890"}}],"responses":{"200":{"description":"Participants removed","schema":{"type":"object","properties":{"message":{"type":"string","description":"Success message"}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Mising required group permissions or feature not supported in current plan, or the operation was rejected by a temporary WhatsApp account restriction (`errorCode: account:restricted`, see `meta.reason` and `meta.expiresAt`)","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not found group or device","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Remove participants\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '[\"+1234567890\",\"+1234567890\"]'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Remove participants\necho '[\"+1234567890\",\"+1234567890\"]' |  \\\n  http DELETE https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Remove participants\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[\"+1234567890\",\"+1234567890\"]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Remove participants\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: ['+1234567890', '+1234567890']\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Remove participants\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send([\n  '+1234567890',\n  '+1234567890'\n]);\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Remove participants\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants', [\n  'body' => '[\"+1234567890\",\"+1234567890\"]',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Remove participants\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  '+1234567890',\n  '+1234567890'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Remove participants\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    '+1234567890',\n    '+1234567890'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Remove participants\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\"\n\npayload = [\"+1234567890\", \"+1234567890\"]\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Remove participants\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[\"+1234567890\",\"+1234567890\"]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Remove participants\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '[\"+1234567890\",\"+1234567890\"]'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Remove participants\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"[\\\"+1234567890\\\",\\\"+1234567890\\\"]\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Remove participants\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\"\n\n\tpayload := strings.NewReader(\"[\\\"+1234567890\\\",\\\"+1234567890\\\"]\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Remove participants\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"[\\\"+1234567890\\\",\\\"+1234567890\\\"]\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Remove participants\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"[\\\"+1234567890\\\",\\\"+1234567890\\\"]\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Remove participants\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"[\\\"+1234567890\\\",\\\"+1234567890\\\"]\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Remove participants\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"[\\\"+1234567890\\\",\\\"+1234567890\\\"]\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Remove participants\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"[\\\"+1234567890\\\",\\\"+1234567890\\\"]\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Remove participants\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '[\"+1234567890\",\"+1234567890\"]'"},{"lang":"ObjC","source":"// Remove participants\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @[ @\"+1234567890\",\n                              @\"+1234567890\" ];\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Remove participants\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"+1234567890\", \"+1234567890\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/groups/{groupId}/members":{"parameters":[],"get":{"summary":"Get pending group members","description":"Returns a list of pending members for approval or rejection in the specific group chat.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fgroups%2F%7BgroupId%7D%2Fmembers)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getGroupPendingMembers","security":[{"apiKey":[]}],"tags":["Groups"],"produces":["application/json"],"parameters":[],"responses":{"200":{"description":" group","schema":{"type":"array","items":{"type":"object","properties":{"wid":{"type":"string"},"phone":{"type":"string"},"name":{"type":"string"},"timestamp":{"type":"integer"},"date":{"type":"string","format":"date-time"},"method":{"type":"string"},"invitedBy":{"type":"string"},"community":{"type":"string"},"contact":{"type":"object","properties":{"isChatActive":{"type":"boolean"},"isContact":{"type":"boolean"},"isBlocked":{"type":"boolean"},"isBusiness":{"type":"boolean"}}}}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not found group or number","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get approval pending members\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get approval pending members\nhttp GET https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get approval pending members\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get approval pending members\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get approval pending members\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get approval pending members\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get approval pending members\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get approval pending members\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get approval pending members\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get approval pending members\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get approval pending members\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get approval pending members\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get approval pending members\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get approval pending members\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get approval pending members\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get approval pending members\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get approval pending members\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get approval pending members\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get approval pending members\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get approval pending members\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get approval pending members\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"post":{"summary":"Approve group member","description":"Approve one or multiple members from joining the group chat.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fgroups%2F%7BgroupId%7D%2Fmembers&method=POST&body=%7B%0A%20%20%22phones%22%3A%20%5B%0A%20%20%20%20%22%2B1234567890%22%0A%20%20%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"approveGroupMembers","security":[{"apiKey":[]}],"tags":["Groups"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"approve","description":"Phone numbers of the members to approve","required":true,"schema":{"type":"object","properties":{"all":{"type":"boolean","description":"Approve all pending group members requests. If set to `true`, the `phones` field will be ignored.","default":false},"phones":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":1,"maxItems":256,"description":"List of members phone numbers to approve with international prefix in E164 format. Example: `+12345767890`"}},"required":["phones"],"additionalProperties":false}}],"responses":{"200":{"description":"Group members approved","schema":{"type":"array","items":{"type":"object","properties":{"wid":{"type":"string","description":"WhatsApp ID of the approved member"},"phone":{"type":"string","description":"Phone number of the approved member"},"approved":{"type":"boolean","description":"True if member was approved"},"error":{"type":"string","description":"Optional error message"},"message":{"type":"string","description":"Optional result message"}}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not found group or device","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Approve members by phone number\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"phones\":[\"+1234567890\"]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Approve members by phone number\necho '{\"phones\":[\"+1234567890\"]}' |  \\\n  http POST https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Approve members by phone number\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phones\":[\"+1234567890\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Approve members by phone number\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {phones: ['+1234567890']}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Approve members by phone number\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  phones: [\n    '+1234567890'\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Approve members by phone number\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members', [\n  'body' => '{\"phones\":[\"+1234567890\"]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Approve members by phone number\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'phones' => [\n    '+1234567890'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Approve members by phone number\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'phones' => [\n        '+1234567890'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Approve members by phone number\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\"\n\npayload = { \"phones\": [\"+1234567890\"] }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Approve members by phone number\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phones\":[\"+1234567890\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Approve members by phone number\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"phones\":[\"+1234567890\"]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Approve members by phone number\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"phones\\\":[\\\"+1234567890\\\"]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Approve members by phone number\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\"\n\n\tpayload := strings.NewReader(\"{\\\"phones\\\":[\\\"+1234567890\\\"]}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Approve members by phone number\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"phones\\\":[\\\"+1234567890\\\"]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Approve members by phone number\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"phones\\\":[\\\"+1234567890\\\"]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Approve members by phone number\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"phones\\\":[\\\"+1234567890\\\"]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Approve members by phone number\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"phones\\\":[\\\"+1234567890\\\"]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Approve members by phone number\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"phones\\\":[\\\"+1234567890\\\"]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Approve members by phone number\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"phones\":[\"+1234567890\"]}'"},{"lang":"ObjC","source":"// Approve members by phone number\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"phones\": @[ @\"+1234567890\" ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Approve members by phone number\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"phones\": [\"+1234567890\"]] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Reject group member","description":"Reject one or multiple members from joining the group chat.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fgroups%2F%7BgroupId%7D%2Fmembers&method=DELETE&body=%7B%0A%20%20%22phones%22%3A%20%5B%0A%20%20%20%20%22%2B1234567890%22%0A%20%20%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"rejectGroupMembers","security":[{"apiKey":[]}],"tags":["Groups"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"reject","description":"Phone numbers of the members to reject","required":true,"schema":{"type":"object","properties":{"all":{"type":"boolean","description":"Reject all pending group members requests. If set to `true`, the `phones` field will be ignored.","default":false},"phones":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":1,"maxItems":256,"description":"List of members phone numbers to reject with international prefix in E164 format. Example: `+12345767890`"}},"required":["phones"],"additionalProperties":false}}],"responses":{"200":{"description":"Group members rejected","schema":{"type":"array","items":{"type":"object","properties":{"wid":{"type":"string","description":"WhatsApp ID of the rejected member"},"phone":{"type":"string","description":"Phone number of the rejected member"},"rejected":{"type":"boolean","description":"True if member was rejected"},"error":{"type":"string","description":"Optional error message"},"message":{"type":"string","description":"Optional result message"}}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not found group or device","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Reject member approval by phone number\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"phones\":[\"+1234567890\"]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Reject member approval by phone number\necho '{\"phones\":[\"+1234567890\"]}' |  \\\n  http DELETE https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Reject member approval by phone number\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phones\":[\"+1234567890\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Reject member approval by phone number\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {phones: ['+1234567890']}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Reject member approval by phone number\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  phones: [\n    '+1234567890'\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Reject member approval by phone number\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members', [\n  'body' => '{\"phones\":[\"+1234567890\"]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Reject member approval by phone number\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'phones' => [\n    '+1234567890'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Reject member approval by phone number\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'phones' => [\n        '+1234567890'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Reject member approval by phone number\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\"\n\npayload = { \"phones\": [\"+1234567890\"] }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Reject member approval by phone number\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phones\":[\"+1234567890\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Reject member approval by phone number\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"phones\":[\"+1234567890\"]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Reject member approval by phone number\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"phones\\\":[\\\"+1234567890\\\"]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Reject member approval by phone number\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\"\n\n\tpayload := strings.NewReader(\"{\\\"phones\\\":[\\\"+1234567890\\\"]}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Reject member approval by phone number\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"phones\\\":[\\\"+1234567890\\\"]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Reject member approval by phone number\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"phones\\\":[\\\"+1234567890\\\"]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Reject member approval by phone number\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"phones\\\":[\\\"+1234567890\\\"]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Reject member approval by phone number\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"phones\\\":[\\\"+1234567890\\\"]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Reject member approval by phone number\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"phones\\\":[\\\"+1234567890\\\"]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Reject member approval by phone number\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"phones\":[\"+1234567890\"]}'"},{"lang":"ObjC","source":"// Reject member approval by phone number\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"phones\": @[ @\"+1234567890\" ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Reject member approval by phone number\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"phones\": [\"+1234567890\"]] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/members\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/groups/{groupId}/invite":{"parameters":[],"get":{"summary":"Get group invite code","description":"Get group invite code and URL to share with new participants.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fgroups%2F%7BgroupId%7D%2Finvite)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getGroupInviteCode","security":[{"apiKey":[]}],"tags":["Groups"],"produces":["application/json"],"parameters":[],"responses":{"200":{"description":" group","schema":{"type":"object","properties":{"code":{"type":"string","description":"Group invite code"},"url":{"type":"string","description":"Group invite URL to share with new participants"}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Mising required group permissions or feature not supported in current plan","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not found group or device","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get invite code\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get invite code\nhttp GET https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get invite code\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get invite code\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get invite code\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get invite code\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get invite code\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get invite code\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get invite code\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get invite code\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get invite code\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get invite code\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get invite code\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get invite code\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get invite code\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get invite code\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get invite code\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get invite code\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get invite code\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get invite code\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get invite code\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Revoke group invite","description":"Revoke group invite code\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fgroups%2F%7BgroupId%7D%2Finvite&method=DELETE&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"revokeGroupInvite","security":[{"apiKey":[]}],"tags":["Groups"],"produces":["application/json"],"parameters":[],"responses":{"200":{"description":"Revoke group invitation code","schema":{"type":"object","properties":{"message":{"type":"string","description":"Successful revocation message"}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Mising required group permissions or feature not supported in current plan","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not found group or device","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Remove participants\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Remove participants\nhttp DELETE https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Remove participants\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Remove participants\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Remove participants\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Remove participants\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Remove participants\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite');\n$request->setRequestMethod('DELETE');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Remove participants\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Remove participants\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.delete(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Remove participants\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Remove participants\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite',\n  method: 'DELETE',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Remove participants\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Remove participants\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Remove participants\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Remove participants\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Remove participants\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Remove participants\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite\")\n  .delete(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Remove participants\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Remove participants\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite' -Method DELETE -Headers $headers"},{"lang":"ObjC","source":"// Remove participants\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Remove participants\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/invite\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/groups/{groupId}/image":{"parameters":[],"put":{"summary":"Set group image","description":"Update group chat profile image. Image must be JPEG or PNG format, up to 1MB. The minimum allowed image size is 192x192 pixels. The device must be authorized and online, otherwise the API call will return an error. This endpoints accepts JSON or raw binary post bodies (application/octet-stream, image/*). For JSON bodies, you can define the image via remote URL (see \"url\" body field) or via data URI Base64 string (see \"image\" field) ","operationId":"groupUpdateImage","security":[{"apiKey":[]}],"tags":["Groups"],"consumes":["image/jpeg","image/png","application/octet-stream","application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"image","description":"Image to update in JPEG or PNG format. Maximum 1MB. Minimum resolution is 192x192. Image can be uploaded via remote URL (JSON), data URI base64 (JSON) or binary raw content (application/octet-stream).","schema":{"type":"object","properties":{"url":{"type":"string","minLength":6,"maxLength":2000,"description":"URL of the image to download. It must be `http` or `https` valid URL pointing to a server accessible from the Internet."},"image":{"type":"string","maxLength":1300000,"description":"Image content as Data URI Base64 encoded string. See [data URI schema](https://en.wikipedia.org/wiki/Data_URI_scheme) for more information."}},"additionalProperties":false}}],"responses":{"200":{"description":"Image updated successfully","schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Field will be `true` if the operation succeed, otherwise `false`"},"image":{"type":"string","description":"New uploaded image public URL provided by WhatsApp"}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing permissions or API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Update WhatsApp account profile avatar image\ncurl --request PUT \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/profile/image \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"url\":\"https://via.placeholder.com/280\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Update WhatsApp account profile avatar image\necho '{\"url\":\"https://via.placeholder.com/280\"}' |  \\\n  http PUT https://api.wassenger.com/v1/devices/{deviceId}/profile/image \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Update WhatsApp account profile avatar image\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image';\nconst options = {\n  method: 'PUT',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"url\":\"https://via.placeholder.com/280\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Update WhatsApp account profile avatar image\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PUT',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {url: 'https://via.placeholder.com/280'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Update WhatsApp account profile avatar image\nconst unirest = require('unirest');\n\nconst req = unirest('PUT', 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  url: 'https://via.placeholder.com/280'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Update WhatsApp account profile avatar image\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PUT', 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image', [\n  'body' => '{\"url\":\"https://via.placeholder.com/280\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Update WhatsApp account profile avatar image\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'url' => 'https://via.placeholder.com/280'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/profile/image');\n$request->setRequestMethod('PUT');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Update WhatsApp account profile avatar image\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PUT\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'url' => 'https://via.placeholder.com/280'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Update WhatsApp account profile avatar image\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\"\n\npayload = { \"url\": \"https://via.placeholder.com/280\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.put(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update WhatsApp account profile avatar image\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image';\nconst options = {\n  method: 'PUT',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"url\":\"https://via.placeholder.com/280\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update WhatsApp account profile avatar image\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image',\n  method: 'PUT',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"url\":\"https://via.placeholder.com/280\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Update WhatsApp account profile avatar image\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Put.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"url\\\":\\\"https://via.placeholder.com/280\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Update WhatsApp account profile avatar image\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\"\n\n\tpayload := strings.NewReader(\"{\\\"url\\\":\\\"https://via.placeholder.com/280\\\"}\")\n\n\treq, _ := http.NewRequest(\"PUT\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Update WhatsApp account profile avatar image\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\");\nvar request = new RestRequest(Method.PUT);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"url\\\":\\\"https://via.placeholder.com/280\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Update WhatsApp account profile avatar image\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Put,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"url\\\":\\\"https://via.placeholder.com/280\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Update WhatsApp account profile avatar image\nHttpResponse<String> response = Unirest.put(\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"url\\\":\\\"https://via.placeholder.com/280\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Update WhatsApp account profile avatar image\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"url\\\":\\\"https://via.placeholder.com/280\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\")\n  .put(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Update WhatsApp account profile avatar image\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PUT\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"url\\\":\\\"https://via.placeholder.com/280\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Update WhatsApp account profile avatar image\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{\"url\":\"https://via.placeholder.com/280\"}'"},{"lang":"ObjC","source":"// Update WhatsApp account profile avatar image\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"url\": @\"https://via.placeholder.com/280\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PUT\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Update WhatsApp account profile avatar image\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"url\": \"https://via.placeholder.com/280\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PUT\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}],"x-meta":{"method":"PUT","path":"/devices/{deviceId}/groups/{groupId}/image","samples":[{"comment":"Update group chat profile image"}]}}},"/devices/{deviceId}/groups/{groupId}":{"parameters":[],"get":{"summary":"Get group by ID","description":"Get group information and participants by WhatsApp group ID (e.g: `1234567890-1500000000`, `1234567890-1500000000@g.us`, `120000000000000000@g.us`, `1610000000@broadcast`)\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fgroups%2F%7BgroupId%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getGroupById","security":[{"apiKey":[]}],"tags":["Groups"],"produces":["application/json"],"parameters":[{"in":"query","name":"refresh","type":"boolean","default":false,"description":"If `true`, fetches the group metadata live from WhatsApp instead of the cached copy. Falls back to the cached group if the live fetch fails (e.g: device offline)."}],"responses":{"200":{"description":"Group chat","schema":{"$ref":"#/definitions/chatGroup"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Forbidden operation","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not found group or device","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get group by ID\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get group by ID\nhttp GET https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get group by ID\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get group by ID\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get group by ID\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get group by ID\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get group by ID\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get group by ID\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get group by ID\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get group by ID\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get group by ID\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get group by ID\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get group by ID\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get group by ID\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get group by ID\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get group by ID\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get group by ID\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get group by ID\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get group by ID\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get group by ID\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get group by ID\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Update group","description":"Update group name, description and/or publication/edit permissions for existing participants. You should pass the WhatsApp group ID in the URL path (e.g: `1234567890-1500000000@g.us` or `120000000000000000@g.us`).\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fgroups%2F%7BgroupId%7D&method=PATCH&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateGroup","security":[{"apiKey":[]}],"tags":["Groups"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"group","description":"New group data","schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"New group name"},"description":{"type":"string","minLength":1,"maxLength":500,"description":"New group description"},"permissions":{"type":"object","properties":{"edit":{"type":"string","enum":["all","admins"],"description":"Group settings change permissions."},"send":{"type":"string","enum":["all","admins"],"description":"Group message publication permissions."},"invite":{"type":"string","enum":["all","admins"],"description":"Group invite new participants permissions. Default to `all`."},"inviteLink":{"type":"string","enum":["all","admins"],"description":"Who may share this group invite link. Defaults to `all`."},"history":{"type":"string","enum":["all","admins"],"description":"Who may send previous group messages to newly added members. Defaults to `admins`."},"approval":{"type":"boolean","description":"Group new participant approval required by administrators"},"inviteSharing":{"type":"boolean","description":"Enable WhatsApp Advanced Chat Privacy, which limits sharing this group content outside the chat. Defaults to `false`. This does NOT control the invite link, see `inviteLink`."},"subgroups":{"type":"boolean","description":"Allow non-admin participants to create sub-groups within the group. Defaults to `false`"}},"additionalProperties":false,"description":"Group message publication and edit permissions for the group participants"},"ephemeral":{"type":"string","enum":["off","24h","7d","90d"],"description":"Enable automatically deleted ephemeral messages. Disabled by default."}},"additionalProperties":false}}],"responses":{"200":{"description":"Group updated","schema":{"$ref":"#/definitions/chatGroup"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required group permissions, or the operation was rejected by a temporary WhatsApp account restriction (`errorCode: account:restricted`, see `meta.reason` and `meta.expiresAt`)","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Update group information/permissions\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Update group information/permissions\nhttp PATCH https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Update group information/permissions\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}';\nconst options = {method: 'PATCH', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Update group information/permissions\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Update group information/permissions\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Update group information/permissions\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Update group information/permissions\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}');\n$request->setRequestMethod('PATCH');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Update group information/permissions\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Update group information/permissions\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.patch(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update group information/permissions\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}';\nconst options = {method: 'PATCH', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update group information/permissions\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}',\n  method: 'PATCH',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Update group information/permissions\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Update group information/permissions\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}\"\n\n\treq, _ := http.NewRequest(\"PATCH\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Update group information/permissions\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Update group information/permissions\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Update group information/permissions\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Update group information/permissions\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}\")\n  .patch(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Update group information/permissions\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Update group information/permissions\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}' -Method PATCH -Headers $headers"},{"lang":"ObjC","source":"// Update group information/permissions\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Update group information/permissions\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/groups":{"parameters":[],"get":{"summary":"Group chats","description":"Get device group chats and broadcast lists where the WhastApp account is member of.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fgroups)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getDeviceGroupChats","security":[{"apiKey":[]}],"tags":["Groups"],"parameters":[{"in":"query","name":"kind","type":"array","collectionFormat":"csv","description":"Filter groups by kind. Defaults to `any`","maxLength":3,"default":"any","items":{"type":"string","enum":["any","group","community","broadcast","channel"]}},{"in":"query","name":"page","description":"Results page number (starting from 0)","type":"number","format":"integer","default":0,"minimum":0,"maximum":500},{"in":"query","name":"size","description":"Results page size","type":"number","format":"integer","default":100,"minimum":1,"maximum":500}],"responses":{"200":{"description":"Group chats","schema":{"type":"array","items":{"$ref":"#/definitions/chatGroup"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get group chats\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/groups \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get group chats\nhttp GET https://api.wassenger.com/v1/devices/{deviceId}/groups \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get group chats\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get group chats\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get group chats\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/groups');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get group chats\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/groups', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get group chats\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/groups');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get group chats\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/groups\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get group chats\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/groups\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get group chats\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get group chats\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get group chats\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/groups\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get group chats\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/groups\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get group chats\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/groups\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get group chats\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/groups\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get group chats\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/groups\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get group chats\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/groups\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get group chats\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/groups\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get group chats\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/groups' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get group chats\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/groups\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get group chats\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/groups\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"post":{"summary":"Create group","description":"Create group chat with a name and participants, optionally with a description and publish permissions.\n\n\n\n> **Important**: creating groups is potentially a slow process that might fail if certain number conditions are not met, such as when your WhatsApp number already has hundreds of group chats or thousands of active chats. In order to minimize potential issues, it is recommended creating a group only with one or two participants, and once the group is created successfully, you can later add the additional participants in groups by 10 participants per request using the [Add participants API endpoint](#operation/addGroupParticipants).\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fgroups&method=POST&body=%7B%0A%20%20%22name%22%3A%20%22Sample%20Group%22%2C%0A%20%20%22participants%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22phone%22%3A%20%22%2B1234567890%22%0A%20%20%20%20%7D%0A%20%20%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"createGroup","security":[{"apiKey":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"group","description":"Group data to create. Group name and one participant is required.","schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"Group name"},"description":{"type":"string","minLength":1,"maxLength":500,"description":"Group description up to 500 characters"},"permissions":{"type":"object","properties":{"edit":{"type":"string","enum":["all","admins"],"description":"Group settings edit permissions. Default to `all`.","default":"all"},"send":{"type":"string","enum":["all","admins"],"description":"Group message publication permissions. Default to `all`.","default":"all"},"invite":{"type":"string","enum":["all","admins"],"description":"Group invite new participants permissions. Default to `all`.","default":"all"},"inviteLink":{"type":"string","enum":["all","admins"],"description":"Who may share this group invite link. Defaults to `all`."},"history":{"type":"string","enum":["all","admins"],"description":"Who may send previous group messages to newly added members. Defaults to `admins`."},"approval":{"type":"boolean","description":"Group new participant approval required by administrators","default":false},"inviteSharing":{"type":"boolean","description":"Enable WhatsApp Advanced Chat Privacy, which limits sharing this group content outside the chat. Defaults to `false`. This does NOT control the invite link, see `inviteLink`."},"subgroups":{"type":"boolean","description":"Allow non-admin participants to create sub-groups within the group. Defaults to `false`"}},"additionalProperties":false,"description":"Group message publication and edit permissions for the group participants"},"ephemeral":{"type":"string","enum":["off","24h","7d","90d"],"description":"Enable automatically deleted ephemeral messages. Disabled by default."},"participants":{"type":"array","items":{"type":"object","properties":{"phone":{"type":"string","minLength":8,"maxLength":16},"admin":{"type":"boolean","default":false}},"required":["phone"],"additionalProperties":false},"minItems":1,"maxItems":256,"description":"Group participants by phone number. At least one participant is required."}},"required":["name","participants"],"additionalProperties":false}}],"tags":["Groups"],"responses":{"200":{"description":"Group created","schema":{"$ref":"#/definitions/chatGroup"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unsupported operation - plan upgrade required, or the operation was rejected by a temporary WhatsApp account restriction (`errorCode: account:restricted`, see `meta.reason` and `meta.expiresAt`)","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Group already exists with the same name","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Create new group\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/groups \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"name\":\"Sample Group\",\"participants\":[{\"phone\":\"+1234567890\"}]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Create new group\necho '{\"name\":\"Sample Group\",\"participants\":[{\"phone\":\"+1234567890\"}]}' |  \\\n  http POST https://api.wassenger.com/v1/devices/{deviceId}/groups \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Create new group\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"Sample Group\",\"participants\":[{\"phone\":\"+1234567890\"}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Create new group\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {name: 'Sample Group', participants: [{phone: '+1234567890'}]}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Create new group\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/groups');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  name: 'Sample Group',\n  participants: [\n    {\n      phone: '+1234567890'\n    }\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Create new group\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/groups', [\n  'body' => '{\"name\":\"Sample Group\",\"participants\":[{\"phone\":\"+1234567890\"}]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Create new group\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'name' => 'Sample Group',\n  'participants' => [\n    [\n        'phone' => '+1234567890'\n    ]\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/groups');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Create new group\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/groups\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'name' => 'Sample Group',\n    'participants' => [\n        [\n                'phone' => '+1234567890'\n        ]\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Create new group\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/groups\"\n\npayload = {\n    \"name\": \"Sample Group\",\n    \"participants\": [{ \"phone\": \"+1234567890\" }]\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create new group\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"Sample Group\",\"participants\":[{\"phone\":\"+1234567890\"}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create new group\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"name\":\"Sample Group\",\"participants\":[{\"phone\":\"+1234567890\"}]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Create new group\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/groups\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"name\\\":\\\"Sample Group\\\",\\\"participants\\\":[{\\\"phone\\\":\\\"+1234567890\\\"}]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Create new group\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/groups\"\n\n\tpayload := strings.NewReader(\"{\\\"name\\\":\\\"Sample Group\\\",\\\"participants\\\":[{\\\"phone\\\":\\\"+1234567890\\\"}]}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Create new group\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/groups\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"name\\\":\\\"Sample Group\\\",\\\"participants\\\":[{\\\"phone\\\":\\\"+1234567890\\\"}]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Create new group\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/groups\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"name\\\":\\\"Sample Group\\\",\\\"participants\\\":[{\\\"phone\\\":\\\"+1234567890\\\"}]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Create new group\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/groups\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"name\\\":\\\"Sample Group\\\",\\\"participants\\\":[{\\\"phone\\\":\\\"+1234567890\\\"}]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Create new group\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"name\\\":\\\"Sample Group\\\",\\\"participants\\\":[{\\\"phone\\\":\\\"+1234567890\\\"}]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/groups\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Create new group\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/groups\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"name\\\":\\\"Sample Group\\\",\\\"participants\\\":[{\\\"phone\\\":\\\"+1234567890\\\"}]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Create new group\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/groups' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"name\":\"Sample Group\",\"participants\":[{\"phone\":\"+1234567890\"}]}'"},{"lang":"ObjC","source":"// Create new group\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"name\": @\"Sample Group\",\n                              @\"participants\": @[ @{ @\"phone\": @\"+1234567890\" } ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/groups\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Create new group\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"name\": \"Sample Group\",\n  \"participants\": [[\"phone\": \"+1234567890\"]]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/groups\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"put":{"summary":"Join group","description":"Join a group by invite code or URL such as: `https://chat.whatsapp.com/XXXXXXX` where `XXXXXXX` is the invite code.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fgroups&method=PUT&body=%7B%0A%20%20%22code%22%3A%20%22XXXFQXENGXXXoaXm8hXXXX%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"joinGroup","security":[{"apiKey":[]}],"tags":["Groups"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"join","description":"Join group by URL or invite code","schema":{"type":"object","properties":{"code":{"type":"string","maxLength":100,"minLength":10,"description":"Group invitation code. Required if `url` field is not defined."},"url":{"type":"string","description":"Group invitation URL. Required if `code` field is not defined."}},"additionalProperties":false}}],"responses":{"200":{"description":"Joined group","schema":{"$ref":"#/definitions/chatGroup"}},"202":{"description":"Invitation accept but requires approval","schema":{"type":"object","properties":{"groupId":{"type":"string","description":"New group WhatsApp ID"},"message":{"type":"string"}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required group permissions or feature not supported in current plan, or the operation was rejected by a temporary WhatsApp account restriction (`errorCode: account:restricted`, see `meta.reason` and `meta.expiresAt`)","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not found group or device","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Accept group invite by code\ncurl --request PUT \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/groups \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"code\":\"XXXFQXENGXXXoaXm8hXXXX\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Accept group invite by code\necho '{\"code\":\"XXXFQXENGXXXoaXm8hXXXX\"}' |  \\\n  http PUT https://api.wassenger.com/v1/devices/{deviceId}/groups \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Accept group invite by code\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups';\nconst options = {\n  method: 'PUT',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"code\":\"XXXFQXENGXXXoaXm8hXXXX\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Accept group invite by code\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PUT',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {code: 'XXXFQXENGXXXoaXm8hXXXX'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Accept group invite by code\nconst unirest = require('unirest');\n\nconst req = unirest('PUT', 'https://api.wassenger.com/v1/devices/{deviceId}/groups');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  code: 'XXXFQXENGXXXoaXm8hXXXX'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Accept group invite by code\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PUT', 'https://api.wassenger.com/v1/devices/{deviceId}/groups', [\n  'body' => '{\"code\":\"XXXFQXENGXXXoaXm8hXXXX\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Accept group invite by code\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'code' => 'XXXFQXENGXXXoaXm8hXXXX'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/groups');\n$request->setRequestMethod('PUT');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Accept group invite by code\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/groups\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PUT\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'code' => 'XXXFQXENGXXXoaXm8hXXXX'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Accept group invite by code\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/groups\"\n\npayload = { \"code\": \"XXXFQXENGXXXoaXm8hXXXX\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.put(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Accept group invite by code\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups';\nconst options = {\n  method: 'PUT',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"code\":\"XXXFQXENGXXXoaXm8hXXXX\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Accept group invite by code\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups',\n  method: 'PUT',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"code\":\"XXXFQXENGXXXoaXm8hXXXX\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Accept group invite by code\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/groups\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Put.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"code\\\":\\\"XXXFQXENGXXXoaXm8hXXXX\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Accept group invite by code\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/groups\"\n\n\tpayload := strings.NewReader(\"{\\\"code\\\":\\\"XXXFQXENGXXXoaXm8hXXXX\\\"}\")\n\n\treq, _ := http.NewRequest(\"PUT\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Accept group invite by code\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/groups\");\nvar request = new RestRequest(Method.PUT);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"code\\\":\\\"XXXFQXENGXXXoaXm8hXXXX\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Accept group invite by code\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Put,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/groups\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"code\\\":\\\"XXXFQXENGXXXoaXm8hXXXX\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Accept group invite by code\nHttpResponse<String> response = Unirest.put(\"https://api.wassenger.com/v1/devices/{deviceId}/groups\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"code\\\":\\\"XXXFQXENGXXXoaXm8hXXXX\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Accept group invite by code\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"code\\\":\\\"XXXFQXENGXXXoaXm8hXXXX\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/groups\")\n  .put(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Accept group invite by code\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PUT\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/groups\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"code\\\":\\\"XXXFQXENGXXXoaXm8hXXXX\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Accept group invite by code\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/groups' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{\"code\":\"XXXFQXENGXXXoaXm8hXXXX\"}'"},{"lang":"ObjC","source":"// Accept group invite by code\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"code\": @\"XXXFQXENGXXXoaXm8hXXXX\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/groups\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PUT\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Accept group invite by code\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"code\": \"XXXFQXENGXXXoaXm8hXXXX\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/groups\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PUT\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Leave group","description":"Leave an existing group chat, optionally also deleting the group from the chat list.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fgroups&method=DELETE&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"leaveGroup","security":[{"apiKey":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"group","description":"Optionally remove group chat after leaving the group","schema":{"type":"object","properties":{"id":{"type":"string","maxLength":50,"minLength":10},"remove":{"type":"boolean","description":"Remove group chat after leaving the group.","default":true}},"required":["id"],"additionalProperties":false}}],"tags":["Groups"],"responses":{"204":{"description":"Group deleted","schema":{"type":"object"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unsupported operation - plan upgrade required, or the operation was rejected by a temporary WhatsApp account restriction (`errorCode: account:restricted`, see `meta.reason` and `meta.expiresAt`)","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Leave a group chat\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/groups \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Leave a group chat\nhttp DELETE https://api.wassenger.com/v1/devices/{deviceId}/groups \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Leave a group chat\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Leave a group chat\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Leave a group chat\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/groups');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Leave a group chat\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/groups', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Leave a group chat\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/groups');\n$request->setRequestMethod('DELETE');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Leave a group chat\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/groups\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Leave a group chat\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/groups\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.delete(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Leave a group chat\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/groups';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Leave a group chat\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/groups',\n  method: 'DELETE',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Leave a group chat\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/groups\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Leave a group chat\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/groups\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Leave a group chat\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/groups\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Leave a group chat\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/groups\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Leave a group chat\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/devices/{deviceId}/groups\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Leave a group chat\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/groups\")\n  .delete(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Leave a group chat\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/groups\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Leave a group chat\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/groups' -Method DELETE -Headers $headers"},{"lang":"ObjC","source":"// Leave a group chat\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/groups\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Leave a group chat\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/groups\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/departments":{"parameters":[],"get":{"summary":"Get departments","description":"Retrieve a list of deparments on the current WhatsApp number.\n\n\n\n**Note**: this API resource is only available in Platform Business & Enterprise subscriptions with Team Chat feature access.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fdepartments)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getDepartments","security":[{"apiKey":[]}],"tags":["Departments"],"parameters":[],"responses":{"200":{"description":"List of available departments","schema":{"type":"array","items":{"$ref":"#/definitions/department"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get departments\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/departments \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get departments\nhttp GET https://api.wassenger.com/v1/devices/{deviceId}/departments \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get departments\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/departments';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get departments\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/departments',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get departments\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/departments');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get departments\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/departments', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get departments\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/departments');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get departments\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/departments\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get departments\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/departments\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get departments\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/departments';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get departments\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/departments',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get departments\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/departments\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get departments\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/departments\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get departments\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/departments\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get departments\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/departments\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get departments\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/departments\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get departments\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/departments\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get departments\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/departments\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get departments\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/departments' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get departments\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/departments\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get departments\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/departments\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"post":{"summary":"Create department","description":"Create a new team department in the current WhatsApp number.\n\n\n\nIn order to create a new department, you must provide a name, color and a list of team members (agents) to be added to the new department.\n\n\n\nThe department name must be unique. Each department can have from 1 up to 30 team members.\n\n\n\n**Note**: this API resource is only available in Platform Business & Enterprise subscriptions with Team Chat feature access.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fdepartments&method=POST&body=%7B%0A%20%20%22name%22%3A%20%22Support%20Team%22%2C%0A%20%20%22color%22%3A%20%22red%22%2C%0A%20%20%22description%22%3A%20%22This%20is%20a%20sample%20department%20description%22%2C%0A%20%20%22agents%22%3A%20%5B%0A%20%20%20%20%225f7b1b1b1b1b1b1b1b1b1b1b%22%0A%20%20%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"createDepartment","security":[{"apiKey":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"department","description":"Create a new department","schema":{"type":"object","properties":{"name":{"type":"string","minLength":2,"maxLength":25,"description":"Department name"},"color":{"type":"string","enum":["ruby","tomato","orange","sunflower","bubble","rose","poppy","rouge","raspberry","purple","lavender","violet","pool","emerald","kelly","apple","turquoise","aqua","gold","latte","cocoa","iron"],"description":"Department color name used for quick identification"},"icon":{"type":"string","enum":["briefcase","users","user-tie","chart-bar","clipboard-list","comments","headset","user-cog","user-edit","user-friends","laptop-code","network-wired","building","handshake","address-book","layer-group","project-diagram","calendar-check","clipboard-check","tasks","chart-pie","hands-helping","shield-alt","user-lock","user-shield","bullhorn","comments-dollar","comment-dots","fingerprint","check-circle","chalkboard-teacher","cogs","rocket","drafting-compass","lightbulb","envelope","inbox","people-carry","code-branch","globe","hand-holding-usd","money-bill-wave","phone","wrench","balance-scale","thumbs-up","user-secret","user-graduate","landmark","archive"],"description":"Department icon identifier. Defaults to `briefcase` icon","default":"briefcase"},"description":{"type":"string","minLength":0,"maxLength":300,"description":"Department description. Optional"},"agents":{"type":"array","items":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"User agent ID to include in the department"},"minItems":1,"maxItems":30,"description":"List of user agent IDs to include in the department. At least one agent is required"}},"required":["name","color","icon","agents"],"additionalProperties":false}}],"tags":["Departments"],"responses":{"200":{"description":"Channel created","schema":{"$ref":"#/definitions/department"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unsupported operation - plan upgrade required","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Channel already exists with the same name","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Create a new channel\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/departments \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"name\":\"Support Team\",\"color\":\"red\",\"description\":\"This is a sample department description\",\"agents\":[\"5f7b1b1b1b1b1b1b1b1b1b1b\"]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Create a new channel\necho '{\"name\":\"Support Team\",\"color\":\"red\",\"description\":\"This is a sample department description\",\"agents\":[\"5f7b1b1b1b1b1b1b1b1b1b1b\"]}' |  \\\n  http POST https://api.wassenger.com/v1/devices/{deviceId}/departments \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Create a new channel\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/departments';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"Support Team\",\"color\":\"red\",\"description\":\"This is a sample department description\",\"agents\":[\"5f7b1b1b1b1b1b1b1b1b1b1b\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Create a new channel\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/departments',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    name: 'Support Team',\n    color: 'red',\n    description: 'This is a sample department description',\n    agents: ['5f7b1b1b1b1b1b1b1b1b1b1b']\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Create a new channel\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/departments');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  name: 'Support Team',\n  color: 'red',\n  description: 'This is a sample department description',\n  agents: [\n    '5f7b1b1b1b1b1b1b1b1b1b1b'\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Create a new channel\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/departments', [\n  'body' => '{\"name\":\"Support Team\",\"color\":\"red\",\"description\":\"This is a sample department description\",\"agents\":[\"5f7b1b1b1b1b1b1b1b1b1b1b\"]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Create a new channel\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'name' => 'Support Team',\n  'color' => 'red',\n  'description' => 'This is a sample department description',\n  'agents' => [\n    '5f7b1b1b1b1b1b1b1b1b1b1b'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/departments');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Create a new channel\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/departments\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'name' => 'Support Team',\n    'color' => 'red',\n    'description' => 'This is a sample department description',\n    'agents' => [\n        '5f7b1b1b1b1b1b1b1b1b1b1b'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Create a new channel\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/departments\"\n\npayload = {\n    \"name\": \"Support Team\",\n    \"color\": \"red\",\n    \"description\": \"This is a sample department description\",\n    \"agents\": [\"5f7b1b1b1b1b1b1b1b1b1b1b\"]\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create a new channel\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/departments';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"Support Team\",\"color\":\"red\",\"description\":\"This is a sample department description\",\"agents\":[\"5f7b1b1b1b1b1b1b1b1b1b1b\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create a new channel\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/departments',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"name\":\"Support Team\",\"color\":\"red\",\"description\":\"This is a sample department description\",\"agents\":[\"5f7b1b1b1b1b1b1b1b1b1b1b\"]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Create a new channel\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/departments\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"name\\\":\\\"Support Team\\\",\\\"color\\\":\\\"red\\\",\\\"description\\\":\\\"This is a sample department description\\\",\\\"agents\\\":[\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\"]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Create a new channel\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/departments\"\n\n\tpayload := strings.NewReader(\"{\\\"name\\\":\\\"Support Team\\\",\\\"color\\\":\\\"red\\\",\\\"description\\\":\\\"This is a sample department description\\\",\\\"agents\\\":[\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\"]}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Create a new channel\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/departments\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"name\\\":\\\"Support Team\\\",\\\"color\\\":\\\"red\\\",\\\"description\\\":\\\"This is a sample department description\\\",\\\"agents\\\":[\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\"]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Create a new channel\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/departments\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"name\\\":\\\"Support Team\\\",\\\"color\\\":\\\"red\\\",\\\"description\\\":\\\"This is a sample department description\\\",\\\"agents\\\":[\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\"]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Create a new channel\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/departments\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"name\\\":\\\"Support Team\\\",\\\"color\\\":\\\"red\\\",\\\"description\\\":\\\"This is a sample department description\\\",\\\"agents\\\":[\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\"]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Create a new channel\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"name\\\":\\\"Support Team\\\",\\\"color\\\":\\\"red\\\",\\\"description\\\":\\\"This is a sample department description\\\",\\\"agents\\\":[\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\"]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/departments\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Create a new channel\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/departments\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"name\\\":\\\"Support Team\\\",\\\"color\\\":\\\"red\\\",\\\"description\\\":\\\"This is a sample department description\\\",\\\"agents\\\":[\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\"]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Create a new channel\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/departments' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"name\":\"Support Team\",\"color\":\"red\",\"description\":\"This is a sample department description\",\"agents\":[\"5f7b1b1b1b1b1b1b1b1b1b1b\"]}'"},{"lang":"ObjC","source":"// Create a new channel\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"name\": @\"Support Team\",\n                              @\"color\": @\"red\",\n                              @\"description\": @\"This is a sample department description\",\n                              @\"agents\": @[ @\"5f7b1b1b1b1b1b1b1b1b1b1b\" ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/departments\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Create a new channel\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"name\": \"Support Team\",\n  \"color\": \"red\",\n  \"description\": \"This is a sample department description\",\n  \"agents\": [\"5f7b1b1b1b1b1b1b1b1b1b1b\"]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/departments\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Update department","description":"Update department by ID in the current WhatsApp number.\n\n\n\n**Note**: this API resource is only available in Platform Business & Enterprise subscriptions with Team Chat feature access.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fdepartments&method=PATCH&body=%7B%0A%20%20%22name%22%3A%20%22Sales%22%2C%0A%20%20%22color%22%3A%20%22blue%22%2C%0A%20%20%22agents%22%3A%20%5B%0A%20%20%20%20%225f7b1b1b1b1b1b1b1b1b1b1b%22%2C%0A%20%20%20%20%225f710b1b1b1b1b1a1a1a1c1a%22%0A%20%20%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateDepartment","security":[{"apiKey":[]}],"tags":["Departments"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"department","description":"Update department","schema":{"type":"object","properties":{"department":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Department unique ID to update. Required"},"name":{"type":"string","minLength":2,"maxLength":25,"description":"Department name"},"color":{"type":"string","enum":["ruby","tomato","orange","sunflower","bubble","rose","poppy","rouge","raspberry","purple","lavender","violet","pool","emerald","kelly","apple","turquoise","aqua","gold","latte","cocoa","iron"],"description":"Department color name used for quick identification"},"icon":{"type":"string","enum":["briefcase","users","user-tie","chart-bar","clipboard-list","comments","headset","user-cog","user-edit","user-friends","laptop-code","network-wired","building","handshake","address-book","layer-group","project-diagram","calendar-check","clipboard-check","tasks","chart-pie","hands-helping","shield-alt","user-lock","user-shield","bullhorn","comments-dollar","comment-dots","fingerprint","check-circle","chalkboard-teacher","cogs","rocket","drafting-compass","lightbulb","envelope","inbox","people-carry","code-branch","globe","hand-holding-usd","money-bill-wave","phone","wrench","balance-scale","thumbs-up","user-secret","user-graduate","landmark","archive"],"description":"Department icon identifier. Defaults to `briefcase` icon"},"description":{"type":"string","minLength":0,"maxLength":300,"description":"Department description. Optional"},"agents":{"type":"array","items":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"User agent ID to include in the department"},"minItems":1,"maxItems":30,"description":"List of user agent IDs to include in the department"}},"required":["department"],"additionalProperties":false}}],"responses":{"200":{"description":"Departments","schema":{"$ref":"#/definitions/department"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Mising required channel permissions or feature not supported in current plan","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Update department information and team members\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/departments \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"name\":\"Sales\",\"color\":\"blue\",\"agents\":[\"5f7b1b1b1b1b1b1b1b1b1b1b\",\"5f710b1b1b1b1b1a1a1a1c1a\"]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Update department information and team members\necho '{\"name\":\"Sales\",\"color\":\"blue\",\"agents\":[\"5f7b1b1b1b1b1b1b1b1b1b1b\",\"5f710b1b1b1b1b1a1a1a1c1a\"]}' |  \\\n  http PATCH https://api.wassenger.com/v1/devices/{deviceId}/departments \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Update department information and team members\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/departments';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"Sales\",\"color\":\"blue\",\"agents\":[\"5f7b1b1b1b1b1b1b1b1b1b1b\",\"5f710b1b1b1b1b1a1a1a1c1a\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Update department information and team members\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/departments',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    name: 'Sales',\n    color: 'blue',\n    agents: ['5f7b1b1b1b1b1b1b1b1b1b1b', '5f710b1b1b1b1b1a1a1a1c1a']\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Update department information and team members\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/departments');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  name: 'Sales',\n  color: 'blue',\n  agents: [\n    '5f7b1b1b1b1b1b1b1b1b1b1b',\n    '5f710b1b1b1b1b1a1a1a1c1a'\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Update department information and team members\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/departments', [\n  'body' => '{\"name\":\"Sales\",\"color\":\"blue\",\"agents\":[\"5f7b1b1b1b1b1b1b1b1b1b1b\",\"5f710b1b1b1b1b1a1a1a1c1a\"]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Update department information and team members\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'name' => 'Sales',\n  'color' => 'blue',\n  'agents' => [\n    '5f7b1b1b1b1b1b1b1b1b1b1b',\n    '5f710b1b1b1b1b1a1a1a1c1a'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/departments');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Update department information and team members\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/departments\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'name' => 'Sales',\n    'color' => 'blue',\n    'agents' => [\n        '5f7b1b1b1b1b1b1b1b1b1b1b',\n        '5f710b1b1b1b1b1a1a1a1c1a'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Update department information and team members\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/departments\"\n\npayload = {\n    \"name\": \"Sales\",\n    \"color\": \"blue\",\n    \"agents\": [\"5f7b1b1b1b1b1b1b1b1b1b1b\", \"5f710b1b1b1b1b1a1a1a1c1a\"]\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update department information and team members\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/departments';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"Sales\",\"color\":\"blue\",\"agents\":[\"5f7b1b1b1b1b1b1b1b1b1b1b\",\"5f710b1b1b1b1b1a1a1a1c1a\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update department information and team members\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/departments',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"name\":\"Sales\",\"color\":\"blue\",\"agents\":[\"5f7b1b1b1b1b1b1b1b1b1b1b\",\"5f710b1b1b1b1b1a1a1a1c1a\"]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Update department information and team members\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/departments\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"name\\\":\\\"Sales\\\",\\\"color\\\":\\\"blue\\\",\\\"agents\\\":[\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\",\\\"5f710b1b1b1b1b1a1a1a1c1a\\\"]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Update department information and team members\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/departments\"\n\n\tpayload := strings.NewReader(\"{\\\"name\\\":\\\"Sales\\\",\\\"color\\\":\\\"blue\\\",\\\"agents\\\":[\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\",\\\"5f710b1b1b1b1b1a1a1a1c1a\\\"]}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Update department information and team members\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/departments\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"name\\\":\\\"Sales\\\",\\\"color\\\":\\\"blue\\\",\\\"agents\\\":[\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\",\\\"5f710b1b1b1b1b1a1a1a1c1a\\\"]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Update department information and team members\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/departments\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"name\\\":\\\"Sales\\\",\\\"color\\\":\\\"blue\\\",\\\"agents\\\":[\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\",\\\"5f710b1b1b1b1b1a1a1a1c1a\\\"]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Update department information and team members\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/devices/{deviceId}/departments\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"name\\\":\\\"Sales\\\",\\\"color\\\":\\\"blue\\\",\\\"agents\\\":[\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\",\\\"5f710b1b1b1b1b1a1a1a1c1a\\\"]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Update department information and team members\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"name\\\":\\\"Sales\\\",\\\"color\\\":\\\"blue\\\",\\\"agents\\\":[\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\",\\\"5f710b1b1b1b1b1a1a1a1c1a\\\"]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/departments\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Update department information and team members\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/departments\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"name\\\":\\\"Sales\\\",\\\"color\\\":\\\"blue\\\",\\\"agents\\\":[\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\",\\\"5f710b1b1b1b1b1a1a1a1c1a\\\"]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Update department information and team members\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/departments' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"name\":\"Sales\",\"color\":\"blue\",\"agents\":[\"5f7b1b1b1b1b1b1b1b1b1b1b\",\"5f710b1b1b1b1b1a1a1a1c1a\"]}'"},{"lang":"ObjC","source":"// Update department information and team members\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"name\": @\"Sales\",\n                              @\"color\": @\"blue\",\n                              @\"agents\": @[ @\"5f7b1b1b1b1b1b1b1b1b1b1b\", @\"5f710b1b1b1b1b1a1a1a1c1a\" ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/departments\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Update department information and team members\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"name\": \"Sales\",\n  \"color\": \"blue\",\n  \"agents\": [\"5f7b1b1b1b1b1b1b1b1b1b1b\", \"5f710b1b1b1b1b1a1a1a1c1a\"]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/departments\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Delete department","description":"Delete an existing department by ID in the current WhatsApp number. This action is not reversible.\n\n\n\n**Note**: this API resource is only available in Platform Business & Enterprise subscriptions with Team Chat feature access.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fdepartments&method=DELETE&body=%7B%0A%20%20%22department%22%3A%20%225f7b1b1b1b1b1b1b1b1b1b1b%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deleteDepartment","security":[{"apiKey":[]}],"tags":["Departments"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"delete","description":"Delete a department","schema":{"type":"object","properties":{"department":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Department unique ID to update. Required"}},"required":["department"],"additionalProperties":false}}],"responses":{"200":{"description":"Departments","schema":{"$ref":"#/definitions/department"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Mising required channel permissions or feature not supported in current plan","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Delete a department\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/departments \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"department\":\"5f7b1b1b1b1b1b1b1b1b1b1b\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Delete a department\necho '{\"department\":\"5f7b1b1b1b1b1b1b1b1b1b1b\"}' |  \\\n  http DELETE https://api.wassenger.com/v1/devices/{deviceId}/departments \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Delete a department\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/departments';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"department\":\"5f7b1b1b1b1b1b1b1b1b1b1b\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Delete a department\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/departments',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {department: '5f7b1b1b1b1b1b1b1b1b1b1b'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Delete a department\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/departments');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  department: '5f7b1b1b1b1b1b1b1b1b1b1b'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Delete a department\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/departments', [\n  'body' => '{\"department\":\"5f7b1b1b1b1b1b1b1b1b1b1b\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Delete a department\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'department' => '5f7b1b1b1b1b1b1b1b1b1b1b'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/departments');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Delete a department\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/departments\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'department' => '5f7b1b1b1b1b1b1b1b1b1b1b'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Delete a department\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/departments\"\n\npayload = { \"department\": \"5f7b1b1b1b1b1b1b1b1b1b1b\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete a department\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/departments';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"department\":\"5f7b1b1b1b1b1b1b1b1b1b1b\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete a department\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/departments',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"department\":\"5f7b1b1b1b1b1b1b1b1b1b1b\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Delete a department\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/departments\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"department\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Delete a department\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/departments\"\n\n\tpayload := strings.NewReader(\"{\\\"department\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\"}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Delete a department\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/departments\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"department\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Delete a department\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/departments\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"department\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Delete a department\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/devices/{deviceId}/departments\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"department\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Delete a department\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"department\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/departments\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Delete a department\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/departments\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"department\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1b\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Delete a department\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/departments' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"department\":\"5f7b1b1b1b1b1b1b1b1b1b1b\"}'"},{"lang":"ObjC","source":"// Delete a department\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"department\": @\"5f7b1b1b1b1b1b1b1b1b1b1b\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/departments\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Delete a department\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"department\": \"5f7b1b1b1b1b1b1b1b1b1b1b\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/departments\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/chats":{"parameters":[],"delete":{"summary":"Delete chats","description":"Delete one or multiple user chats by phone number in the current device WhatsApp account.\n\n\n\nYou can delete one or multiple user chats, up to 10 chats per API call.\n\n\n\n**Note**: the device must be authorized and online in order to delete the chats, as this action required real-time communication with the connected WhatsApp account.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fchats&method=POST&body=%5B%0A%20%20%22%2B1234567890%22%2C%0A%20%20%22%2B1098765432%22%0A%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deleteChats","security":[{"apiKey":[]}],"tags":["Devices"],"produces":["application/json"],"parameters":[{"in":"body","name":"numbers","schema":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16,"description":"International phone number of the chat to delete."},"minItems":1,"maxItems":10,"description":"Chat to delete by user phone number in E164 format."}}],"responses":{"200":{"description":"All chats deleted","schema":{"type":"array","items":{"type":"object","properties":{"phone":{"type":"string"},"deleted":{"type":"boolean"}}}}},"202":{"description":"Partially deleted chats","schema":{"type":"array","items":{"type":"object","properties":{"phone":{"type":"string"},"deleted":{"type":"boolean"}}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Device is not online - Try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Delete chats by phone numbers\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/chats \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '[\"+1234567890\",\"+1098765432\"]'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Delete chats by phone numbers\necho '[\"+1234567890\",\"+1098765432\"]' |  \\\n  http POST https://api.wassenger.com/v1/devices/{deviceId}/chats \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Delete chats by phone numbers\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/chats';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[\"+1234567890\",\"+1098765432\"]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Delete chats by phone numbers\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/chats',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: ['+1234567890', '+1098765432']\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Delete chats by phone numbers\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/chats');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send([\n  '+1234567890',\n  '+1098765432'\n]);\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Delete chats by phone numbers\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/chats', [\n  'body' => '[\"+1234567890\",\"+1098765432\"]',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Delete chats by phone numbers\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  '+1234567890',\n  '+1098765432'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/chats');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Delete chats by phone numbers\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/chats\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    '+1234567890',\n    '+1098765432'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Delete chats by phone numbers\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/chats\"\n\npayload = [\"+1234567890\", \"+1098765432\"]\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete chats by phone numbers\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/chats';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[\"+1234567890\",\"+1098765432\"]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete chats by phone numbers\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/chats',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '[\"+1234567890\",\"+1098765432\"]'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Delete chats by phone numbers\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/chats\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"[\\\"+1234567890\\\",\\\"+1098765432\\\"]\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Delete chats by phone numbers\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/chats\"\n\n\tpayload := strings.NewReader(\"[\\\"+1234567890\\\",\\\"+1098765432\\\"]\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Delete chats by phone numbers\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/chats\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"[\\\"+1234567890\\\",\\\"+1098765432\\\"]\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Delete chats by phone numbers\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/chats\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"[\\\"+1234567890\\\",\\\"+1098765432\\\"]\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Delete chats by phone numbers\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/chats\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"[\\\"+1234567890\\\",\\\"+1098765432\\\"]\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Delete chats by phone numbers\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"[\\\"+1234567890\\\",\\\"+1098765432\\\"]\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/chats\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Delete chats by phone numbers\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/chats\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"[\\\"+1234567890\\\",\\\"+1098765432\\\"]\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Delete chats by phone numbers\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/chats' -Method POST -Headers $headers -ContentType 'application/json' -Body '[\"+1234567890\",\"+1098765432\"]'"},{"lang":"ObjC","source":"// Delete chats by phone numbers\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @[ @\"+1234567890\",\n                              @\"+1098765432\" ];\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/chats\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Delete chats by phone numbers\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"+1234567890\", \"+1098765432\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/chats\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/channels/{channelId}/image":{"parameters":[],"put":{"summary":"Update channel image","description":"Update channel picture image. You can only change image in channels created by your WhatsApp number, otherwise the request will fail. Image must be JPEG or PNG format, up to 1MB. The minimum allowed image size is 192x192 pixels. The WhatsApp number must be authorized and online, otherwise the API will return an error. This endpoints accepts JSON or raw binary post bodies (application/octet-stream, image/*). For JSON bodies, you can define the image via remote URL (see \"url\" body field) or via data URI Base64 string (see \"image\" field) ","operationId":"channelUpdateImage","security":[{"apiKey":[]}],"tags":["Channels"],"consumes":["image/jpeg","image/png","application/octet-stream","application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"image","description":"Image to update in JPEG or PNG format. Maximum 1MB. Minimum resolution is 192x192. Image can be uploaded via remote URL (JSON), data URI base64 (JSON) or binary raw content (application/octet-stream).","schema":{"type":"object","properties":{"url":{"type":"string","minLength":6,"maxLength":2000,"description":"URL of the image to download. It must be `http` or `https` valid URL pointing to a server accessible from the Internet."},"image":{"type":"string","maxLength":1300000,"description":"Image content as Data URI Base64 encoded string. See [data URI schema](https://en.wikipedia.org/wiki/Data_URI_scheme) for more information."}},"additionalProperties":false}}],"responses":{"200":{"description":"Image updated successfully","schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Field will be `true` if the operation succeed, otherwise `false`"},"image":{"type":"string","description":"New uploaded image public URL provided by WhatsApp"}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing permissions or API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Update WhatsApp account profile avatar image\ncurl --request PUT \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/profile/image \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"url\":\"https://via.placeholder.com/280\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Update WhatsApp account profile avatar image\necho '{\"url\":\"https://via.placeholder.com/280\"}' |  \\\n  http PUT https://api.wassenger.com/v1/devices/{deviceId}/profile/image \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Update WhatsApp account profile avatar image\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image';\nconst options = {\n  method: 'PUT',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"url\":\"https://via.placeholder.com/280\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Update WhatsApp account profile avatar image\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PUT',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {url: 'https://via.placeholder.com/280'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Update WhatsApp account profile avatar image\nconst unirest = require('unirest');\n\nconst req = unirest('PUT', 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  url: 'https://via.placeholder.com/280'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Update WhatsApp account profile avatar image\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PUT', 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image', [\n  'body' => '{\"url\":\"https://via.placeholder.com/280\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Update WhatsApp account profile avatar image\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'url' => 'https://via.placeholder.com/280'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/profile/image');\n$request->setRequestMethod('PUT');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Update WhatsApp account profile avatar image\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PUT\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'url' => 'https://via.placeholder.com/280'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Update WhatsApp account profile avatar image\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\"\n\npayload = { \"url\": \"https://via.placeholder.com/280\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.put(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update WhatsApp account profile avatar image\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image';\nconst options = {\n  method: 'PUT',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"url\":\"https://via.placeholder.com/280\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update WhatsApp account profile avatar image\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image',\n  method: 'PUT',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"url\":\"https://via.placeholder.com/280\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Update WhatsApp account profile avatar image\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Put.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"url\\\":\\\"https://via.placeholder.com/280\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Update WhatsApp account profile avatar image\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\"\n\n\tpayload := strings.NewReader(\"{\\\"url\\\":\\\"https://via.placeholder.com/280\\\"}\")\n\n\treq, _ := http.NewRequest(\"PUT\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Update WhatsApp account profile avatar image\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\");\nvar request = new RestRequest(Method.PUT);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"url\\\":\\\"https://via.placeholder.com/280\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Update WhatsApp account profile avatar image\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Put,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"url\\\":\\\"https://via.placeholder.com/280\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Update WhatsApp account profile avatar image\nHttpResponse<String> response = Unirest.put(\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"url\\\":\\\"https://via.placeholder.com/280\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Update WhatsApp account profile avatar image\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"url\\\":\\\"https://via.placeholder.com/280\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\")\n  .put(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Update WhatsApp account profile avatar image\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PUT\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"url\\\":\\\"https://via.placeholder.com/280\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Update WhatsApp account profile avatar image\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/profile/image' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{\"url\":\"https://via.placeholder.com/280\"}'"},{"lang":"ObjC","source":"// Update WhatsApp account profile avatar image\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"url\": @\"https://via.placeholder.com/280\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PUT\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Update WhatsApp account profile avatar image\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"url\": \"https://via.placeholder.com/280\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/profile/image\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PUT\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}],"x-meta":{"method":"PUT","path":"/devices/{deviceId}/channels/{channelId}/image","samples":[{"comment":"Update channel image"}]}}},"/devices/{deviceId}/channels/{channelId}":{"parameters":[],"get":{"summary":"Get channel by ID","description":"Get group information and participants by WhatsApp group ID (e.g: `123000098765421000`, `123000098765421000@newsletter`)\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fchannels%2F%7BchannelId%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getChannelById","security":[{"apiKey":[]}],"tags":["Channels"],"produces":["application/json"],"responses":{"200":{"description":"Channel information","schema":{"$ref":"#/definitions/chatGroup"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Forbidden operation","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not found channel or device","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get channel by ID\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get channel by ID\nhttp GET https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get channel by ID\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get channel by ID\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get channel by ID\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get channel by ID\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get channel by ID\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get channel by ID\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get channel by ID\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get channel by ID\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get channel by ID\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get channel by ID\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get channel by ID\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get channel by ID\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get channel by ID\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get channel by ID\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get channel by ID\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get channel by ID\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get channel by ID\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get channel by ID\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get channel by ID\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Update channel","description":"Update channel name, description and optionally image. You should pass the WhatsApp channel ID in the URL path (e.g: `123000098765421000`, `123000098765421000@newsletter`).\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fchannels%2F%7BchannelId%7D&method=PATCH&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateChannel","security":[{"apiKey":[]}],"tags":["Channels"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"channel","description":"New channel data","schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"Channel name"},"description":{"type":"string","minLength":1,"maxLength":2048,"description":"Channel public description up to 2048 characters"},"image":{"type":"string","maxLength":2000,"description":"Optional. Image URL to be used as channel profile picture. Only PNG and JPEG images are supported. Max size is: 1MB"}},"required":["name"],"additionalProperties":false}}],"responses":{"200":{"description":"Channel updated","schema":{"$ref":"#/definitions/chatGroup"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required channel permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Update channel information\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Update channel information\nhttp PATCH https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Update channel information\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}';\nconst options = {method: 'PATCH', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Update channel information\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Update channel information\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Update channel information\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Update channel information\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}');\n$request->setRequestMethod('PATCH');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Update channel information\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Update channel information\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.patch(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update channel information\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}';\nconst options = {method: 'PATCH', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update channel information\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}',\n  method: 'PATCH',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Update channel information\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Update channel information\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\"\n\n\treq, _ := http.NewRequest(\"PATCH\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Update channel information\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Update channel information\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Update channel information\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Update channel information\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\")\n  .patch(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Update channel information\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Update channel information\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}' -Method PATCH -Headers $headers"},{"lang":"ObjC","source":"// Update channel information\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Update channel information\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Delete channel","description":"Delete (unfollow) from a given channel by WhatsApp ID. Specify the WhatsApp channel ID in the URL path (e.g: `123000098765421000`, `123000098765421000@newsletter`).\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fchannels%2F%7BchannelId%7D&method=DELETE&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deleteChannel","security":[{"apiKey":[]}],"tags":["Channels"],"consumes":["application/json"],"produces":["application/json"],"parameters":[],"responses":{"200":{"description":"Channel deleted","schema":{"$ref":"#/definitions/chatGroup"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required channel permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Delete channel\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Delete channel\nhttp DELETE https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Delete channel\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Delete channel\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Delete channel\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Delete channel\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Delete channel\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}');\n$request->setRequestMethod('DELETE');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Delete channel\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Delete channel\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.delete(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete channel\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete channel\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}',\n  method: 'DELETE',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Delete channel\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Delete channel\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Delete channel\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Delete channel\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Delete channel\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Delete channel\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\")\n  .delete(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Delete channel\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Delete channel\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}' -Method DELETE -Headers $headers"},{"lang":"ObjC","source":"// Delete channel\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Delete channel\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/channels/{channelId}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/channels":{"parameters":[],"get":{"summary":"Get channels","description":"Get active own or following channels in the connected WhatsApp number.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fchannels)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getDeviceChannels","security":[{"apiKey":[]}],"tags":["Channels"],"parameters":[{"in":"query","name":"permission","type":"string","enum":["read","send"]},{"in":"query","name":"size","description":"Results page size","type":"number","format":"integer","default":100,"minimum":1,"maximum":500},{"in":"query","name":"page","description":"Results page number (starting from 0)","type":"number","format":"integer","default":0,"minimum":0,"maximum":200}],"responses":{"200":{"description":"List of available channels","schema":{"type":"array","items":{"$ref":"#/definitions/chatGroup"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get channels\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/channels \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get channels\nhttp GET https://api.wassenger.com/v1/devices/{deviceId}/channels \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get channels\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/channels';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get channels\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/channels',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get channels\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/channels');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get channels\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/channels', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get channels\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/channels');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get channels\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/channels\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get channels\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/channels\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get channels\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/channels';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get channels\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/channels',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get channels\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/channels\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get channels\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/channels\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get channels\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/channels\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get channels\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/channels\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get channels\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/channels\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get channels\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/channels\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get channels\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/channels\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get channels\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/channels' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get channels\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/channels\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get channels\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/channels\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"post":{"summary":"Create channel","description":"Create a new WhatsApp public channel, optionally with a description and picture image.\n\n\n\n> **Important**: creating a new channel is a slow process that may fail. Use this endpoint carefully, do not create more than one channel every 2 minutes and increase the request timeout tolerance up to 100 seconds.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fchannels&method=POST&body=%7B%0A%20%20%22name%22%3A%20%22Sample%20channel%22%2C%0A%20%20%22description%22%3A%20%22Sample%20channel%20description%2C%20up%20to%202048%20characters%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"createChannel","security":[{"apiKey":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"channel","description":"Channel to create with name and description","schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"Channel name"},"description":{"type":"string","minLength":1,"maxLength":2048,"description":"Channel public description up to 2048 characters"},"image":{"type":"object","properties":{"data":{"type":"string","maxLength":12000000,"description":"Base64 image encoded string to be used as channel profile picture. Only PNG and JPEG images are supported. Max size is: 1MB"},"url":{"type":"string","maxLength":2000,"description":"Image URL to be used as channel profile picture. Only PNG and JPEG images are supported. Max size is: 1MB"}},"additionalProperties":false,"description":"Optional. Image to use as the new channel profile picture. Only PNG and JPEG images are supported. Max size is: 1MB"}},"required":["name"],"additionalProperties":false}}],"tags":["Channels"],"responses":{"200":{"description":"Channel created","schema":{"$ref":"#/definitions/chatGroup"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unsupported operation - plan upgrade required","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Channel already exists with the same name","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Create a new channel\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/channels \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"name\":\"Sample channel\",\"description\":\"Sample channel description, up to 2048 characters\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Create a new channel\necho '{\"name\":\"Sample channel\",\"description\":\"Sample channel description, up to 2048 characters\"}' |  \\\n  http POST https://api.wassenger.com/v1/devices/{deviceId}/channels \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Create a new channel\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/channels';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"Sample channel\",\"description\":\"Sample channel description, up to 2048 characters\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Create a new channel\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/channels',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    name: 'Sample channel',\n    description: 'Sample channel description, up to 2048 characters'\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Create a new channel\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/channels');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  name: 'Sample channel',\n  description: 'Sample channel description, up to 2048 characters'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Create a new channel\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/channels', [\n  'body' => '{\"name\":\"Sample channel\",\"description\":\"Sample channel description, up to 2048 characters\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Create a new channel\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'name' => 'Sample channel',\n  'description' => 'Sample channel description, up to 2048 characters'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/channels');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Create a new channel\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/channels\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'name' => 'Sample channel',\n    'description' => 'Sample channel description, up to 2048 characters'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Create a new channel\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/channels\"\n\npayload = {\n    \"name\": \"Sample channel\",\n    \"description\": \"Sample channel description, up to 2048 characters\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create a new channel\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/channels';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"Sample channel\",\"description\":\"Sample channel description, up to 2048 characters\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Create a new channel\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/channels',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"name\":\"Sample channel\",\"description\":\"Sample channel description, up to 2048 characters\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Create a new channel\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/channels\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"name\\\":\\\"Sample channel\\\",\\\"description\\\":\\\"Sample channel description, up to 2048 characters\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Create a new channel\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/channels\"\n\n\tpayload := strings.NewReader(\"{\\\"name\\\":\\\"Sample channel\\\",\\\"description\\\":\\\"Sample channel description, up to 2048 characters\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Create a new channel\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/channels\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"name\\\":\\\"Sample channel\\\",\\\"description\\\":\\\"Sample channel description, up to 2048 characters\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Create a new channel\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/channels\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"name\\\":\\\"Sample channel\\\",\\\"description\\\":\\\"Sample channel description, up to 2048 characters\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Create a new channel\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/channels\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"name\\\":\\\"Sample channel\\\",\\\"description\\\":\\\"Sample channel description, up to 2048 characters\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Create a new channel\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"name\\\":\\\"Sample channel\\\",\\\"description\\\":\\\"Sample channel description, up to 2048 characters\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/channels\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Create a new channel\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/channels\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"name\\\":\\\"Sample channel\\\",\\\"description\\\":\\\"Sample channel description, up to 2048 characters\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Create a new channel\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/channels' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"name\":\"Sample channel\",\"description\":\"Sample channel description, up to 2048 characters\"}'"},{"lang":"ObjC","source":"// Create a new channel\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"name\": @\"Sample channel\",\n                              @\"description\": @\"Sample channel description, up to 2048 characters\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/channels\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Create a new channel\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"name\": \"Sample channel\",\n  \"description\": \"Sample channel description, up to 2048 characters\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/channels\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"put":{"summary":"Join channel","description":"Join channel by channel WhatsApp ID, invite code or URL such as: `https://whatsapp.com/channels/XXXXXXX` where `XXXXXXX` is the invite code.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fchannels&method=PUT&body=%7B%0A%20%20%22code%22%3A%20%22XXXFQXENGXXXoaXm8hXXXX%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"joinChannel","security":[{"apiKey":[]}],"tags":["Channels"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"join","description":"Join channel by URL or invite code","schema":{"type":"object","properties":{"code":{"type":"string","maxLength":100,"minLength":10,"description":"Channel invitation code. Required if `url` field is not defined."},"url":{"type":"string","description":"Channel invitation URL. Required if `code` field is not defined."}},"additionalProperties":false}}],"responses":{"200":{"description":"Joined the new channel","schema":{"$ref":"#/definitions/chatGroup"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Mising required channel permissions or feature not supported in current plan","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not found channel or device","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Already joined this channel","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Join channel by invite code\ncurl --request PUT \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/channels \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"code\":\"XXXFQXENGXXXoaXm8hXXXX\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Join channel by invite code\necho '{\"code\":\"XXXFQXENGXXXoaXm8hXXXX\"}' |  \\\n  http PUT https://api.wassenger.com/v1/devices/{deviceId}/channels \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Join channel by invite code\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/channels';\nconst options = {\n  method: 'PUT',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"code\":\"XXXFQXENGXXXoaXm8hXXXX\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Join channel by invite code\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PUT',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/channels',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {code: 'XXXFQXENGXXXoaXm8hXXXX'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Join channel by invite code\nconst unirest = require('unirest');\n\nconst req = unirest('PUT', 'https://api.wassenger.com/v1/devices/{deviceId}/channels');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  code: 'XXXFQXENGXXXoaXm8hXXXX'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Join channel by invite code\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PUT', 'https://api.wassenger.com/v1/devices/{deviceId}/channels', [\n  'body' => '{\"code\":\"XXXFQXENGXXXoaXm8hXXXX\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Join channel by invite code\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'code' => 'XXXFQXENGXXXoaXm8hXXXX'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/channels');\n$request->setRequestMethod('PUT');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Join channel by invite code\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/channels\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PUT\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'code' => 'XXXFQXENGXXXoaXm8hXXXX'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Join channel by invite code\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/channels\"\n\npayload = { \"code\": \"XXXFQXENGXXXoaXm8hXXXX\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.put(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Join channel by invite code\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/channels';\nconst options = {\n  method: 'PUT',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"code\":\"XXXFQXENGXXXoaXm8hXXXX\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Join channel by invite code\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/channels',\n  method: 'PUT',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"code\":\"XXXFQXENGXXXoaXm8hXXXX\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Join channel by invite code\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/channels\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Put.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"code\\\":\\\"XXXFQXENGXXXoaXm8hXXXX\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Join channel by invite code\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/channels\"\n\n\tpayload := strings.NewReader(\"{\\\"code\\\":\\\"XXXFQXENGXXXoaXm8hXXXX\\\"}\")\n\n\treq, _ := http.NewRequest(\"PUT\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Join channel by invite code\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/channels\");\nvar request = new RestRequest(Method.PUT);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"code\\\":\\\"XXXFQXENGXXXoaXm8hXXXX\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Join channel by invite code\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Put,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/channels\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"code\\\":\\\"XXXFQXENGXXXoaXm8hXXXX\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Join channel by invite code\nHttpResponse<String> response = Unirest.put(\"https://api.wassenger.com/v1/devices/{deviceId}/channels\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"code\\\":\\\"XXXFQXENGXXXoaXm8hXXXX\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Join channel by invite code\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"code\\\":\\\"XXXFQXENGXXXoaXm8hXXXX\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/channels\")\n  .put(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Join channel by invite code\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PUT\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/channels\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"code\\\":\\\"XXXFQXENGXXXoaXm8hXXXX\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Join channel by invite code\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/channels' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{\"code\":\"XXXFQXENGXXXoaXm8hXXXX\"}'"},{"lang":"ObjC","source":"// Join channel by invite code\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"code\": @\"XXXFQXENGXXXoaXm8hXXXX\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/channels\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PUT\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Join channel by invite code\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"code\": \"XXXFQXENGXXXoaXm8hXXXX\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/channels\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PUT\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Search channels","description":"Search publicly available WhatsApp channels by text, category and country\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fchannels&method=PATCH&body=%7B%0A%20%20%22search%22%3A%20%22WhatsApp%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"searchChannels","security":[{"apiKey":[]}],"tags":["Channels"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"join","description":"Search channels by text","schema":{"type":"object","properties":{"search":{"type":"string","minLength":1,"maxLength":50,"description":"Search channels by text query"},"limit":{"type":"number","format":"float","minimum":1,"maximum":50,"description":"How many results to return","default":50},"category":{"type":"string","enum":["recommended","trending","popular","new","featured"],"description":"Search channels by category","default":"recommended"},"sort":{"type":"string","enum":["desc","asc"],"description":"Sort channels order criteria based on the default","default":"desc"},"sortField":{"type":"string","enum":["creation_time","subscribers"],"description":"Sort channels by creation time or subscribers count","default":"subscribers"},"countries":{"type":"array","items":{"type":"string","maxLength":2,"minLength":2,"enum":["AF","AX","AL","DZ","AS","AD","AO","AI","AQ","AG","AR","AM","AW","AU","AT","AZ","BS","BH","BD","BB","BY","BE","BZ","BJ","BM","BT","BO","BA","BW","BV","BR","IO","BN","BG","BF","BI","KH","CM","CA","CV","KY","CF","TD","CL","CN","CX","CC","CO","KM","CG","CD","CK","CR","CI","HR","CU","CY","CZ","DK","DJ","DM","DO","EC","EG","SV","GQ","ER","EE","ET","FK","FO","FJ","FI","FR","GF","PF","TF","GA","GM","GE","DE","GH","GI","GR","GL","GD","GP","GU","GT","GG","GN","GW","GY","HT","HM","VA","HN","HK","HU","IS","IN","ID","IR","IQ","IE","IM","IL","IT","JM","JP","JE","JO","KZ","KE","KI","KP","KR","XK","KW","KG","LA","LV","LB","LS","LR","LY","LI","LT","LU","MO","MK","MG","MW","MY","MV","ML","MT","MH","MQ","MR","MU","YT","MX","FM","MD","MC","MN","ME","MS","MA","MZ","MM","NA","NR","NP","NL","AN","NC","NZ","NI","NE","NG","NU","NF","MP","NO","OM","PK","PW","PS","PA","PG","PY","PE","PH","PN","PL","PT","PR","QA","RO","RU","RW","RE","BL","SH","KN","LC","MF","PM","VC","WS","SM","ST","SA","SN","RS","SC","SL","SG","SK","SI","SB","SO","ZA","SS","GS","ES","LK","SD","SR","SJ","SZ","SE","CH","SY","TW","TJ","TZ","TH","TL","TG","TK","TO","TT","TN","TR","TM","TC","TV","UG","UA","AE","GB","US","UY","UZ","VU","VE","VN","VG","VI","WF","YE","ZM","ZW"]},"maxItems":10}},"additionalProperties":false}}],"responses":{"200":{"description":"Channels","schema":{"$ref":"#/definitions/chatGroup"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Mising required channel permissions or feature not supported in current plan","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Operation or WhatsApp session not available: try again","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Search publicly available channels\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/channels \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"search\":\"WhatsApp\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Search publicly available channels\necho '{\"search\":\"WhatsApp\"}' |  \\\n  http PATCH https://api.wassenger.com/v1/devices/{deviceId}/channels \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Search publicly available channels\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/channels';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"search\":\"WhatsApp\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Search publicly available channels\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/channels',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {search: 'WhatsApp'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Search publicly available channels\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/channels');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  search: 'WhatsApp'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Search publicly available channels\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/channels', [\n  'body' => '{\"search\":\"WhatsApp\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Search publicly available channels\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'search' => 'WhatsApp'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/channels');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Search publicly available channels\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/channels\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'search' => 'WhatsApp'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Search publicly available channels\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/channels\"\n\npayload = { \"search\": \"WhatsApp\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Search publicly available channels\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/channels';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"search\":\"WhatsApp\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Search publicly available channels\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/channels',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"search\":\"WhatsApp\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Search publicly available channels\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/channels\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"search\\\":\\\"WhatsApp\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Search publicly available channels\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/channels\"\n\n\tpayload := strings.NewReader(\"{\\\"search\\\":\\\"WhatsApp\\\"}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Search publicly available channels\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/channels\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"search\\\":\\\"WhatsApp\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Search publicly available channels\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/channels\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"search\\\":\\\"WhatsApp\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Search publicly available channels\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/devices/{deviceId}/channels\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"search\\\":\\\"WhatsApp\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Search publicly available channels\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"search\\\":\\\"WhatsApp\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/channels\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Search publicly available channels\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/channels\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"search\\\":\\\"WhatsApp\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Search publicly available channels\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/channels' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"search\":\"WhatsApp\"}'"},{"lang":"ObjC","source":"// Search publicly available channels\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"search\": @\"WhatsApp\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/channels\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Search publicly available channels\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"search\": \"WhatsApp\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/channels\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/catalog":{"parameters":[],"get":{"summary":"Get catalog","description":"Get the WhatsApp Business catalog information automatically synced from the current WhatsApp connected number.\n\n\n\nCatalog is only available in WhatsApp Business numbers.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fcatalog)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getCatalog","security":[{"apiKey":[]}],"parameters":[{"in":"query","name":"size","type":"number","default":100,"minimum":1,"maximum":500,"description":"Products to return"},{"in":"query","name":"page","type":"number","default":0,"minimum":0,"maximum":50,"description":"Products page to return"}],"tags":["Business catalog"],"responses":{"200":{"description":"WhatsApp Business catalog","schema":{"$ref":"#/definitions/catalog"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not found device or catalog","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get Business catalog\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/catalog \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get Business catalog\nhttp GET https://api.wassenger.com/v1/devices/{deviceId}/catalog \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get Business catalog\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/catalog';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get Business catalog\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/catalog',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get Business catalog\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/catalog');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get Business catalog\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/catalog', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get Business catalog\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/catalog');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get Business catalog\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/catalog\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get Business catalog\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/catalog\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get Business catalog\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/catalog';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get Business catalog\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/catalog',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get Business catalog\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/catalog\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get Business catalog\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/catalog\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get Business catalog\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/catalog\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get Business catalog\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/catalog\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get Business catalog\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/catalog\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get Business catalog\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/catalog\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get Business catalog\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/catalog\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get Business catalog\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/catalog' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get Business catalog\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/catalog\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get Business catalog\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/catalog\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"post":{"summary":"Query catalog","description":"Query WhatsApp Business catalog information for any WhatsApp Business number.\n\n\n\nIf the number does not exist or the catalog is not available, an error will be returned.\n\n\n\nBusiness Catalog queries are quota limited per plan as follows:\n\n\n\n- Professional plan = 2000 queries per month\n\n- Business plan = 5000 queries per month\n\n- Enterprise plan = 10000 queries per month\n\n\n\n**Important**: this API endpoint is not available in Gateway plan subscriptions.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fcatalog&method=POST&body=%7B%0A%20%20%22phone%22%3A%20%22%2B123456789%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"queryCatalog","security":[{"apiKey":[]}],"parameters":[{"in":"body","name":"catalog","description":"Query Business catalog per WhatsApp number","schema":{"type":"object","properties":{"phone":{"type":"string","minLength":6,"maxLength":16,"description":"WhatsApp Business phone number"},"size":{"type":"integer","minimum":1,"maximum":500,"description":"Catalog product items to retrieve. The maximum items allowed by WhatsApp is `500`","default":100}},"required":["phone"],"additionalProperties":false}}],"tags":["Business catalog"],"responses":{"200":{"description":"WhatsApp Business catalog","headers":{"Catalog-Quota-Available":{"type":"number","description":"Total catalog queries quota available in the current billing period"}},"schema":{"$ref":"#/definitions/catalog"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing or unauthorized API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not found device or catalog","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Device is not active or unsupported plan","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Catalog queries allowed quota exceeded for the current billing period","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"WhatsApp number session is not online or available","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Query WhatsApp Business catalog\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/catalog \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"phone\":\"+123456789\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Query WhatsApp Business catalog\necho '{\"phone\":\"+123456789\"}' |  \\\n  http POST https://api.wassenger.com/v1/devices/{deviceId}/catalog \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Query WhatsApp Business catalog\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/catalog';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phone\":\"+123456789\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Query WhatsApp Business catalog\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/catalog',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {phone: '+123456789'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Query WhatsApp Business catalog\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/catalog');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  phone: '+123456789'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Query WhatsApp Business catalog\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/catalog', [\n  'body' => '{\"phone\":\"+123456789\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Query WhatsApp Business catalog\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'phone' => '+123456789'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/catalog');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Query WhatsApp Business catalog\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/catalog\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'phone' => '+123456789'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Query WhatsApp Business catalog\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/catalog\"\n\npayload = { \"phone\": \"+123456789\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Query WhatsApp Business catalog\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/catalog';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phone\":\"+123456789\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Query WhatsApp Business catalog\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/catalog',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"phone\":\"+123456789\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Query WhatsApp Business catalog\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/catalog\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"phone\\\":\\\"+123456789\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Query WhatsApp Business catalog\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/catalog\"\n\n\tpayload := strings.NewReader(\"{\\\"phone\\\":\\\"+123456789\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Query WhatsApp Business catalog\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/catalog\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"phone\\\":\\\"+123456789\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Query WhatsApp Business catalog\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/catalog\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"phone\\\":\\\"+123456789\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Query WhatsApp Business catalog\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/catalog\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"phone\\\":\\\"+123456789\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Query WhatsApp Business catalog\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"phone\\\":\\\"+123456789\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/catalog\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Query WhatsApp Business catalog\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/catalog\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"phone\\\":\\\"+123456789\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Query WhatsApp Business catalog\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/catalog' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"phone\":\"+123456789\"}'"},{"lang":"ObjC","source":"// Query WhatsApp Business catalog\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"phone\": @\"+123456789\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/catalog\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Query WhatsApp Business catalog\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"phone\": \"+123456789\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/catalog\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/block":{"parameters":[],"post":{"summary":"Block contacts","description":"Block contacts by phone numbers with international country code prefix in the connected WhatsApp account. Requires the number session to be online, otherwise an error will be returned.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fblock&method=POST&body=%7B%0A%20%20%22contacts%22%3A%20%5B%0A%20%20%20%20%22%2B1234567890%22%0A%20%20%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"blockContacts","security":[{"apiKey":[]}],"tags":["Contacts"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"contacts","description":"List of contact phone numbers to block","schema":{"type":"object","properties":{"contacts":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":1,"maxItems":50,"description":"Contacts phone numbers with international country code prefix in E164 format. Example: +12345767890"}},"required":["contacts"],"additionalProperties":false}}],"responses":{"200":{"description":"Contacts blocked sucessfully","schema":{"type":"object","properties":{"messages":{"type":"string","description":"Success message"}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Forbidden operation or feature not supported in current plan","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not found group or device","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Block contacts by phone number\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/block \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"contacts\":[\"+1234567890\"]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Block contacts by phone number\necho '{\"contacts\":[\"+1234567890\"]}' |  \\\n  http POST https://api.wassenger.com/v1/devices/{deviceId}/block \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Block contacts by phone number\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/block';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"contacts\":[\"+1234567890\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Block contacts by phone number\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/block',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {contacts: ['+1234567890']}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Block contacts by phone number\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/block');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  contacts: [\n    '+1234567890'\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Block contacts by phone number\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/block', [\n  'body' => '{\"contacts\":[\"+1234567890\"]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Block contacts by phone number\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'contacts' => [\n    '+1234567890'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/block');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Block contacts by phone number\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/block\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'contacts' => [\n        '+1234567890'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Block contacts by phone number\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/block\"\n\npayload = { \"contacts\": [\"+1234567890\"] }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Block contacts by phone number\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/block';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"contacts\":[\"+1234567890\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Block contacts by phone number\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/block',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"contacts\":[\"+1234567890\"]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Block contacts by phone number\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/block\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"contacts\\\":[\\\"+1234567890\\\"]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Block contacts by phone number\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/block\"\n\n\tpayload := strings.NewReader(\"{\\\"contacts\\\":[\\\"+1234567890\\\"]}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Block contacts by phone number\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/block\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"contacts\\\":[\\\"+1234567890\\\"]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Block contacts by phone number\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/block\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"contacts\\\":[\\\"+1234567890\\\"]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Block contacts by phone number\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/block\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"contacts\\\":[\\\"+1234567890\\\"]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Block contacts by phone number\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"contacts\\\":[\\\"+1234567890\\\"]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/block\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Block contacts by phone number\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/block\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"contacts\\\":[\\\"+1234567890\\\"]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Block contacts by phone number\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/block' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"contacts\":[\"+1234567890\"]}'"},{"lang":"ObjC","source":"// Block contacts by phone number\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"contacts\": @[ @\"+1234567890\" ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/block\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Block contacts by phone number\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"contacts\": [\"+1234567890\"]] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/block\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Unblock contacts","description":"Block contacts by phone numbers with international country code prefix in the connected WhatsApp account. Requires the number session to be online, otherwise an error will be returned.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fblock&method=DELETE&body=%7B%0A%20%20%22contacts%22%3A%20%5B%0A%20%20%20%20%22%2B1234567890%22%0A%20%20%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"unblockContacts","security":[{"apiKey":[]}],"tags":["Contacts"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"contacts","description":"List of contact phone numbers to unblock","schema":{"type":"object","properties":{"contacts":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":1,"maxItems":50,"description":"Contacts phone numbers with international country code prefix in E164 format. Example: +12345767890"}},"required":["contacts"],"additionalProperties":false}}],"responses":{"200":{"description":"Contacts unblocked successfully","schema":{"type":"object","properties":{"messages":{"type":"string","description":"Success message"}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Forbidden operation or feature not supported in current plan","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not found group or device","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Unblock contacts\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/block \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"contacts\":[\"+1234567890\"]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Unblock contacts\necho '{\"contacts\":[\"+1234567890\"]}' |  \\\n  http DELETE https://api.wassenger.com/v1/devices/{deviceId}/block \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Unblock contacts\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/block';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"contacts\":[\"+1234567890\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Unblock contacts\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/block',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {contacts: ['+1234567890']}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Unblock contacts\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/block');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  contacts: [\n    '+1234567890'\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Unblock contacts\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}/block', [\n  'body' => '{\"contacts\":[\"+1234567890\"]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Unblock contacts\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'contacts' => [\n    '+1234567890'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/block');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Unblock contacts\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/block\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'contacts' => [\n        '+1234567890'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Unblock contacts\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/block\"\n\npayload = { \"contacts\": [\"+1234567890\"] }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Unblock contacts\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/block';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"contacts\":[\"+1234567890\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Unblock contacts\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/block',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"contacts\":[\"+1234567890\"]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Unblock contacts\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/block\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"contacts\\\":[\\\"+1234567890\\\"]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Unblock contacts\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/block\"\n\n\tpayload := strings.NewReader(\"{\\\"contacts\\\":[\\\"+1234567890\\\"]}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Unblock contacts\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/block\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"contacts\\\":[\\\"+1234567890\\\"]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Unblock contacts\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/block\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"contacts\\\":[\\\"+1234567890\\\"]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Unblock contacts\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/devices/{deviceId}/block\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"contacts\\\":[\\\"+1234567890\\\"]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Unblock contacts\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"contacts\\\":[\\\"+1234567890\\\"]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/block\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Unblock contacts\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/block\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"contacts\\\":[\\\"+1234567890\\\"]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Unblock contacts\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/block' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"contacts\":[\"+1234567890\"]}'"},{"lang":"ObjC","source":"// Unblock contacts\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"contacts\": @[ @\"+1234567890\" ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/block\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Unblock contacts\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"contacts\": [\"+1234567890\"]] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/block\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/autoresolve":{"parameters":[],"get":{"summary":"Get automatic chat resolution","description":"Get the automatic resolution of inactive chats of the given WhatsApp number.\n\n\n\nChats with no activity for the configured timeframe are resolved by the platform, with optional secondary actions:\n\nunassign the agent (the department is kept), add or remove labels and leave an internal note.\n\n\n\nBy default only chats waiting on the customer are resolved: a chat whose last message is the customer's\n\nstays open unless `includeUnanswered` is on. Pinned chats and groups are never resolved.\n\n\n\nAvailable on Business and Enterprise plans.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fautoresolve)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getChatAutoResolution","security":[{"apiKey":[]}],"tags":["Automatic Resolution"],"responses":{"200":{"description":"Current automatic resolution configuration","schema":{"type":"object","properties":{"active":{"type":"boolean","description":"Enable or disable the automatic resolution of inactive chats"},"timeframe":{"type":"string","enum":["6h","12h","24h","48h","3d","7d","14d","30d"],"description":"Inactivity after which a chat is resolved: 6h, 12h, 24h, 48h, 3d, 7d, 14d or 30d"},"includeUnanswered":{"type":"boolean","description":"Also resolve chats whose last message came from the customer and was never answered. Off by default: only chats waiting on the customer are resolved."},"onlyUnassigned":{"type":"boolean","description":"Only resolve chats with no agent assigned"},"excludeLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":10,"description":"Chats with any of these labels are never resolved"},"unassign":{"type":"boolean","description":"Unassign the agent when the chat is resolved. The department is kept."},"addLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Platform labels added to the chat when it is resolved"},"removeLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Platform labels removed from the chat when it is resolved"},"note":{"type":"object","properties":{"active":{"type":"boolean"},"text":{"type":"string","maxLength":1000}},"additionalProperties":false,"description":"Internal note left in the chat when it is resolved, only visible to the team"},"available":{"type":"boolean","description":"Always true here: where it is not available the request fails with 409"},"activatedAt":{"type":"string","format":"date-time","description":"When it was last turned on. Null until then"},"updatedAt":{"type":"string","format":"date-time","description":"Null until the first change"},"updatedBy":{"type":"string","description":"ID of the user who last changed it. Null until the first change"},"stats":{"type":"object","properties":{"resolved7d":{"type":"integer","description":"Chats resolved in the last 7 days"},"lastRunAt":{"type":"string","format":"date-time","description":"Last time the number was swept. Null until then"}}}},"additionalProperties":false}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unauthorized user or missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Feature not available in current plan","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get the automatic resolution of inactive chats of the current WhatsApp number\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/autoresolve \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get the automatic resolution of inactive chats of the current WhatsApp number\nhttp GET https://api.wassenger.com/v1/devices/{deviceId}/autoresolve \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get the automatic resolution of inactive chats of the current WhatsApp number\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/autoresolve';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get the automatic resolution of inactive chats of the current WhatsApp number\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/autoresolve',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get the automatic resolution of inactive chats of the current WhatsApp number\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/autoresolve');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get the automatic resolution of inactive chats of the current WhatsApp number\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/autoresolve', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get the automatic resolution of inactive chats of the current WhatsApp number\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/autoresolve');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get the automatic resolution of inactive chats of the current WhatsApp number\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/autoresolve\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get the automatic resolution of inactive chats of the current WhatsApp number\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/autoresolve\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get the automatic resolution of inactive chats of the current WhatsApp number\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/autoresolve';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get the automatic resolution of inactive chats of the current WhatsApp number\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/autoresolve',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get the automatic resolution of inactive chats of the current WhatsApp number\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/autoresolve\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get the automatic resolution of inactive chats of the current WhatsApp number\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/autoresolve\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get the automatic resolution of inactive chats of the current WhatsApp number\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/autoresolve\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get the automatic resolution of inactive chats of the current WhatsApp number\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/autoresolve\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get the automatic resolution of inactive chats of the current WhatsApp number\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/autoresolve\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get the automatic resolution of inactive chats of the current WhatsApp number\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/autoresolve\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get the automatic resolution of inactive chats of the current WhatsApp number\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/autoresolve\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get the automatic resolution of inactive chats of the current WhatsApp number\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/autoresolve' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get the automatic resolution of inactive chats of the current WhatsApp number\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/autoresolve\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get the automatic resolution of inactive chats of the current WhatsApp number\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/autoresolve\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Update automatic chat resolution","description":"Update the automatic resolution of inactive chats of the given WhatsApp number.\n\n\n\nTurning it on, or widening the rule, resolves the chats that already match it, at most 100 per number\n\nevery 5 minutes.\n\n\n\nLabels must already exist on the number. The labels added or removed on resolve must be platform labels,\n\nnot WhatsApp labels. An active internal note needs a text. The timeframe defaults to `24h`.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fautoresolve&method=PATCH&body=%7B%0A%20%20%22active%22%3A%20true%2C%0A%20%20%22timeframe%22%3A%20%223d%22%2C%0A%20%20%22unassign%22%3A%20true%2C%0A%20%20%22addLabels%22%3A%20%5B%0A%20%20%20%20%22Closed%20by%20inactivity%22%0A%20%20%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateChatAutoResolution","security":[{"apiKey":[]}],"tags":["Automatic Resolution"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"autoResolve","schema":{"type":"object","properties":{"active":{"type":"boolean","description":"Enable or disable the automatic resolution of inactive chats"},"timeframe":{"type":"string","enum":["6h","12h","24h","48h","3d","7d","14d","30d"],"description":"Inactivity after which a chat is resolved: 6h, 12h, 24h, 48h, 3d, 7d, 14d or 30d"},"includeUnanswered":{"type":"boolean","description":"Also resolve chats whose last message came from the customer and was never answered. Off by default: only chats waiting on the customer are resolved."},"onlyUnassigned":{"type":"boolean","description":"Only resolve chats with no agent assigned"},"excludeLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":10,"description":"Chats with any of these labels are never resolved"},"unassign":{"type":"boolean","description":"Unassign the agent when the chat is resolved. The department is kept."},"addLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Platform labels added to the chat when it is resolved"},"removeLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Platform labels removed from the chat when it is resolved"},"note":{"type":"object","properties":{"active":{"type":"boolean"},"text":{"type":"string","maxLength":1000}},"additionalProperties":false,"description":"Internal note left in the chat when it is resolved, only visible to the team"}},"additionalProperties":false}}],"responses":{"200":{"description":"Automatic resolution configuration updated successfully","schema":{"type":"object","properties":{"active":{"type":"boolean","description":"Enable or disable the automatic resolution of inactive chats"},"timeframe":{"type":"string","enum":["6h","12h","24h","48h","3d","7d","14d","30d"],"description":"Inactivity after which a chat is resolved: 6h, 12h, 24h, 48h, 3d, 7d, 14d or 30d"},"includeUnanswered":{"type":"boolean","description":"Also resolve chats whose last message came from the customer and was never answered. Off by default: only chats waiting on the customer are resolved."},"onlyUnassigned":{"type":"boolean","description":"Only resolve chats with no agent assigned"},"excludeLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":10,"description":"Chats with any of these labels are never resolved"},"unassign":{"type":"boolean","description":"Unassign the agent when the chat is resolved. The department is kept."},"addLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Platform labels added to the chat when it is resolved"},"removeLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Platform labels removed from the chat when it is resolved"},"note":{"type":"object","properties":{"active":{"type":"boolean"},"text":{"type":"string","maxLength":1000}},"additionalProperties":false,"description":"Internal note left in the chat when it is resolved, only visible to the team"},"available":{"type":"boolean","description":"Always true here: where it is not available the request fails with 409"},"activatedAt":{"type":"string","format":"date-time","description":"When it was last turned on. Null until then"},"updatedAt":{"type":"string","format":"date-time","description":"Null until the first change"},"updatedBy":{"type":"string","description":"ID of the user who last changed it. Null until the first change"},"stats":{"type":"object","properties":{"resolved7d":{"type":"integer","description":"Chats resolved in the last 7 days"},"lastRunAt":{"type":"string","format":"date-time","description":"Last time the number was swept. Null until then"}}}},"additionalProperties":false}},"400":{"description":"Invalid or missing body fields","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unauthorized user or missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict - invalid or unsupported feature in your plan","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Resolve chats waiting on the customer for 3 days, unassign them and label them (the label must exist on the number)\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/autoresolve \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"active\":true,\"timeframe\":\"3d\",\"unassign\":true,\"addLabels\":[\"Closed by inactivity\"]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Resolve chats waiting on the customer for 3 days, unassign them and label them (the label must exist on the number)\necho '{\"active\":true,\"timeframe\":\"3d\",\"unassign\":true,\"addLabels\":[\"Closed by inactivity\"]}' |  \\\n  http PATCH https://api.wassenger.com/v1/devices/{deviceId}/autoresolve \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Resolve chats waiting on the customer for 3 days, unassign them and label them (the label must exist on the number)\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/autoresolve';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"active\":true,\"timeframe\":\"3d\",\"unassign\":true,\"addLabels\":[\"Closed by inactivity\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Resolve chats waiting on the customer for 3 days, unassign them and label them (the label must exist on the number)\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/autoresolve',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    active: true,\n    timeframe: '3d',\n    unassign: true,\n    addLabels: ['Closed by inactivity']\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Resolve chats waiting on the customer for 3 days, unassign them and label them (the label must exist on the number)\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/autoresolve');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  active: true,\n  timeframe: '3d',\n  unassign: true,\n  addLabels: [\n    'Closed by inactivity'\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Resolve chats waiting on the customer for 3 days, unassign them and label them (the label must exist on the number)\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/autoresolve', [\n  'body' => '{\"active\":true,\"timeframe\":\"3d\",\"unassign\":true,\"addLabels\":[\"Closed by inactivity\"]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Resolve chats waiting on the customer for 3 days, unassign them and label them (the label must exist on the number)\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'active' => null,\n  'timeframe' => '3d',\n  'unassign' => null,\n  'addLabels' => [\n    'Closed by inactivity'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/autoresolve');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Resolve chats waiting on the customer for 3 days, unassign them and label them (the label must exist on the number)\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/autoresolve\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'active' => null,\n    'timeframe' => '3d',\n    'unassign' => null,\n    'addLabels' => [\n        'Closed by inactivity'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Resolve chats waiting on the customer for 3 days, unassign them and label them (the label must exist on the number)\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/autoresolve\"\n\npayload = {\n    \"active\": True,\n    \"timeframe\": \"3d\",\n    \"unassign\": True,\n    \"addLabels\": [\"Closed by inactivity\"]\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Resolve chats waiting on the customer for 3 days, unassign them and label them (the label must exist on the number)\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/autoresolve';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"active\":true,\"timeframe\":\"3d\",\"unassign\":true,\"addLabels\":[\"Closed by inactivity\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Resolve chats waiting on the customer for 3 days, unassign them and label them (the label must exist on the number)\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/autoresolve',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"active\":true,\"timeframe\":\"3d\",\"unassign\":true,\"addLabels\":[\"Closed by inactivity\"]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Resolve chats waiting on the customer for 3 days, unassign them and label them (the label must exist on the number)\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/autoresolve\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"active\\\":true,\\\"timeframe\\\":\\\"3d\\\",\\\"unassign\\\":true,\\\"addLabels\\\":[\\\"Closed by inactivity\\\"]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Resolve chats waiting on the customer for 3 days, unassign them and label them (the label must exist on the number)\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/autoresolve\"\n\n\tpayload := strings.NewReader(\"{\\\"active\\\":true,\\\"timeframe\\\":\\\"3d\\\",\\\"unassign\\\":true,\\\"addLabels\\\":[\\\"Closed by inactivity\\\"]}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Resolve chats waiting on the customer for 3 days, unassign them and label them (the label must exist on the number)\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/autoresolve\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"active\\\":true,\\\"timeframe\\\":\\\"3d\\\",\\\"unassign\\\":true,\\\"addLabels\\\":[\\\"Closed by inactivity\\\"]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Resolve chats waiting on the customer for 3 days, unassign them and label them (the label must exist on the number)\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/autoresolve\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"active\\\":true,\\\"timeframe\\\":\\\"3d\\\",\\\"unassign\\\":true,\\\"addLabels\\\":[\\\"Closed by inactivity\\\"]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Resolve chats waiting on the customer for 3 days, unassign them and label them (the label must exist on the number)\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/devices/{deviceId}/autoresolve\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"active\\\":true,\\\"timeframe\\\":\\\"3d\\\",\\\"unassign\\\":true,\\\"addLabels\\\":[\\\"Closed by inactivity\\\"]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Resolve chats waiting on the customer for 3 days, unassign them and label them (the label must exist on the number)\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"active\\\":true,\\\"timeframe\\\":\\\"3d\\\",\\\"unassign\\\":true,\\\"addLabels\\\":[\\\"Closed by inactivity\\\"]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/autoresolve\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Resolve chats waiting on the customer for 3 days, unassign them and label them (the label must exist on the number)\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/autoresolve\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"active\\\":true,\\\"timeframe\\\":\\\"3d\\\",\\\"unassign\\\":true,\\\"addLabels\\\":[\\\"Closed by inactivity\\\"]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Resolve chats waiting on the customer for 3 days, unassign them and label them (the label must exist on the number)\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/autoresolve' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"active\":true,\"timeframe\":\"3d\",\"unassign\":true,\"addLabels\":[\"Closed by inactivity\"]}'"},{"lang":"ObjC","source":"// Resolve chats waiting on the customer for 3 days, unassign them and label them (the label must exist on the number)\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"active\": @YES,\n                              @\"timeframe\": @\"3d\",\n                              @\"unassign\": @YES,\n                              @\"addLabels\": @[ @\"Closed by inactivity\" ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/autoresolve\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Resolve chats waiting on the customer for 3 days, unassign them and label them (the label must exist on the number)\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"active\": true,\n  \"timeframe\": \"3d\",\n  \"unassign\": true,\n  \"addLabels\": [\"Closed by inactivity\"]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/autoresolve\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/autoreplies":{"parameters":[],"get":{"summary":"Get auto replies","description":"Get automatic replies configuration for the specific WhatsApp number.\n\n\n\n**Types of automatic replies**:\n\n\n\n- **welcome**: send message when a new contact starts a conversation with your number.\n\n- **away**: send message when a user send you a message outside week day business opening hours.\n\n- **busy**: send message if your team is busy and can't reply smoothly enough, based on a pre-defined timeframe, e.g: 5 minutes. Requires a Business or Enterprise plan.\n\n- **follow**: send a follow up message to chats after a specific time frame or conditions. Requires a Business or Enterprise plan.\n\n- **call**: send an automatic message when an incoming call is received in order to inform users that you may not accept voice calls. Requires a Business or Enterprise plan.\n\n\n\nAutomatic replies are managed outside the WhatsApp app, therefore it works with both WhatsApp Personal and Business numbers.\n\n\n\nIf you use a WhatsApp Business number, you should double-check that automatic replies in the app have been disabled, otherwise your number may send duplicate responses and other undesired scenarios.\n\n\n\n**Important**: automatic replies feature is only available for numbers using a Platform plan (send & receive messages).\n\nOtherwise, it will return a `403 - Forbidden` response status.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fautoreplies)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getAutoReplies","security":[{"apiKey":[]}],"tags":["Automatic Replies"],"responses":{"200":{"description":"Automatic replies configuration","schema":{"type":"object","properties":{"welcome":{"type":"object","properties":{"active":{"type":"boolean","description":"Enable or disable welcome automatic reply message"},"message":{"type":"string","maxLength":3000,"minLength":0,"description":"Message to be sent as welcome automatic reply, up to 3000 characters."},"file":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Optional image file ID (24 hexadecimal characters) to be sent as automatic reply. The image file must be already uploaded to the system. Only images can be sent as automatic replies, up to 2 MB of file size. Leave it out to keep the current image. To remove it, send `null` or list `file` in `remove`."},"target":{"type":"string","enum":["all","new_contacts"],"description":"Optional target for the welcome message: use `all` to reply to any new chat, or use `new_contacts` to reply only to new chats started by numbers that are not in your contacts agenda.","default":"all"},"timeframe":{"type":"string","enum":["24h","2d","3d","7d","14d","30d","60d"],"description":"Optional timeframe for the welcome message: use `14d` to send the welcome message in chats that had no previous messages in the last 14 days, or use a different time frame based on the available options.","default":"14d"},"setLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Optional list of chat labels to add when a chat is automatically replied."},"skipResolved":{"type":"boolean","description":"Optional flag to skip sending the welcome message to chats that have been resolved. Resolved chats are chats that have been closed by the user or by the system."},"skipAssigned":{"type":"boolean","description":"Optional flag to skip sending the welcome message to chats that have been assigned to an agent and have not been resolved, removed or blocked. Assigned chats are chats that have been assigned to an agent by the system or by an agent manually."},"skipNumbers":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":0,"maxItems":100,"description":"Optional list of phone numbers to be ignored when sending the welcome message. The phone number must be in E.164 format, for example: +16001234560"},"form":{"type":"object","properties":{"flowId":{"type":"string","pattern":"^\\d{5,}$","description":"ID Meta gives the WhatsApp Form (numeric)"},"cta":{"type":"string","minLength":1,"maxLength":30,"description":"Text of the button that opens the form, up to 30 characters"},"screen":{"type":"string","maxLength":100,"description":"Screen to open. Leave it out to open the first one."}},"required":["flowId","cta"],"additionalProperties":false,"description":"Optional: send the reply as a WhatsApp Form, with the message as the text above its button (official numbers only, up to 1024 characters, no image). Send `null` to stop."},"remove":{"type":"array","items":{"type":"string","enum":["file","form"]},"maxItems":10,"description":"Optionally remove values for the specified fields. E.g: `file`, `form`"}},"required":["active"],"additionalProperties":false,"description":"Configure an automatic reply as welcome message for users contacting you the first time, or when they did not contact you in a while based on the configured timeframe. E.g: 7 days.\n\n**Note**: if you are using WhatsApp Business, please make sure you have disabled the automatic replies on the WhatsApp app, otherwise you may experience conflicts sending automatic replies."},"away":{"type":"object","properties":{"active":{"type":"boolean","description":"Enable or disable away automatic reply message"},"message":{"type":"string","maxLength":3000,"minLength":5,"description":"Message to be sent as away automatic reply, up to 3000 characters."},"file":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Optional image file ID (24 hexadecimal characters) to be sent as automatic reply. The image file must be already uploaded to the system. Only images can be sent as automatic replies, up to 2 MB of file size. Leave it out to keep the current image. To remove it, send `null` or list `file` in `remove`."},"target":{"type":"string","enum":["all","new_contacts"],"description":"Optional target for the away message: use `all` to reply to any new chat, or use `new_contacts` to reply only to new chats started by numbers that are not in your contacts agenda.","default":"all"},"skipPending":{"type":"boolean","description":"Optional flag to skip sending the away message to pending chats (not yet replied, not assigned and not resolved chats)."},"skipResolved":{"type":"boolean","description":"Optional flag to skip sending the welcome message to chats that have been resolved. Resolved chats are chats that have been closed by the user or by the system."},"skipAssigned":{"type":"boolean","description":"Optional flag to skip sending the welcome message to chats that have been assigned to an agent and have not been resolved, removed or blocked. Assigned chats are chats that have been assigned to an agent by the system or by an agent manually."},"skipNumbers":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":0,"maxItems":100,"description":"Optional list of phone numbers to be ignored when sending the welcome message. The phone number must be in E.164 format, for example: +16001234560"},"timezone":{"type":"string","minLength":2,"maxLength":40,"enum":["Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmara","Africa/Asmera","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Timbuktu","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/ComodRivadavia","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Aruba","America/Asuncion","America/Atikokan","America/Atka","America/Bahia","America/Bahia_Banderas","America/Barbados","America/Belem","America/Belize","America/Blanc-Sablon","America/Boa_Vista","America/Bogota","America/Boise","America/Buenos_Aires","America/Cambridge_Bay","America/Campo_Grande","America/Cancun","America/Caracas","America/Catamarca","America/Cayenne","America/Cayman","America/Chicago","America/Chihuahua","America/Ciudad_Juarez","America/Coral_Harbour","America/Cordoba","America/Costa_Rica","America/Coyhaique","America/Creston","America/Cuiaba","America/Curacao","America/Danmarkshavn","America/Dawson","America/Dawson_Creek","America/Denver","America/Detroit","America/Dominica","America/Edmonton","America/Eirunepe","America/El_Salvador","America/Ensenada","America/Fort_Nelson","America/Fort_Wayne","America/Fortaleza","America/Glace_Bay","America/Godthab","America/Goose_Bay","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guatemala","America/Guayaquil","America/Guyana","America/Halifax","America/Havana","America/Hermosillo","America/Indiana/Indianapolis","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Indianapolis","America/Inuvik","America/Iqaluit","America/Jamaica","America/Jujuy","America/Juneau","America/Kentucky/Louisville","America/Kentucky/Monticello","America/Knox_IN","America/Kralendijk","America/La_Paz","America/Lima","America/Los_Angeles","America/Louisville","America/Lower_Princes","America/Maceio","America/Managua","America/Manaus","America/Marigot","America/Martinique","America/Matamoros","America/Mazatlan","America/Mendoza","America/Menominee","America/Merida","America/Metlakatla","America/Mexico_City","America/Miquelon","America/Moncton","America/Monterrey","America/Montevideo","America/Montreal","America/Montserrat","America/Nassau","America/New_York","America/Nipigon","America/Nome","America/Noronha","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Nuuk","America/Ojinaga","America/Panama","America/Pangnirtung","America/Paramaribo","America/Phoenix","America/Port-au-Prince","America/Port_of_Spain","America/Porto_Acre","America/Porto_Velho","America/Puerto_Rico","America/Punta_Arenas","America/Rainy_River","America/Rankin_Inlet","America/Recife","America/Regina","America/Resolute","America/Rio_Branco","America/Rosario","America/Santa_Isabel","America/Santarem","America/Santiago","America/Santo_Domingo","America/Sao_Paulo","America/Scoresbysund","America/Shiprock","America/Sitka","America/St_Barthelemy","America/St_Johns","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Swift_Current","America/Tegucigalpa","America/Thule","America/Thunder_Bay","America/Tijuana","America/Toronto","America/Tortola","America/Vancouver","America/Virgin","America/Whitehorse","America/Winnipeg","America/Yakutat","America/Yellowknife","Antarctica/Casey","Antarctica/Davis","Antarctica/DumontDUrville","Antarctica/Macquarie","Antarctica/Mawson","Antarctica/McMurdo","Antarctica/Palmer","Antarctica/Rothera","Antarctica/South_Pole","Antarctica/Syowa","Antarctica/Troll","Antarctica/Vostok","Arctic/Longyearbyen","Asia/Aden","Asia/Almaty","Asia/Amman","Asia/Anadyr","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Ashkhabad","Asia/Atyrau","Asia/Baghdad","Asia/Bahrain","Asia/Baku","Asia/Bangkok","Asia/Barnaul","Asia/Beirut","Asia/Bishkek","Asia/Brunei","Asia/Calcutta","Asia/Chita","Asia/Choibalsan","Asia/Chongqing","Asia/Chungking","Asia/Colombo","Asia/Dacca","Asia/Damascus","Asia/Dhaka","Asia/Dili","Asia/Dubai","Asia/Dushanbe","Asia/Famagusta","Asia/Gaza","Asia/Harbin","Asia/Hebron","Asia/Ho_Chi_Minh","Asia/Hong_Kong","Asia/Hovd","Asia/Irkutsk","Asia/Istanbul","Asia/Jakarta","Asia/Jayapura","Asia/Jerusalem","Asia/Kabul","Asia/Kamchatka","Asia/Karachi","Asia/Kashgar","Asia/Kathmandu","Asia/Katmandu","Asia/Khandyga","Asia/Kolkata","Asia/Krasnoyarsk","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Kuwait","Asia/Macao","Asia/Macau","Asia/Magadan","Asia/Makassar","Asia/Manila","Asia/Muscat","Asia/Nicosia","Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk","Asia/Oral","Asia/Phnom_Penh","Asia/Pontianak","Asia/Pyongyang","Asia/Qatar","Asia/Qostanay","Asia/Qyzylorda","Asia/Rangoon","Asia/Riyadh","Asia/Saigon","Asia/Sakhalin","Asia/Samarkand","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Srednekolymsk","Asia/Taipei","Asia/Tashkent","Asia/Tbilisi","Asia/Tehran","Asia/Tel_Aviv","Asia/Thimbu","Asia/Thimphu","Asia/Tokyo","Asia/Tomsk","Asia/Ujung_Pandang","Asia/Ulaanbaatar","Asia/Ulan_Bator","Asia/Urumqi","Asia/Ust-Nera","Asia/Vientiane","Asia/Vladivostok","Asia/Yakutsk","Asia/Yangon","Asia/Yekaterinburg","Asia/Yerevan","Atlantic/Azores","Atlantic/Bermuda","Atlantic/Canary","Atlantic/Cape_Verde","Atlantic/Faeroe","Atlantic/Faroe","Atlantic/Jan_Mayen","Atlantic/Madeira","Atlantic/Reykjavik","Atlantic/South_Georgia","Atlantic/St_Helena","Atlantic/Stanley","Australia/ACT","Australia/Adelaide","Australia/Brisbane","Australia/Broken_Hill","Australia/Canberra","Australia/Currie","Australia/Darwin","Australia/Eucla","Australia/Hobart","Australia/LHI","Australia/Lindeman","Australia/Lord_Howe","Australia/Melbourne","Australia/NSW","Australia/North","Australia/Perth","Australia/Queensland","Australia/South","Australia/Sydney","Australia/Tasmania","Australia/Victoria","Australia/West","Australia/Yancowinna","Brazil/Acre","Brazil/DeNoronha","Brazil/East","Brazil/West","CET","CST6CDT","Canada/Atlantic","Canada/Central","Canada/Eastern","Canada/Mountain","Canada/Newfoundland","Canada/Pacific","Canada/Saskatchewan","Canada/Yukon","Chile/Continental","Chile/EasterIsland","Cuba","EET","EST","EST5EDT","Egypt","Eire","Etc/GMT","Etc/GMT+0","Etc/GMT+1","Etc/GMT+10","Etc/GMT+11","Etc/GMT+12","Etc/GMT+2","Etc/GMT+3","Etc/GMT+4","Etc/GMT+5","Etc/GMT+6","Etc/GMT+7","Etc/GMT+8","Etc/GMT+9","Etc/GMT-0","Etc/GMT-1","Etc/GMT-10","Etc/GMT-11","Etc/GMT-12","Etc/GMT-13","Etc/GMT-14","Etc/GMT-2","Etc/GMT-3","Etc/GMT-4","Etc/GMT-5","Etc/GMT-6","Etc/GMT-7","Etc/GMT-8","Etc/GMT-9","Etc/GMT0","Etc/Greenwich","Etc/UCT","Etc/UTC","Etc/Universal","Etc/Zulu","Europe/Amsterdam","Europe/Andorra","Europe/Astrakhan","Europe/Athens","Europe/Belfast","Europe/Belgrade","Europe/Berlin","Europe/Bratislava","Europe/Brussels","Europe/Bucharest","Europe/Budapest","Europe/Busingen","Europe/Chisinau","Europe/Copenhagen","Europe/Dublin","Europe/Gibraltar","Europe/Guernsey","Europe/Helsinki","Europe/Isle_of_Man","Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kiev","Europe/Kirov","Europe/Kyiv","Europe/Lisbon","Europe/Ljubljana","Europe/London","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Mariehamn","Europe/Minsk","Europe/Monaco","Europe/Moscow","Europe/Nicosia","Europe/Oslo","Europe/Paris","Europe/Podgorica","Europe/Prague","Europe/Riga","Europe/Rome","Europe/Samara","Europe/San_Marino","Europe/Sarajevo","Europe/Saratov","Europe/Simferopol","Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Tiraspol","Europe/Ulyanovsk","Europe/Uzhgorod","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw","Europe/Zagreb","Europe/Zaporozhye","Europe/Zurich","GB","GB-Eire","GMT","GMT+0","GMT-0","GMT0","Greenwich","HST","Hongkong","Iceland","Indian/Antananarivo","Indian/Chagos","Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives","Indian/Mauritius","Indian/Mayotte","Indian/Reunion","Iran","Israel","Jamaica","Japan","Kwajalein","Libya","MET","MST","MST7MDT","Mexico/BajaNorte","Mexico/BajaSur","Mexico/General","NZ","NZ-CHAT","Navajo","PRC","PST8PDT","Pacific/Apia","Pacific/Auckland","Pacific/Bougainville","Pacific/Chatham","Pacific/Chuuk","Pacific/Easter","Pacific/Efate","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Fiji","Pacific/Funafuti","Pacific/Galapagos","Pacific/Gambier","Pacific/Guadalcanal","Pacific/Guam","Pacific/Honolulu","Pacific/Johnston","Pacific/Kanton","Pacific/Kiritimati","Pacific/Kosrae","Pacific/Kwajalein","Pacific/Majuro","Pacific/Marquesas","Pacific/Midway","Pacific/Nauru","Pacific/Niue","Pacific/Norfolk","Pacific/Noumea","Pacific/Pago_Pago","Pacific/Palau","Pacific/Pitcairn","Pacific/Pohnpei","Pacific/Ponape","Pacific/Port_Moresby","Pacific/Rarotonga","Pacific/Saipan","Pacific/Samoa","Pacific/Tahiti","Pacific/Tarawa","Pacific/Tongatapu","Pacific/Truk","Pacific/Wake","Pacific/Wallis","Pacific/Yap","Poland","Portugal","ROC","ROK","Singapore","Turkey","UCT","US/Alaska","US/Aleutian","US/Arizona","US/Central","US/East-Indiana","US/Eastern","US/Hawaii","US/Indiana-Starke","US/Michigan","US/Mountain","US/Pacific","US/Samoa","UTC","Universal","W-SU","WET","Zulu"],"description":"Local time zone to be applied to the opening business hours per week day. If not defined, the account time zone configuration will be used by default."},"useBusinessProfile":{"type":"boolean","description":"Use the WhatsApp Business profile opening hours synced information. This option can only be used if the connected number is WhatsApp Business. In case there is no opening hours profile information, the 24 hours open policy will be applied."},"businessHours":{"type":"object","properties":{"monday":{"type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for automatic replies in the current week day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_open"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2,"description":"Business opening and close hours per week day. You can define one or two hours ranges per day. E.g: 9am - 1pm and 3pm - 7pm"}},"additionalProperties":false},"tuesday":{"type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for automatic replies in the current week day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_open"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2,"description":"Business opening and close hours per week day. You can define one or two hours ranges per day. E.g: 9am - 1pm and 3pm - 7pm"}},"additionalProperties":false},"wednesday":{"type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for automatic replies in the current week day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_open"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2,"description":"Business opening and close hours per week day. You can define one or two hours ranges per day. E.g: 9am - 1pm and 3pm - 7pm"}},"additionalProperties":false},"thursday":{"type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for automatic replies in the current week day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_open"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2,"description":"Business opening and close hours per week day. You can define one or two hours ranges per day. E.g: 9am - 1pm and 3pm - 7pm"}},"additionalProperties":false},"friday":{"type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for automatic replies in the current week day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_open"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2,"description":"Business opening and close hours per week day. You can define one or two hours ranges per day. E.g: 9am - 1pm and 3pm - 7pm"}},"additionalProperties":false},"saturday":{"type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for automatic replies in the current week day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_open"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2,"description":"Business opening and close hours per week day. You can define one or two hours ranges per day. E.g: 9am - 1pm and 3pm - 7pm"}},"additionalProperties":false},"sunday":{"type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for automatic replies in the current week day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_open"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2,"description":"Business opening and close hours per week day. You can define one or two hours ranges per day. E.g: 9am - 1pm and 3pm - 7pm"}},"additionalProperties":false}},"additionalProperties":false},"labels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":10,"description":"Optional list of chat labels that chats should have (at least one label match) in order to send the away automatic reply message to the user."},"setLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Optional list of chat labels to add when a chat is automatically replied."},"exceptions":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","maxLength":40,"description":"Day of the exception on the device clock, the away `timezone`. Send it as a calendar day, the way it is returned: `YYYY-MM-DD`, or `MM-DD` for a yearly exception. An ISO 8601 date-time is also accepted: only its calendar day in the away `timezone` counts, so send a time well inside that day, such as noon with its UTC offset. Examples: `2026-11-08`, `12-25`, `2026-12-25T12:00:00-06:00`."},"yearly":{"type":"boolean","description":"Whether the exception repeats every year on the same month and day (`true`), as fixed holidays do, or applies on that exact date only (`false`), as movable holidays need. When left out, a `YYYY-MM-DD` date applies on that date only, and an `MM-DD` date or a date-time repeats every year. A one-off date is no longer returned once its day is over, and is dropped on the next update."},"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for the exceptional day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_closed"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2}},"additionalProperties":false},"minItems":0,"maxItems":20,"description":"Optional list of exceptions to the opening business hours per week day that can be holidays, national festivities or special 24h opening days."},"form":{"type":"object","properties":{"flowId":{"type":"string","pattern":"^\\d{5,}$","description":"ID Meta gives the WhatsApp Form (numeric)"},"cta":{"type":"string","minLength":1,"maxLength":30,"description":"Text of the button that opens the form, up to 30 characters"},"screen":{"type":"string","maxLength":100,"description":"Screen to open. Leave it out to open the first one."}},"required":["flowId","cta"],"additionalProperties":false,"description":"Optional: send the reply as a WhatsApp Form, with the message as the text above its button (official numbers only, up to 1024 characters, no image). Send `null` to stop."},"remove":{"type":"array","items":{"type":"string","enum":["file","form"]},"maxItems":10,"description":"Optionally remove values for the specified fields. E.g: `file`, `form`"}},"required":["active","message"],"additionalProperties":false,"description":"Configure an automatic reply for away hours/days when you are out of business hours. You can configure the week days and opening hours in which your team is available. Any user contacting outside the configured business hours will receive an automatic message.\n\n**Note**: if you are using WhatsApp Business, please make sure you have disabled the automatic replies on the WhatsApp app, otherwise you may experience conflicts sending automatic replies."},"busy":{"type":"object","properties":{"active":{"type":"boolean","description":"Enable or disable busy times automatic reply message"},"message":{"type":"string","maxLength":3000,"minLength":0,"description":"Message to be sent as busy times automatic reply, up to 3000 characters."},"file":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Optional image file ID (24 hexadecimal characters) to be sent as automatic reply. The image file must be already uploaded to the system. Only images can be sent as automatic replies, up to 2 MB of file size. Leave it out to keep the current image. To remove it, send `null` or list `file` in `remove`."},"target":{"type":"string","enum":["all","new_contacts"],"description":"Optional target for the busy times message: use `all` to reply to any new chat, or use `new_contacts` to reply only to new chats started by numbers that are not in your contacts agenda.","default":"all"},"timeframe":{"type":"string","enum":["3m","5m","10m","15m","20m","30m"],"description":"Optional timeframe for the busy times message: use `5m` to send the busy times message in chats that were not replied in the last 5 minutes after the last message, or use a different time frame based on the available options.","default":"5m"},"setLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Optional list of chat labels to add when a chat is automatically replied."},"skipPending":{"type":"boolean","description":"Optional flag to skip sending the busy times message to pending chats (not yet replied, not assigned and not resolved chats)."},"skipResolved":{"type":"boolean","description":"Optional flag to skip sending the busy times message to chats that have been resolved. Resolved chats are chats that have been closed by the user or by the system."},"skipAssigned":{"type":"boolean","description":"Optional flag to skip sending the busy times message to chats that have been assigned to an agent and have not been resolved, removed or blocked. Assigned chats are chats that have been assigned to an agent by the system or by an agent manually."},"skipNumbers":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":0,"maxItems":100,"description":"Optional list of phone numbers to be ignored when sending the welcome message. The phone number must be in E.164 format, for example: +16001234560"},"form":{"type":"object","properties":{"flowId":{"type":"string","pattern":"^\\d{5,}$","description":"ID Meta gives the WhatsApp Form (numeric)"},"cta":{"type":"string","minLength":1,"maxLength":30,"description":"Text of the button that opens the form, up to 30 characters"},"screen":{"type":"string","maxLength":100,"description":"Screen to open. Leave it out to open the first one."}},"required":["flowId","cta"],"additionalProperties":false,"description":"Optional: send the reply as a WhatsApp Form, with the message as the text above its button (official numbers only, up to 1024 characters, no image). Send `null` to stop."},"remove":{"type":"array","items":{"type":"string","enum":["file","form"]},"maxItems":10,"description":"Optionally remove values for the specified fields. E.g: `file`, `form`"}},"required":["active"],"additionalProperties":false,"description":"Configure an automatic reply for busy times when your team needs more time to reply to new chats. You can configure the timeframe in minutes on which the busy times message if no one can reply to the new chat before that timeframe, e.g. 5 minutes.\n\n**Note**: busy times automatic reply is only available in Business and Enterprise plans"},"follow":{"type":"array","items":{"type":"object","properties":{"alias":{"type":"string","maxLength":100,"minLength":1,"description":"Required follow up message internal alias that helps identifing it easily"},"active":{"type":"boolean","description":"Enable or disable follow up automatic reply message"},"message":{"type":"string","maxLength":3000,"minLength":5,"description":"Message to be sent as welcome automatic reply, up to 3000 characters."},"file":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Optional image file ID (24 hexadecimal characters) to be sent as automatic reply. The image file must be already uploaded to the system. Only images can be sent as automatic replies, up to 2 MB of file size. Leave it out to keep the current image. To remove it, send `null` or list `file` in `remove`."},"timeframe":{"type":"string","enum":["1h","2h","3h","4h","24h","2d","7d"],"description":"Optional timeframe for the follow up message: use `24h` to send a follow up message in chats that had no activity in the last 24 hours, or use a different time frame based on the available options."},"labels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Optional list of chat labels that chats should have (at least one label match) in order to send a follow up automatic message to the user."},"setLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Optional list of chat labels to add when a chat is automatically replied."},"skipPending":{"type":"boolean","description":"Optional flag to skip sending the follow up message to pending chats (not yet replied, not assigned and not resolved chats)."},"skipAssigned":{"type":"boolean","description":"Optional flag to skip sending the follow up message to chats that have been assigned to an agent and have not been resolved, removed or blocked. Assigned chats are chats that have been assigned to an agent by the system or by an agent manually."},"skipResolved":{"type":"boolean","description":"Optional flag to skip sending the follow up message to chats that have been assigned to an agent and have not been resolved, removed or blocked. Assigned chats are chats that have been assigned to an agent by the system or by an agent manually."},"skipNumbers":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":0,"maxItems":100,"description":"Optional list of phone numbers to be ignored when sending the welcome message. The phone number must be in E.164 format, for example: +16001234560"},"form":{"type":"object","properties":{"flowId":{"type":"string","pattern":"^\\d{5,}$","description":"ID Meta gives the WhatsApp Form (numeric)"},"cta":{"type":"string","minLength":1,"maxLength":30,"description":"Text of the button that opens the form, up to 30 characters"},"screen":{"type":"string","maxLength":100,"description":"Screen to open. Leave it out to open the first one."}},"required":["flowId","cta"],"additionalProperties":false,"description":"Optional: send the reply as a WhatsApp Form, with the message as the text above its button (official numbers only, up to 1024 characters, no image). Send `null` to stop."},"remove":{"type":"array","items":{"type":"string","enum":["file","form"]},"maxItems":10,"description":"Optionally remove values for the specified fields. E.g: `file`, `form`"}},"required":["active","message"],"additionalProperties":false},"maxItems":1,"description":"Configure an automatic reply for follow up messages when you would like to update the customer or gather feedback from the user. You can configure the timeframe on which the follow up message will be sent if no message was exchanged during that timefram. E.g. 24 hours.\n\n**Note**: follow up automatic reply is only available in Business and Enterprise plans"},"call":{"type":"object","properties":{"active":{"type":"boolean","description":"Enable or disable call automatic reply message"},"message":{"type":"string","maxLength":3000,"minLength":5,"description":"Message to be sent as welcome automatic reply, up to 3000 characters."},"file":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Optional image file ID (24 hexadecimal characters) to be sent as automatic reply. The image file must be already uploaded to the system. Only images can be sent as automatic replies, up to 2 MB of file size. Leave it out to keep the current image. To remove it, send `null` or list `file` in `remove`."},"reject":{"type":"boolean","description":"Set to `true` in order to reject all calls automatically."},"setLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Optional list of chat labels to add when a chat is automatically replied."},"skipNumbers":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":0,"maxItems":100,"description":"Optional list of phone numbers to be ignored when sending the welcome message. The phone number must be in E.164 format, for example: +16001234560"},"remove":{"type":"array","items":{"type":"string","enum":["file","form"]},"maxItems":10,"description":"Optionally remove values for the specified fields. E.g: `file`, `form`"}},"required":["active","message","reject"],"additionalProperties":false,"description":"Configure an automatic reply for incoming calls in order to notify the user that you do not accept voice calls and provide useful information about alternative ways to communicate. **Note**: call automatic reply is only available in Business and Enterprise plans"}},"additionalProperties":false}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unauthorized user or missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Feature not available in current plan","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get auto replies configuration for the current WhatsApp number\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/autoreplies \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get auto replies configuration for the current WhatsApp number\nhttp GET https://api.wassenger.com/v1/devices/{deviceId}/autoreplies \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get auto replies configuration for the current WhatsApp number\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/autoreplies';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get auto replies configuration for the current WhatsApp number\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/autoreplies',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get auto replies configuration for the current WhatsApp number\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/autoreplies');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get auto replies configuration for the current WhatsApp number\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/autoreplies', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get auto replies configuration for the current WhatsApp number\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/autoreplies');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get auto replies configuration for the current WhatsApp number\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/autoreplies\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get auto replies configuration for the current WhatsApp number\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/autoreplies\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get auto replies configuration for the current WhatsApp number\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/autoreplies';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get auto replies configuration for the current WhatsApp number\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/autoreplies',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get auto replies configuration for the current WhatsApp number\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/autoreplies\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get auto replies configuration for the current WhatsApp number\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/autoreplies\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get auto replies configuration for the current WhatsApp number\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/autoreplies\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get auto replies configuration for the current WhatsApp number\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/autoreplies\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get auto replies configuration for the current WhatsApp number\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/autoreplies\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get auto replies configuration for the current WhatsApp number\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/autoreplies\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get auto replies configuration for the current WhatsApp number\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/autoreplies\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get auto replies configuration for the current WhatsApp number\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/autoreplies' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get auto replies configuration for the current WhatsApp number\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/autoreplies\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get auto replies configuration for the current WhatsApp number\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/autoreplies\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Update auto replies","description":"Update automatic replies configuration for the current WhatsApp number.\n\n\n\n**Types of automatic replies**:\n\n\n\n- **welcome**: send message when a new contact starts a conversation with your number.\n\n- **away**: send message when a user send you a message outside week day business opening hours.\n\n- **busy**: send message if your team is busy and can't reply smoothly enough, based on a pre-defined timeframe, e.g: 5 minutes. Requires a Business or Enterprise plan.\n\n- **follow**: send a follow up message to chats after a specific time frame or conditions. Requires a Business or Enterprise plan.\n\n- **call**: send an automatic message when an incoming call is received in order to inform users that you may not accept voice calls. Requires a Business or Enterprise plan.\n\n\n\nAutomatic replies are managed outside the WhatsApp app, therefore it works with both WhatsApp Personal and Business numbers.\n\n\n\nIf you use a WhatsApp Business number, you should double-check that automatic replies in the app have been disabled, otherwise your number may send duplicate responses and other undesired scenarios.\n\n\n\n**Important**: automatic replies feature is only available for numbers using a Platform plan (send & receive messages).\n\nOtherwise, it will return a `403 - Forbidden` response status.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fautoreplies&method=PATCH&body=%7B%0A%20%20%22welcome%22%3A%20%7B%0A%20%20%20%20%22active%22%3A%20true%2C%0A%20%20%20%20%22message%22%3A%20%22This%20is%20an%20automatic%20reply%20sample%20message.%20See%20you%20soon!%22%0A%20%20%7D%2C%0A%20%20%22away%22%3A%20%7B%0A%20%20%20%20%22active%22%3A%20true%2C%0A%20%20%20%20%22message%22%3A%20%22Our%20team%20is%20not%20available%20at%20this%20time%2C%20please%20get%20in%20touch%20later.%22%2C%0A%20%20%20%20%22businessHours%22%3A%20%7B%0A%20%20%20%20%20%20%22monday%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22mode%22%3A%20%22hours%22%2C%0A%20%20%20%20%20%20%20%20%22hours%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22open%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22hour%22%3A%209%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22minute%22%3A%200%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22close%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22hour%22%3A%2019%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22minute%22%3A%2030%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%22tuesday%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22mode%22%3A%20%22hours%22%2C%0A%20%20%20%20%20%20%20%20%22hours%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22open%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22hour%22%3A%209%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22minute%22%3A%200%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22close%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22hour%22%3A%2019%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22minute%22%3A%2030%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%22wednesday%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22mode%22%3A%20%22hours%22%2C%0A%20%20%20%20%20%20%20%20%22hours%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22open%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22hour%22%3A%209%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22minute%22%3A%200%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22close%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22hour%22%3A%2019%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22minute%22%3A%2030%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%22thursday%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22mode%22%3A%20%22hours%22%2C%0A%20%20%20%20%20%20%20%20%22hours%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22open%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22hour%22%3A%209%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22minute%22%3A%200%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22close%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22hour%22%3A%2021%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22minute%22%3A%200%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%22friday%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22mode%22%3A%20%22hours%22%2C%0A%20%20%20%20%20%20%20%20%22hours%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22open%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22hour%22%3A%209%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22minute%22%3A%2030%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22close%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22hour%22%3A%2020%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22minute%22%3A%2030%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%22saturday%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22mode%22%3A%20%2224h_closed%22%0A%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%22sunday%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22mode%22%3A%20%2224h_closed%22%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%7D%2C%0A%20%20%22follow%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22active%22%3A%20false%2C%0A%20%20%20%20%20%20%22message%22%3A%20%22Hi%20again!%20Is%20there%20anything%20else%20we%20can%20help%20you%20with%3F%22%0A%20%20%20%20%7D%0A%20%20%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateAutoReplies","security":[{"apiKey":[]}],"tags":["Automatic Replies"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"autoReplies","schema":{"type":"object","properties":{"welcome":{"type":"object","properties":{"active":{"type":["boolean","null"],"description":"Enable or disable welcome automatic reply message"},"message":{"type":["string","null"],"maxLength":3000,"minLength":0,"description":"Message to be sent as welcome automatic reply, up to 3000 characters."},"file":{"type":["string","null"],"pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Optional image file ID (24 hexadecimal characters) to be sent as automatic reply. The image file must be already uploaded to the system. Only images can be sent as automatic replies, up to 2 MB of file size. Leave it out to keep the current image. To remove it, send `null` or list `file` in `remove`."},"target":{"type":"string","enum":["all","new_contacts"],"description":"Optional target for the welcome message: use `all` to reply to any new chat, or use `new_contacts` to reply only to new chats started by numbers that are not in your contacts agenda.","default":"all"},"timeframe":{"type":"string","enum":["24h","2d","3d","7d","14d","30d","60d"],"description":"Optional timeframe for the welcome message: use `14d` to send the welcome message in chats that had no previous messages in the last 14 days, or use a different time frame based on the available options.","default":"14d"},"setLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Optional list of chat labels to add when a chat is automatically replied."},"skipResolved":{"type":"boolean","description":"Optional flag to skip sending the welcome message to chats that have been resolved. Resolved chats are chats that have been closed by the user or by the system."},"skipAssigned":{"type":"boolean","description":"Optional flag to skip sending the welcome message to chats that have been assigned to an agent and have not been resolved, removed or blocked. Assigned chats are chats that have been assigned to an agent by the system or by an agent manually."},"skipNumbers":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":0,"maxItems":100,"description":"Optional list of phone numbers to be ignored when sending the welcome message. The phone number must be in E.164 format, for example: +16001234560"},"form":{"type":["object","null"],"properties":{"flowId":{"type":"string","pattern":"^\\d{5,}$","description":"ID Meta gives the WhatsApp Form (numeric)"},"cta":{"type":"string","minLength":1,"maxLength":30,"description":"Text of the button that opens the form, up to 30 characters"},"screen":{"type":"string","maxLength":100,"description":"Screen to open. Leave it out to open the first one."}},"required":["flowId","cta"],"additionalProperties":false,"description":"Optional: send the reply as a WhatsApp Form, with the message as the text above its button (official numbers only, up to 1024 characters, no image). Send `null` to stop."},"remove":{"type":"array","items":{"type":"string","enum":["file","form"]},"maxItems":10,"description":"Optionally remove values for the specified fields. E.g: `file`, `form`"}},"required":["active"],"additionalProperties":false,"description":"Configure an automatic reply as welcome message for users contacting you the first time, or when they did not contact you in a while based on the configured timeframe. E.g: 7 days.\n\n**Note**: if you are using WhatsApp Business, please make sure you have disabled the automatic replies on the WhatsApp app, otherwise you may experience conflicts sending automatic replies."},"away":{"type":"object","properties":{"active":{"type":["boolean","null"],"description":"Enable or disable away automatic reply message"},"message":{"type":["string","null"],"maxLength":3000,"minLength":5,"description":"Message to be sent as away automatic reply, up to 3000 characters."},"file":{"type":["string","null"],"pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Optional image file ID (24 hexadecimal characters) to be sent as automatic reply. The image file must be already uploaded to the system. Only images can be sent as automatic replies, up to 2 MB of file size. Leave it out to keep the current image. To remove it, send `null` or list `file` in `remove`."},"target":{"type":"string","enum":["all","new_contacts"],"description":"Optional target for the away message: use `all` to reply to any new chat, or use `new_contacts` to reply only to new chats started by numbers that are not in your contacts agenda.","default":"all"},"skipPending":{"type":"boolean","description":"Optional flag to skip sending the away message to pending chats (not yet replied, not assigned and not resolved chats)."},"skipResolved":{"type":"boolean","description":"Optional flag to skip sending the welcome message to chats that have been resolved. Resolved chats are chats that have been closed by the user or by the system."},"skipAssigned":{"type":"boolean","description":"Optional flag to skip sending the welcome message to chats that have been assigned to an agent and have not been resolved, removed or blocked. Assigned chats are chats that have been assigned to an agent by the system or by an agent manually."},"skipNumbers":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":0,"maxItems":100,"description":"Optional list of phone numbers to be ignored when sending the welcome message. The phone number must be in E.164 format, for example: +16001234560"},"timezone":{"type":"string","minLength":2,"maxLength":40,"enum":["Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmara","Africa/Asmera","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Timbuktu","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/ComodRivadavia","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Aruba","America/Asuncion","America/Atikokan","America/Atka","America/Bahia","America/Bahia_Banderas","America/Barbados","America/Belem","America/Belize","America/Blanc-Sablon","America/Boa_Vista","America/Bogota","America/Boise","America/Buenos_Aires","America/Cambridge_Bay","America/Campo_Grande","America/Cancun","America/Caracas","America/Catamarca","America/Cayenne","America/Cayman","America/Chicago","America/Chihuahua","America/Ciudad_Juarez","America/Coral_Harbour","America/Cordoba","America/Costa_Rica","America/Coyhaique","America/Creston","America/Cuiaba","America/Curacao","America/Danmarkshavn","America/Dawson","America/Dawson_Creek","America/Denver","America/Detroit","America/Dominica","America/Edmonton","America/Eirunepe","America/El_Salvador","America/Ensenada","America/Fort_Nelson","America/Fort_Wayne","America/Fortaleza","America/Glace_Bay","America/Godthab","America/Goose_Bay","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guatemala","America/Guayaquil","America/Guyana","America/Halifax","America/Havana","America/Hermosillo","America/Indiana/Indianapolis","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Indianapolis","America/Inuvik","America/Iqaluit","America/Jamaica","America/Jujuy","America/Juneau","America/Kentucky/Louisville","America/Kentucky/Monticello","America/Knox_IN","America/Kralendijk","America/La_Paz","America/Lima","America/Los_Angeles","America/Louisville","America/Lower_Princes","America/Maceio","America/Managua","America/Manaus","America/Marigot","America/Martinique","America/Matamoros","America/Mazatlan","America/Mendoza","America/Menominee","America/Merida","America/Metlakatla","America/Mexico_City","America/Miquelon","America/Moncton","America/Monterrey","America/Montevideo","America/Montreal","America/Montserrat","America/Nassau","America/New_York","America/Nipigon","America/Nome","America/Noronha","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Nuuk","America/Ojinaga","America/Panama","America/Pangnirtung","America/Paramaribo","America/Phoenix","America/Port-au-Prince","America/Port_of_Spain","America/Porto_Acre","America/Porto_Velho","America/Puerto_Rico","America/Punta_Arenas","America/Rainy_River","America/Rankin_Inlet","America/Recife","America/Regina","America/Resolute","America/Rio_Branco","America/Rosario","America/Santa_Isabel","America/Santarem","America/Santiago","America/Santo_Domingo","America/Sao_Paulo","America/Scoresbysund","America/Shiprock","America/Sitka","America/St_Barthelemy","America/St_Johns","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Swift_Current","America/Tegucigalpa","America/Thule","America/Thunder_Bay","America/Tijuana","America/Toronto","America/Tortola","America/Vancouver","America/Virgin","America/Whitehorse","America/Winnipeg","America/Yakutat","America/Yellowknife","Antarctica/Casey","Antarctica/Davis","Antarctica/DumontDUrville","Antarctica/Macquarie","Antarctica/Mawson","Antarctica/McMurdo","Antarctica/Palmer","Antarctica/Rothera","Antarctica/South_Pole","Antarctica/Syowa","Antarctica/Troll","Antarctica/Vostok","Arctic/Longyearbyen","Asia/Aden","Asia/Almaty","Asia/Amman","Asia/Anadyr","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Ashkhabad","Asia/Atyrau","Asia/Baghdad","Asia/Bahrain","Asia/Baku","Asia/Bangkok","Asia/Barnaul","Asia/Beirut","Asia/Bishkek","Asia/Brunei","Asia/Calcutta","Asia/Chita","Asia/Choibalsan","Asia/Chongqing","Asia/Chungking","Asia/Colombo","Asia/Dacca","Asia/Damascus","Asia/Dhaka","Asia/Dili","Asia/Dubai","Asia/Dushanbe","Asia/Famagusta","Asia/Gaza","Asia/Harbin","Asia/Hebron","Asia/Ho_Chi_Minh","Asia/Hong_Kong","Asia/Hovd","Asia/Irkutsk","Asia/Istanbul","Asia/Jakarta","Asia/Jayapura","Asia/Jerusalem","Asia/Kabul","Asia/Kamchatka","Asia/Karachi","Asia/Kashgar","Asia/Kathmandu","Asia/Katmandu","Asia/Khandyga","Asia/Kolkata","Asia/Krasnoyarsk","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Kuwait","Asia/Macao","Asia/Macau","Asia/Magadan","Asia/Makassar","Asia/Manila","Asia/Muscat","Asia/Nicosia","Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk","Asia/Oral","Asia/Phnom_Penh","Asia/Pontianak","Asia/Pyongyang","Asia/Qatar","Asia/Qostanay","Asia/Qyzylorda","Asia/Rangoon","Asia/Riyadh","Asia/Saigon","Asia/Sakhalin","Asia/Samarkand","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Srednekolymsk","Asia/Taipei","Asia/Tashkent","Asia/Tbilisi","Asia/Tehran","Asia/Tel_Aviv","Asia/Thimbu","Asia/Thimphu","Asia/Tokyo","Asia/Tomsk","Asia/Ujung_Pandang","Asia/Ulaanbaatar","Asia/Ulan_Bator","Asia/Urumqi","Asia/Ust-Nera","Asia/Vientiane","Asia/Vladivostok","Asia/Yakutsk","Asia/Yangon","Asia/Yekaterinburg","Asia/Yerevan","Atlantic/Azores","Atlantic/Bermuda","Atlantic/Canary","Atlantic/Cape_Verde","Atlantic/Faeroe","Atlantic/Faroe","Atlantic/Jan_Mayen","Atlantic/Madeira","Atlantic/Reykjavik","Atlantic/South_Georgia","Atlantic/St_Helena","Atlantic/Stanley","Australia/ACT","Australia/Adelaide","Australia/Brisbane","Australia/Broken_Hill","Australia/Canberra","Australia/Currie","Australia/Darwin","Australia/Eucla","Australia/Hobart","Australia/LHI","Australia/Lindeman","Australia/Lord_Howe","Australia/Melbourne","Australia/NSW","Australia/North","Australia/Perth","Australia/Queensland","Australia/South","Australia/Sydney","Australia/Tasmania","Australia/Victoria","Australia/West","Australia/Yancowinna","Brazil/Acre","Brazil/DeNoronha","Brazil/East","Brazil/West","CET","CST6CDT","Canada/Atlantic","Canada/Central","Canada/Eastern","Canada/Mountain","Canada/Newfoundland","Canada/Pacific","Canada/Saskatchewan","Canada/Yukon","Chile/Continental","Chile/EasterIsland","Cuba","EET","EST","EST5EDT","Egypt","Eire","Etc/GMT","Etc/GMT+0","Etc/GMT+1","Etc/GMT+10","Etc/GMT+11","Etc/GMT+12","Etc/GMT+2","Etc/GMT+3","Etc/GMT+4","Etc/GMT+5","Etc/GMT+6","Etc/GMT+7","Etc/GMT+8","Etc/GMT+9","Etc/GMT-0","Etc/GMT-1","Etc/GMT-10","Etc/GMT-11","Etc/GMT-12","Etc/GMT-13","Etc/GMT-14","Etc/GMT-2","Etc/GMT-3","Etc/GMT-4","Etc/GMT-5","Etc/GMT-6","Etc/GMT-7","Etc/GMT-8","Etc/GMT-9","Etc/GMT0","Etc/Greenwich","Etc/UCT","Etc/UTC","Etc/Universal","Etc/Zulu","Europe/Amsterdam","Europe/Andorra","Europe/Astrakhan","Europe/Athens","Europe/Belfast","Europe/Belgrade","Europe/Berlin","Europe/Bratislava","Europe/Brussels","Europe/Bucharest","Europe/Budapest","Europe/Busingen","Europe/Chisinau","Europe/Copenhagen","Europe/Dublin","Europe/Gibraltar","Europe/Guernsey","Europe/Helsinki","Europe/Isle_of_Man","Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kiev","Europe/Kirov","Europe/Kyiv","Europe/Lisbon","Europe/Ljubljana","Europe/London","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Mariehamn","Europe/Minsk","Europe/Monaco","Europe/Moscow","Europe/Nicosia","Europe/Oslo","Europe/Paris","Europe/Podgorica","Europe/Prague","Europe/Riga","Europe/Rome","Europe/Samara","Europe/San_Marino","Europe/Sarajevo","Europe/Saratov","Europe/Simferopol","Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Tiraspol","Europe/Ulyanovsk","Europe/Uzhgorod","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw","Europe/Zagreb","Europe/Zaporozhye","Europe/Zurich","GB","GB-Eire","GMT","GMT+0","GMT-0","GMT0","Greenwich","HST","Hongkong","Iceland","Indian/Antananarivo","Indian/Chagos","Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives","Indian/Mauritius","Indian/Mayotte","Indian/Reunion","Iran","Israel","Jamaica","Japan","Kwajalein","Libya","MET","MST","MST7MDT","Mexico/BajaNorte","Mexico/BajaSur","Mexico/General","NZ","NZ-CHAT","Navajo","PRC","PST8PDT","Pacific/Apia","Pacific/Auckland","Pacific/Bougainville","Pacific/Chatham","Pacific/Chuuk","Pacific/Easter","Pacific/Efate","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Fiji","Pacific/Funafuti","Pacific/Galapagos","Pacific/Gambier","Pacific/Guadalcanal","Pacific/Guam","Pacific/Honolulu","Pacific/Johnston","Pacific/Kanton","Pacific/Kiritimati","Pacific/Kosrae","Pacific/Kwajalein","Pacific/Majuro","Pacific/Marquesas","Pacific/Midway","Pacific/Nauru","Pacific/Niue","Pacific/Norfolk","Pacific/Noumea","Pacific/Pago_Pago","Pacific/Palau","Pacific/Pitcairn","Pacific/Pohnpei","Pacific/Ponape","Pacific/Port_Moresby","Pacific/Rarotonga","Pacific/Saipan","Pacific/Samoa","Pacific/Tahiti","Pacific/Tarawa","Pacific/Tongatapu","Pacific/Truk","Pacific/Wake","Pacific/Wallis","Pacific/Yap","Poland","Portugal","ROC","ROK","Singapore","Turkey","UCT","US/Alaska","US/Aleutian","US/Arizona","US/Central","US/East-Indiana","US/Eastern","US/Hawaii","US/Indiana-Starke","US/Michigan","US/Mountain","US/Pacific","US/Samoa","UTC","Universal","W-SU","WET","Zulu"],"description":"Local time zone to be applied to the opening business hours per week day. If not defined, the account time zone configuration will be used by default."},"useBusinessProfile":{"type":"boolean","description":"Use the WhatsApp Business profile opening hours synced information. This option can only be used if the connected number is WhatsApp Business. In case there is no opening hours profile information, the 24 hours open policy will be applied."},"businessHours":{"type":"object","properties":{"monday":{"type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for automatic replies in the current week day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_open"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2,"description":"Business opening and close hours per week day. You can define one or two hours ranges per day. E.g: 9am - 1pm and 3pm - 7pm"}},"additionalProperties":false},"tuesday":{"type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for automatic replies in the current week day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_open"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2,"description":"Business opening and close hours per week day. You can define one or two hours ranges per day. E.g: 9am - 1pm and 3pm - 7pm"}},"additionalProperties":false},"wednesday":{"type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for automatic replies in the current week day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_open"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2,"description":"Business opening and close hours per week day. You can define one or two hours ranges per day. E.g: 9am - 1pm and 3pm - 7pm"}},"additionalProperties":false},"thursday":{"type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for automatic replies in the current week day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_open"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2,"description":"Business opening and close hours per week day. You can define one or two hours ranges per day. E.g: 9am - 1pm and 3pm - 7pm"}},"additionalProperties":false},"friday":{"type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for automatic replies in the current week day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_open"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2,"description":"Business opening and close hours per week day. You can define one or two hours ranges per day. E.g: 9am - 1pm and 3pm - 7pm"}},"additionalProperties":false},"saturday":{"type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for automatic replies in the current week day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_open"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2,"description":"Business opening and close hours per week day. You can define one or two hours ranges per day. E.g: 9am - 1pm and 3pm - 7pm"}},"additionalProperties":false},"sunday":{"type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for automatic replies in the current week day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_open"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2,"description":"Business opening and close hours per week day. You can define one or two hours ranges per day. E.g: 9am - 1pm and 3pm - 7pm"}},"additionalProperties":false}},"additionalProperties":false},"labels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":10,"description":"Optional list of chat labels that chats should have (at least one label match) in order to send the away automatic reply message to the user."},"setLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Optional list of chat labels to add when a chat is automatically replied."},"exceptions":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","maxLength":40,"description":"Day of the exception on the device clock, the away `timezone`. Send it as a calendar day, the way it is returned: `YYYY-MM-DD`, or `MM-DD` for a yearly exception. An ISO 8601 date-time is also accepted: only its calendar day in the away `timezone` counts, so send a time well inside that day, such as noon with its UTC offset. Examples: `2026-11-08`, `12-25`, `2026-12-25T12:00:00-06:00`."},"yearly":{"type":"boolean","description":"Whether the exception repeats every year on the same month and day (`true`), as fixed holidays do, or applies on that exact date only (`false`), as movable holidays need. When left out, a `YYYY-MM-DD` date applies on that date only, and an `MM-DD` date or a date-time repeats every year. A one-off date is no longer returned once its day is over, and is dropped on the next update."},"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for the exceptional day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_closed"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2}},"additionalProperties":false},"minItems":0,"maxItems":20,"description":"Optional list of exceptions to the opening business hours per week day that can be holidays, national festivities or special 24h opening days."},"form":{"type":["object","null"],"properties":{"flowId":{"type":"string","pattern":"^\\d{5,}$","description":"ID Meta gives the WhatsApp Form (numeric)"},"cta":{"type":"string","minLength":1,"maxLength":30,"description":"Text of the button that opens the form, up to 30 characters"},"screen":{"type":"string","maxLength":100,"description":"Screen to open. Leave it out to open the first one."}},"required":["flowId","cta"],"additionalProperties":false,"description":"Optional: send the reply as a WhatsApp Form, with the message as the text above its button (official numbers only, up to 1024 characters, no image). Send `null` to stop."},"remove":{"type":"array","items":{"type":"string","enum":["file","form"]},"maxItems":10,"description":"Optionally remove values for the specified fields. E.g: `file`, `form`"}},"required":["active","message"],"additionalProperties":false,"description":"Configure an automatic reply for away hours/days when you are out of business hours. You can configure the week days and opening hours in which your team is available. Any user contacting outside the configured business hours will receive an automatic message.\n\n**Note**: if you are using WhatsApp Business, please make sure you have disabled the automatic replies on the WhatsApp app, otherwise you may experience conflicts sending automatic replies."},"busy":{"type":"object","properties":{"active":{"type":["boolean","null"],"description":"Enable or disable busy times automatic reply message"},"message":{"type":["string","null"],"maxLength":3000,"minLength":0,"description":"Message to be sent as busy times automatic reply, up to 3000 characters."},"file":{"type":["string","null"],"pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Optional image file ID (24 hexadecimal characters) to be sent as automatic reply. The image file must be already uploaded to the system. Only images can be sent as automatic replies, up to 2 MB of file size. Leave it out to keep the current image. To remove it, send `null` or list `file` in `remove`."},"target":{"type":"string","enum":["all","new_contacts"],"description":"Optional target for the busy times message: use `all` to reply to any new chat, or use `new_contacts` to reply only to new chats started by numbers that are not in your contacts agenda.","default":"all"},"timeframe":{"type":"string","enum":["3m","5m","10m","15m","20m","30m"],"description":"Optional timeframe for the busy times message: use `5m` to send the busy times message in chats that were not replied in the last 5 minutes after the last message, or use a different time frame based on the available options.","default":"5m"},"setLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Optional list of chat labels to add when a chat is automatically replied."},"skipPending":{"type":"boolean","description":"Optional flag to skip sending the busy times message to pending chats (not yet replied, not assigned and not resolved chats)."},"skipResolved":{"type":"boolean","description":"Optional flag to skip sending the busy times message to chats that have been resolved. Resolved chats are chats that have been closed by the user or by the system."},"skipAssigned":{"type":"boolean","description":"Optional flag to skip sending the busy times message to chats that have been assigned to an agent and have not been resolved, removed or blocked. Assigned chats are chats that have been assigned to an agent by the system or by an agent manually."},"skipNumbers":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":0,"maxItems":100,"description":"Optional list of phone numbers to be ignored when sending the welcome message. The phone number must be in E.164 format, for example: +16001234560"},"form":{"type":["object","null"],"properties":{"flowId":{"type":"string","pattern":"^\\d{5,}$","description":"ID Meta gives the WhatsApp Form (numeric)"},"cta":{"type":"string","minLength":1,"maxLength":30,"description":"Text of the button that opens the form, up to 30 characters"},"screen":{"type":"string","maxLength":100,"description":"Screen to open. Leave it out to open the first one."}},"required":["flowId","cta"],"additionalProperties":false,"description":"Optional: send the reply as a WhatsApp Form, with the message as the text above its button (official numbers only, up to 1024 characters, no image). Send `null` to stop."},"remove":{"type":"array","items":{"type":"string","enum":["file","form"]},"maxItems":10,"description":"Optionally remove values for the specified fields. E.g: `file`, `form`"}},"required":["active"],"additionalProperties":false,"description":"Configure an automatic reply for busy times when your team needs more time to reply to new chats. You can configure the timeframe in minutes on which the busy times message if no one can reply to the new chat before that timeframe, e.g. 5 minutes.\n\n**Note**: busy times automatic reply is only available in Business and Enterprise plans"},"follow":{"type":"array","items":{"type":"object","properties":{"alias":{"type":"string","maxLength":100,"minLength":1,"description":"Required follow up message internal alias that helps identifing it easily"},"active":{"type":["boolean","null"],"description":"Enable or disable follow up automatic reply message"},"message":{"type":["string","null"],"maxLength":3000,"minLength":5,"description":"Message to be sent as welcome automatic reply, up to 3000 characters."},"file":{"type":["string","null"],"pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Optional image file ID (24 hexadecimal characters) to be sent as automatic reply. The image file must be already uploaded to the system. Only images can be sent as automatic replies, up to 2 MB of file size. Leave it out to keep the current image. To remove it, send `null` or list `file` in `remove`."},"timeframe":{"type":"string","enum":["1h","2h","3h","4h","24h","2d","7d"],"description":"Optional timeframe for the follow up message: use `24h` to send a follow up message in chats that had no activity in the last 24 hours, or use a different time frame based on the available options."},"labels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Optional list of chat labels that chats should have (at least one label match) in order to send a follow up automatic message to the user."},"setLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Optional list of chat labels to add when a chat is automatically replied."},"skipPending":{"type":"boolean","description":"Optional flag to skip sending the follow up message to pending chats (not yet replied, not assigned and not resolved chats)."},"skipAssigned":{"type":"boolean","description":"Optional flag to skip sending the follow up message to chats that have been assigned to an agent and have not been resolved, removed or blocked. Assigned chats are chats that have been assigned to an agent by the system or by an agent manually."},"skipResolved":{"type":"boolean","description":"Optional flag to skip sending the follow up message to chats that have been assigned to an agent and have not been resolved, removed or blocked. Assigned chats are chats that have been assigned to an agent by the system or by an agent manually."},"skipNumbers":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":0,"maxItems":100,"description":"Optional list of phone numbers to be ignored when sending the welcome message. The phone number must be in E.164 format, for example: +16001234560"},"form":{"type":["object","null"],"properties":{"flowId":{"type":"string","pattern":"^\\d{5,}$","description":"ID Meta gives the WhatsApp Form (numeric)"},"cta":{"type":"string","minLength":1,"maxLength":30,"description":"Text of the button that opens the form, up to 30 characters"},"screen":{"type":"string","maxLength":100,"description":"Screen to open. Leave it out to open the first one."}},"required":["flowId","cta"],"additionalProperties":false,"description":"Optional: send the reply as a WhatsApp Form, with the message as the text above its button (official numbers only, up to 1024 characters, no image). Send `null` to stop."},"remove":{"type":"array","items":{"type":"string","enum":["file","form"]},"maxItems":10,"description":"Optionally remove values for the specified fields. E.g: `file`, `form`"}},"required":["active","message"],"additionalProperties":false},"maxItems":1,"description":"Configure an automatic reply for follow up messages when you would like to update the customer or gather feedback from the user. You can configure the timeframe on which the follow up message will be sent if no message was exchanged during that timefram. E.g. 24 hours.\n\n**Note**: follow up automatic reply is only available in Business and Enterprise plans"},"call":{"type":"object","properties":{"active":{"type":["boolean","null"],"description":"Enable or disable call automatic reply message"},"message":{"type":["string","null"],"maxLength":3000,"minLength":5,"description":"Message to be sent as welcome automatic reply, up to 3000 characters."},"file":{"type":["string","null"],"pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Optional image file ID (24 hexadecimal characters) to be sent as automatic reply. The image file must be already uploaded to the system. Only images can be sent as automatic replies, up to 2 MB of file size. Leave it out to keep the current image. To remove it, send `null` or list `file` in `remove`."},"reject":{"type":["boolean","null"],"description":"Set to `true` in order to reject all calls automatically."},"setLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Optional list of chat labels to add when a chat is automatically replied."},"skipNumbers":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":0,"maxItems":100,"description":"Optional list of phone numbers to be ignored when sending the welcome message. The phone number must be in E.164 format, for example: +16001234560"},"remove":{"type":"array","items":{"type":"string","enum":["file","form"]},"maxItems":10,"description":"Optionally remove values for the specified fields. E.g: `file`, `form`"}},"required":["active","message","reject"],"additionalProperties":false,"description":"Configure an automatic reply for incoming calls in order to notify the user that you do not accept voice calls and provide useful information about alternative ways to communicate. **Note**: call automatic reply is only available in Business and Enterprise plans"}},"additionalProperties":false}}],"responses":{"200":{"description":"Auto replies updated","schema":{"type":"object","properties":{"welcome":{"type":"object","properties":{"active":{"type":"boolean","description":"Enable or disable welcome automatic reply message"},"message":{"type":"string","maxLength":3000,"minLength":0,"description":"Message to be sent as welcome automatic reply, up to 3000 characters."},"file":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Optional image file ID (24 hexadecimal characters) to be sent as automatic reply. The image file must be already uploaded to the system. Only images can be sent as automatic replies, up to 2 MB of file size. Leave it out to keep the current image. To remove it, send `null` or list `file` in `remove`."},"target":{"type":"string","enum":["all","new_contacts"],"description":"Optional target for the welcome message: use `all` to reply to any new chat, or use `new_contacts` to reply only to new chats started by numbers that are not in your contacts agenda.","default":"all"},"timeframe":{"type":"string","enum":["24h","2d","3d","7d","14d","30d","60d"],"description":"Optional timeframe for the welcome message: use `14d` to send the welcome message in chats that had no previous messages in the last 14 days, or use a different time frame based on the available options.","default":"14d"},"setLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Optional list of chat labels to add when a chat is automatically replied."},"skipResolved":{"type":"boolean","description":"Optional flag to skip sending the welcome message to chats that have been resolved. Resolved chats are chats that have been closed by the user or by the system."},"skipAssigned":{"type":"boolean","description":"Optional flag to skip sending the welcome message to chats that have been assigned to an agent and have not been resolved, removed or blocked. Assigned chats are chats that have been assigned to an agent by the system or by an agent manually."},"skipNumbers":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":0,"maxItems":100,"description":"Optional list of phone numbers to be ignored when sending the welcome message. The phone number must be in E.164 format, for example: +16001234560"},"form":{"type":"object","properties":{"flowId":{"type":"string","pattern":"^\\d{5,}$","description":"ID Meta gives the WhatsApp Form (numeric)"},"cta":{"type":"string","minLength":1,"maxLength":30,"description":"Text of the button that opens the form, up to 30 characters"},"screen":{"type":"string","maxLength":100,"description":"Screen to open. Leave it out to open the first one."}},"required":["flowId","cta"],"additionalProperties":false,"description":"Optional: send the reply as a WhatsApp Form, with the message as the text above its button (official numbers only, up to 1024 characters, no image). Send `null` to stop."},"remove":{"type":"array","items":{"type":"string","enum":["file","form"]},"maxItems":10,"description":"Optionally remove values for the specified fields. E.g: `file`, `form`"}},"required":["active"],"additionalProperties":false,"description":"Configure an automatic reply as welcome message for users contacting you the first time, or when they did not contact you in a while based on the configured timeframe. E.g: 7 days.\n\n**Note**: if you are using WhatsApp Business, please make sure you have disabled the automatic replies on the WhatsApp app, otherwise you may experience conflicts sending automatic replies."},"away":{"type":"object","properties":{"active":{"type":"boolean","description":"Enable or disable away automatic reply message"},"message":{"type":"string","maxLength":3000,"minLength":5,"description":"Message to be sent as away automatic reply, up to 3000 characters."},"file":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Optional image file ID (24 hexadecimal characters) to be sent as automatic reply. The image file must be already uploaded to the system. Only images can be sent as automatic replies, up to 2 MB of file size. Leave it out to keep the current image. To remove it, send `null` or list `file` in `remove`."},"target":{"type":"string","enum":["all","new_contacts"],"description":"Optional target for the away message: use `all` to reply to any new chat, or use `new_contacts` to reply only to new chats started by numbers that are not in your contacts agenda.","default":"all"},"skipPending":{"type":"boolean","description":"Optional flag to skip sending the away message to pending chats (not yet replied, not assigned and not resolved chats)."},"skipResolved":{"type":"boolean","description":"Optional flag to skip sending the welcome message to chats that have been resolved. Resolved chats are chats that have been closed by the user or by the system."},"skipAssigned":{"type":"boolean","description":"Optional flag to skip sending the welcome message to chats that have been assigned to an agent and have not been resolved, removed or blocked. Assigned chats are chats that have been assigned to an agent by the system or by an agent manually."},"skipNumbers":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":0,"maxItems":100,"description":"Optional list of phone numbers to be ignored when sending the welcome message. The phone number must be in E.164 format, for example: +16001234560"},"timezone":{"type":"string","minLength":2,"maxLength":40,"enum":["Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmara","Africa/Asmera","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Timbuktu","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/ComodRivadavia","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Aruba","America/Asuncion","America/Atikokan","America/Atka","America/Bahia","America/Bahia_Banderas","America/Barbados","America/Belem","America/Belize","America/Blanc-Sablon","America/Boa_Vista","America/Bogota","America/Boise","America/Buenos_Aires","America/Cambridge_Bay","America/Campo_Grande","America/Cancun","America/Caracas","America/Catamarca","America/Cayenne","America/Cayman","America/Chicago","America/Chihuahua","America/Ciudad_Juarez","America/Coral_Harbour","America/Cordoba","America/Costa_Rica","America/Coyhaique","America/Creston","America/Cuiaba","America/Curacao","America/Danmarkshavn","America/Dawson","America/Dawson_Creek","America/Denver","America/Detroit","America/Dominica","America/Edmonton","America/Eirunepe","America/El_Salvador","America/Ensenada","America/Fort_Nelson","America/Fort_Wayne","America/Fortaleza","America/Glace_Bay","America/Godthab","America/Goose_Bay","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guatemala","America/Guayaquil","America/Guyana","America/Halifax","America/Havana","America/Hermosillo","America/Indiana/Indianapolis","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Indianapolis","America/Inuvik","America/Iqaluit","America/Jamaica","America/Jujuy","America/Juneau","America/Kentucky/Louisville","America/Kentucky/Monticello","America/Knox_IN","America/Kralendijk","America/La_Paz","America/Lima","America/Los_Angeles","America/Louisville","America/Lower_Princes","America/Maceio","America/Managua","America/Manaus","America/Marigot","America/Martinique","America/Matamoros","America/Mazatlan","America/Mendoza","America/Menominee","America/Merida","America/Metlakatla","America/Mexico_City","America/Miquelon","America/Moncton","America/Monterrey","America/Montevideo","America/Montreal","America/Montserrat","America/Nassau","America/New_York","America/Nipigon","America/Nome","America/Noronha","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Nuuk","America/Ojinaga","America/Panama","America/Pangnirtung","America/Paramaribo","America/Phoenix","America/Port-au-Prince","America/Port_of_Spain","America/Porto_Acre","America/Porto_Velho","America/Puerto_Rico","America/Punta_Arenas","America/Rainy_River","America/Rankin_Inlet","America/Recife","America/Regina","America/Resolute","America/Rio_Branco","America/Rosario","America/Santa_Isabel","America/Santarem","America/Santiago","America/Santo_Domingo","America/Sao_Paulo","America/Scoresbysund","America/Shiprock","America/Sitka","America/St_Barthelemy","America/St_Johns","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Swift_Current","America/Tegucigalpa","America/Thule","America/Thunder_Bay","America/Tijuana","America/Toronto","America/Tortola","America/Vancouver","America/Virgin","America/Whitehorse","America/Winnipeg","America/Yakutat","America/Yellowknife","Antarctica/Casey","Antarctica/Davis","Antarctica/DumontDUrville","Antarctica/Macquarie","Antarctica/Mawson","Antarctica/McMurdo","Antarctica/Palmer","Antarctica/Rothera","Antarctica/South_Pole","Antarctica/Syowa","Antarctica/Troll","Antarctica/Vostok","Arctic/Longyearbyen","Asia/Aden","Asia/Almaty","Asia/Amman","Asia/Anadyr","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Ashkhabad","Asia/Atyrau","Asia/Baghdad","Asia/Bahrain","Asia/Baku","Asia/Bangkok","Asia/Barnaul","Asia/Beirut","Asia/Bishkek","Asia/Brunei","Asia/Calcutta","Asia/Chita","Asia/Choibalsan","Asia/Chongqing","Asia/Chungking","Asia/Colombo","Asia/Dacca","Asia/Damascus","Asia/Dhaka","Asia/Dili","Asia/Dubai","Asia/Dushanbe","Asia/Famagusta","Asia/Gaza","Asia/Harbin","Asia/Hebron","Asia/Ho_Chi_Minh","Asia/Hong_Kong","Asia/Hovd","Asia/Irkutsk","Asia/Istanbul","Asia/Jakarta","Asia/Jayapura","Asia/Jerusalem","Asia/Kabul","Asia/Kamchatka","Asia/Karachi","Asia/Kashgar","Asia/Kathmandu","Asia/Katmandu","Asia/Khandyga","Asia/Kolkata","Asia/Krasnoyarsk","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Kuwait","Asia/Macao","Asia/Macau","Asia/Magadan","Asia/Makassar","Asia/Manila","Asia/Muscat","Asia/Nicosia","Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk","Asia/Oral","Asia/Phnom_Penh","Asia/Pontianak","Asia/Pyongyang","Asia/Qatar","Asia/Qostanay","Asia/Qyzylorda","Asia/Rangoon","Asia/Riyadh","Asia/Saigon","Asia/Sakhalin","Asia/Samarkand","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Srednekolymsk","Asia/Taipei","Asia/Tashkent","Asia/Tbilisi","Asia/Tehran","Asia/Tel_Aviv","Asia/Thimbu","Asia/Thimphu","Asia/Tokyo","Asia/Tomsk","Asia/Ujung_Pandang","Asia/Ulaanbaatar","Asia/Ulan_Bator","Asia/Urumqi","Asia/Ust-Nera","Asia/Vientiane","Asia/Vladivostok","Asia/Yakutsk","Asia/Yangon","Asia/Yekaterinburg","Asia/Yerevan","Atlantic/Azores","Atlantic/Bermuda","Atlantic/Canary","Atlantic/Cape_Verde","Atlantic/Faeroe","Atlantic/Faroe","Atlantic/Jan_Mayen","Atlantic/Madeira","Atlantic/Reykjavik","Atlantic/South_Georgia","Atlantic/St_Helena","Atlantic/Stanley","Australia/ACT","Australia/Adelaide","Australia/Brisbane","Australia/Broken_Hill","Australia/Canberra","Australia/Currie","Australia/Darwin","Australia/Eucla","Australia/Hobart","Australia/LHI","Australia/Lindeman","Australia/Lord_Howe","Australia/Melbourne","Australia/NSW","Australia/North","Australia/Perth","Australia/Queensland","Australia/South","Australia/Sydney","Australia/Tasmania","Australia/Victoria","Australia/West","Australia/Yancowinna","Brazil/Acre","Brazil/DeNoronha","Brazil/East","Brazil/West","CET","CST6CDT","Canada/Atlantic","Canada/Central","Canada/Eastern","Canada/Mountain","Canada/Newfoundland","Canada/Pacific","Canada/Saskatchewan","Canada/Yukon","Chile/Continental","Chile/EasterIsland","Cuba","EET","EST","EST5EDT","Egypt","Eire","Etc/GMT","Etc/GMT+0","Etc/GMT+1","Etc/GMT+10","Etc/GMT+11","Etc/GMT+12","Etc/GMT+2","Etc/GMT+3","Etc/GMT+4","Etc/GMT+5","Etc/GMT+6","Etc/GMT+7","Etc/GMT+8","Etc/GMT+9","Etc/GMT-0","Etc/GMT-1","Etc/GMT-10","Etc/GMT-11","Etc/GMT-12","Etc/GMT-13","Etc/GMT-14","Etc/GMT-2","Etc/GMT-3","Etc/GMT-4","Etc/GMT-5","Etc/GMT-6","Etc/GMT-7","Etc/GMT-8","Etc/GMT-9","Etc/GMT0","Etc/Greenwich","Etc/UCT","Etc/UTC","Etc/Universal","Etc/Zulu","Europe/Amsterdam","Europe/Andorra","Europe/Astrakhan","Europe/Athens","Europe/Belfast","Europe/Belgrade","Europe/Berlin","Europe/Bratislava","Europe/Brussels","Europe/Bucharest","Europe/Budapest","Europe/Busingen","Europe/Chisinau","Europe/Copenhagen","Europe/Dublin","Europe/Gibraltar","Europe/Guernsey","Europe/Helsinki","Europe/Isle_of_Man","Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kiev","Europe/Kirov","Europe/Kyiv","Europe/Lisbon","Europe/Ljubljana","Europe/London","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Mariehamn","Europe/Minsk","Europe/Monaco","Europe/Moscow","Europe/Nicosia","Europe/Oslo","Europe/Paris","Europe/Podgorica","Europe/Prague","Europe/Riga","Europe/Rome","Europe/Samara","Europe/San_Marino","Europe/Sarajevo","Europe/Saratov","Europe/Simferopol","Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Tiraspol","Europe/Ulyanovsk","Europe/Uzhgorod","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw","Europe/Zagreb","Europe/Zaporozhye","Europe/Zurich","GB","GB-Eire","GMT","GMT+0","GMT-0","GMT0","Greenwich","HST","Hongkong","Iceland","Indian/Antananarivo","Indian/Chagos","Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives","Indian/Mauritius","Indian/Mayotte","Indian/Reunion","Iran","Israel","Jamaica","Japan","Kwajalein","Libya","MET","MST","MST7MDT","Mexico/BajaNorte","Mexico/BajaSur","Mexico/General","NZ","NZ-CHAT","Navajo","PRC","PST8PDT","Pacific/Apia","Pacific/Auckland","Pacific/Bougainville","Pacific/Chatham","Pacific/Chuuk","Pacific/Easter","Pacific/Efate","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Fiji","Pacific/Funafuti","Pacific/Galapagos","Pacific/Gambier","Pacific/Guadalcanal","Pacific/Guam","Pacific/Honolulu","Pacific/Johnston","Pacific/Kanton","Pacific/Kiritimati","Pacific/Kosrae","Pacific/Kwajalein","Pacific/Majuro","Pacific/Marquesas","Pacific/Midway","Pacific/Nauru","Pacific/Niue","Pacific/Norfolk","Pacific/Noumea","Pacific/Pago_Pago","Pacific/Palau","Pacific/Pitcairn","Pacific/Pohnpei","Pacific/Ponape","Pacific/Port_Moresby","Pacific/Rarotonga","Pacific/Saipan","Pacific/Samoa","Pacific/Tahiti","Pacific/Tarawa","Pacific/Tongatapu","Pacific/Truk","Pacific/Wake","Pacific/Wallis","Pacific/Yap","Poland","Portugal","ROC","ROK","Singapore","Turkey","UCT","US/Alaska","US/Aleutian","US/Arizona","US/Central","US/East-Indiana","US/Eastern","US/Hawaii","US/Indiana-Starke","US/Michigan","US/Mountain","US/Pacific","US/Samoa","UTC","Universal","W-SU","WET","Zulu"],"description":"Local time zone to be applied to the opening business hours per week day. If not defined, the account time zone configuration will be used by default."},"useBusinessProfile":{"type":"boolean","description":"Use the WhatsApp Business profile opening hours synced information. This option can only be used if the connected number is WhatsApp Business. In case there is no opening hours profile information, the 24 hours open policy will be applied."},"businessHours":{"type":"object","properties":{"monday":{"type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for automatic replies in the current week day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_open"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2,"description":"Business opening and close hours per week day. You can define one or two hours ranges per day. E.g: 9am - 1pm and 3pm - 7pm"}},"additionalProperties":false},"tuesday":{"type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for automatic replies in the current week day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_open"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2,"description":"Business opening and close hours per week day. You can define one or two hours ranges per day. E.g: 9am - 1pm and 3pm - 7pm"}},"additionalProperties":false},"wednesday":{"type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for automatic replies in the current week day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_open"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2,"description":"Business opening and close hours per week day. You can define one or two hours ranges per day. E.g: 9am - 1pm and 3pm - 7pm"}},"additionalProperties":false},"thursday":{"type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for automatic replies in the current week day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_open"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2,"description":"Business opening and close hours per week day. You can define one or two hours ranges per day. E.g: 9am - 1pm and 3pm - 7pm"}},"additionalProperties":false},"friday":{"type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for automatic replies in the current week day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_open"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2,"description":"Business opening and close hours per week day. You can define one or two hours ranges per day. E.g: 9am - 1pm and 3pm - 7pm"}},"additionalProperties":false},"saturday":{"type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for automatic replies in the current week day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_open"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2,"description":"Business opening and close hours per week day. You can define one or two hours ranges per day. E.g: 9am - 1pm and 3pm - 7pm"}},"additionalProperties":false},"sunday":{"type":"object","properties":{"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for automatic replies in the current week day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_open"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2,"description":"Business opening and close hours per week day. You can define one or two hours ranges per day. E.g: 9am - 1pm and 3pm - 7pm"}},"additionalProperties":false}},"additionalProperties":false},"labels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":10,"description":"Optional list of chat labels that chats should have (at least one label match) in order to send the away automatic reply message to the user."},"setLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Optional list of chat labels to add when a chat is automatically replied."},"exceptions":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","maxLength":40,"description":"Day of the exception on the device clock, the away `timezone`. Send it as a calendar day, the way it is returned: `YYYY-MM-DD`, or `MM-DD` for a yearly exception. An ISO 8601 date-time is also accepted: only its calendar day in the away `timezone` counts, so send a time well inside that day, such as noon with its UTC offset. Examples: `2026-11-08`, `12-25`, `2026-12-25T12:00:00-06:00`."},"yearly":{"type":"boolean","description":"Whether the exception repeats every year on the same month and day (`true`), as fixed holidays do, or applies on that exact date only (`false`), as movable holidays need. When left out, a `YYYY-MM-DD` date applies on that date only, and an `MM-DD` date or a date-time repeats every year. A one-off date is no longer returned once its day is over, and is dropped on the next update."},"mode":{"type":"string","enum":["hours","24h_open","24h_closed"],"description":"Policy mode for the exceptional day: `24h_closed`, `24h_open`, or `hours` to define custom opening-close business hours.","default":"24h_closed"},"hours":{"type":"array","items":{"type":"object","properties":{"open":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"close":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":2}},"additionalProperties":false},"minItems":0,"maxItems":20,"description":"Optional list of exceptions to the opening business hours per week day that can be holidays, national festivities or special 24h opening days."},"form":{"type":"object","properties":{"flowId":{"type":"string","pattern":"^\\d{5,}$","description":"ID Meta gives the WhatsApp Form (numeric)"},"cta":{"type":"string","minLength":1,"maxLength":30,"description":"Text of the button that opens the form, up to 30 characters"},"screen":{"type":"string","maxLength":100,"description":"Screen to open. Leave it out to open the first one."}},"required":["flowId","cta"],"additionalProperties":false,"description":"Optional: send the reply as a WhatsApp Form, with the message as the text above its button (official numbers only, up to 1024 characters, no image). Send `null` to stop."},"remove":{"type":"array","items":{"type":"string","enum":["file","form"]},"maxItems":10,"description":"Optionally remove values for the specified fields. E.g: `file`, `form`"}},"required":["active","message"],"additionalProperties":false,"description":"Configure an automatic reply for away hours/days when you are out of business hours. You can configure the week days and opening hours in which your team is available. Any user contacting outside the configured business hours will receive an automatic message.\n\n**Note**: if you are using WhatsApp Business, please make sure you have disabled the automatic replies on the WhatsApp app, otherwise you may experience conflicts sending automatic replies."},"busy":{"type":"object","properties":{"active":{"type":"boolean","description":"Enable or disable busy times automatic reply message"},"message":{"type":"string","maxLength":3000,"minLength":0,"description":"Message to be sent as busy times automatic reply, up to 3000 characters."},"file":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Optional image file ID (24 hexadecimal characters) to be sent as automatic reply. The image file must be already uploaded to the system. Only images can be sent as automatic replies, up to 2 MB of file size. Leave it out to keep the current image. To remove it, send `null` or list `file` in `remove`."},"target":{"type":"string","enum":["all","new_contacts"],"description":"Optional target for the busy times message: use `all` to reply to any new chat, or use `new_contacts` to reply only to new chats started by numbers that are not in your contacts agenda.","default":"all"},"timeframe":{"type":"string","enum":["3m","5m","10m","15m","20m","30m"],"description":"Optional timeframe for the busy times message: use `5m` to send the busy times message in chats that were not replied in the last 5 minutes after the last message, or use a different time frame based on the available options.","default":"5m"},"setLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Optional list of chat labels to add when a chat is automatically replied."},"skipPending":{"type":"boolean","description":"Optional flag to skip sending the busy times message to pending chats (not yet replied, not assigned and not resolved chats)."},"skipResolved":{"type":"boolean","description":"Optional flag to skip sending the busy times message to chats that have been resolved. Resolved chats are chats that have been closed by the user or by the system."},"skipAssigned":{"type":"boolean","description":"Optional flag to skip sending the busy times message to chats that have been assigned to an agent and have not been resolved, removed or blocked. Assigned chats are chats that have been assigned to an agent by the system or by an agent manually."},"skipNumbers":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":0,"maxItems":100,"description":"Optional list of phone numbers to be ignored when sending the welcome message. The phone number must be in E.164 format, for example: +16001234560"},"form":{"type":"object","properties":{"flowId":{"type":"string","pattern":"^\\d{5,}$","description":"ID Meta gives the WhatsApp Form (numeric)"},"cta":{"type":"string","minLength":1,"maxLength":30,"description":"Text of the button that opens the form, up to 30 characters"},"screen":{"type":"string","maxLength":100,"description":"Screen to open. Leave it out to open the first one."}},"required":["flowId","cta"],"additionalProperties":false,"description":"Optional: send the reply as a WhatsApp Form, with the message as the text above its button (official numbers only, up to 1024 characters, no image). Send `null` to stop."},"remove":{"type":"array","items":{"type":"string","enum":["file","form"]},"maxItems":10,"description":"Optionally remove values for the specified fields. E.g: `file`, `form`"}},"required":["active"],"additionalProperties":false,"description":"Configure an automatic reply for busy times when your team needs more time to reply to new chats. You can configure the timeframe in minutes on which the busy times message if no one can reply to the new chat before that timeframe, e.g. 5 minutes.\n\n**Note**: busy times automatic reply is only available in Business and Enterprise plans"},"follow":{"type":"array","items":{"type":"object","properties":{"alias":{"type":"string","maxLength":100,"minLength":1,"description":"Required follow up message internal alias that helps identifing it easily"},"active":{"type":"boolean","description":"Enable or disable follow up automatic reply message"},"message":{"type":"string","maxLength":3000,"minLength":5,"description":"Message to be sent as welcome automatic reply, up to 3000 characters."},"file":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Optional image file ID (24 hexadecimal characters) to be sent as automatic reply. The image file must be already uploaded to the system. Only images can be sent as automatic replies, up to 2 MB of file size. Leave it out to keep the current image. To remove it, send `null` or list `file` in `remove`."},"timeframe":{"type":"string","enum":["1h","2h","3h","4h","24h","2d","7d"],"description":"Optional timeframe for the follow up message: use `24h` to send a follow up message in chats that had no activity in the last 24 hours, or use a different time frame based on the available options."},"labels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Optional list of chat labels that chats should have (at least one label match) in order to send a follow up automatic message to the user."},"setLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Optional list of chat labels to add when a chat is automatically replied."},"skipPending":{"type":"boolean","description":"Optional flag to skip sending the follow up message to pending chats (not yet replied, not assigned and not resolved chats)."},"skipAssigned":{"type":"boolean","description":"Optional flag to skip sending the follow up message to chats that have been assigned to an agent and have not been resolved, removed or blocked. Assigned chats are chats that have been assigned to an agent by the system or by an agent manually."},"skipResolved":{"type":"boolean","description":"Optional flag to skip sending the follow up message to chats that have been assigned to an agent and have not been resolved, removed or blocked. Assigned chats are chats that have been assigned to an agent by the system or by an agent manually."},"skipNumbers":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":0,"maxItems":100,"description":"Optional list of phone numbers to be ignored when sending the welcome message. The phone number must be in E.164 format, for example: +16001234560"},"form":{"type":"object","properties":{"flowId":{"type":"string","pattern":"^\\d{5,}$","description":"ID Meta gives the WhatsApp Form (numeric)"},"cta":{"type":"string","minLength":1,"maxLength":30,"description":"Text of the button that opens the form, up to 30 characters"},"screen":{"type":"string","maxLength":100,"description":"Screen to open. Leave it out to open the first one."}},"required":["flowId","cta"],"additionalProperties":false,"description":"Optional: send the reply as a WhatsApp Form, with the message as the text above its button (official numbers only, up to 1024 characters, no image). Send `null` to stop."},"remove":{"type":"array","items":{"type":"string","enum":["file","form"]},"maxItems":10,"description":"Optionally remove values for the specified fields. E.g: `file`, `form`"}},"required":["active","message"],"additionalProperties":false},"maxItems":1,"description":"Configure an automatic reply for follow up messages when you would like to update the customer or gather feedback from the user. You can configure the timeframe on which the follow up message will be sent if no message was exchanged during that timefram. E.g. 24 hours.\n\n**Note**: follow up automatic reply is only available in Business and Enterprise plans"},"call":{"type":"object","properties":{"active":{"type":"boolean","description":"Enable or disable call automatic reply message"},"message":{"type":"string","maxLength":3000,"minLength":5,"description":"Message to be sent as welcome automatic reply, up to 3000 characters."},"file":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Optional image file ID (24 hexadecimal characters) to be sent as automatic reply. The image file must be already uploaded to the system. Only images can be sent as automatic replies, up to 2 MB of file size. Leave it out to keep the current image. To remove it, send `null` or list `file` in `remove`."},"reject":{"type":"boolean","description":"Set to `true` in order to reject all calls automatically."},"setLabels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Optional list of chat labels to add when a chat is automatically replied."},"skipNumbers":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":0,"maxItems":100,"description":"Optional list of phone numbers to be ignored when sending the welcome message. The phone number must be in E.164 format, for example: +16001234560"},"remove":{"type":"array","items":{"type":"string","enum":["file","form"]},"maxItems":10,"description":"Optionally remove values for the specified fields. E.g: `file`, `form`"}},"required":["active","message","reject"],"additionalProperties":false,"description":"Configure an automatic reply for incoming calls in order to notify the user that you do not accept voice calls and provide useful information about alternative ways to communicate. **Note**: call automatic reply is only available in Business and Enterprise plans"}},"additionalProperties":false}},"400":{"description":"Invalid or missing body fields","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unauthorized user or missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict - Unsupported feature, invalid auto reply file or configuration","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Update auto replies\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/autoreplies \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"welcome\":{\"active\":true,\"message\":\"This is an automatic reply sample message. See you soon!\"},\"away\":{\"active\":true,\"message\":\"Our team is not available at this time, please get in touch later.\",\"businessHours\":{\"monday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":19,\"minute\":30}}]},\"tuesday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":19,\"minute\":30}}]},\"wednesday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":19,\"minute\":30}}]},\"thursday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":21,\"minute\":0}}]},\"friday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":30},\"close\":{\"hour\":20,\"minute\":30}}]},\"saturday\":{\"mode\":\"24h_closed\"},\"sunday\":{\"mode\":\"24h_closed\"}}},\"follow\":[{\"active\":false,\"message\":\"Hi again! Is there anything else we can help you with?\"}]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Update auto replies\necho '{\"welcome\":{\"active\":true,\"message\":\"This is an automatic reply sample message. See you soon!\"},\"away\":{\"active\":true,\"message\":\"Our team is not available at this time, please get in touch later.\",\"businessHours\":{\"monday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":19,\"minute\":30}}]},\"tuesday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":19,\"minute\":30}}]},\"wednesday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":19,\"minute\":30}}]},\"thursday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":21,\"minute\":0}}]},\"friday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":30},\"close\":{\"hour\":20,\"minute\":30}}]},\"saturday\":{\"mode\":\"24h_closed\"},\"sunday\":{\"mode\":\"24h_closed\"}}},\"follow\":[{\"active\":false,\"message\":\"Hi again! Is there anything else we can help you with?\"}]}' |  \\\n  http PATCH https://api.wassenger.com/v1/devices/{deviceId}/autoreplies \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Update auto replies\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/autoreplies';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"welcome\":{\"active\":true,\"message\":\"This is an automatic reply sample message. See you soon!\"},\"away\":{\"active\":true,\"message\":\"Our team is not available at this time, please get in touch later.\",\"businessHours\":{\"monday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":19,\"minute\":30}}]},\"tuesday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":19,\"minute\":30}}]},\"wednesday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":19,\"minute\":30}}]},\"thursday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":21,\"minute\":0}}]},\"friday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":30},\"close\":{\"hour\":20,\"minute\":30}}]},\"saturday\":{\"mode\":\"24h_closed\"},\"sunday\":{\"mode\":\"24h_closed\"}}},\"follow\":[{\"active\":false,\"message\":\"Hi again! Is there anything else we can help you with?\"}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Update auto replies\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/autoreplies',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    welcome: {\n      active: true,\n      message: 'This is an automatic reply sample message. See you soon!'\n    },\n    away: {\n      active: true,\n      message: 'Our team is not available at this time, please get in touch later.',\n      businessHours: {\n        monday: {\n          mode: 'hours',\n          hours: [{open: {hour: 9, minute: 0}, close: {hour: 19, minute: 30}}]\n        },\n        tuesday: {\n          mode: 'hours',\n          hours: [{open: {hour: 9, minute: 0}, close: {hour: 19, minute: 30}}]\n        },\n        wednesday: {\n          mode: 'hours',\n          hours: [{open: {hour: 9, minute: 0}, close: {hour: 19, minute: 30}}]\n        },\n        thursday: {\n          mode: 'hours',\n          hours: [{open: {hour: 9, minute: 0}, close: {hour: 21, minute: 0}}]\n        },\n        friday: {\n          mode: 'hours',\n          hours: [{open: {hour: 9, minute: 30}, close: {hour: 20, minute: 30}}]\n        },\n        saturday: {mode: '24h_closed'},\n        sunday: {mode: '24h_closed'}\n      }\n    },\n    follow: [\n      {\n        active: false,\n        message: 'Hi again! Is there anything else we can help you with?'\n      }\n    ]\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Update auto replies\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/autoreplies');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  welcome: {\n    active: true,\n    message: 'This is an automatic reply sample message. See you soon!'\n  },\n  away: {\n    active: true,\n    message: 'Our team is not available at this time, please get in touch later.',\n    businessHours: {\n      monday: {\n        mode: 'hours',\n        hours: [\n          {\n            open: {\n              hour: 9,\n              minute: 0\n            },\n            close: {\n              hour: 19,\n              minute: 30\n            }\n          }\n        ]\n      },\n      tuesday: {\n        mode: 'hours',\n        hours: [\n          {\n            open: {\n              hour: 9,\n              minute: 0\n            },\n            close: {\n              hour: 19,\n              minute: 30\n            }\n          }\n        ]\n      },\n      wednesday: {\n        mode: 'hours',\n        hours: [\n          {\n            open: {\n              hour: 9,\n              minute: 0\n            },\n            close: {\n              hour: 19,\n              minute: 30\n            }\n          }\n        ]\n      },\n      thursday: {\n        mode: 'hours',\n        hours: [\n          {\n            open: {\n              hour: 9,\n              minute: 0\n            },\n            close: {\n              hour: 21,\n              minute: 0\n            }\n          }\n        ]\n      },\n      friday: {\n        mode: 'hours',\n        hours: [\n          {\n            open: {\n              hour: 9,\n              minute: 30\n            },\n            close: {\n              hour: 20,\n              minute: 30\n            }\n          }\n        ]\n      },\n      saturday: {\n        mode: '24h_closed'\n      },\n      sunday: {\n        mode: '24h_closed'\n      }\n    }\n  },\n  follow: [\n    {\n      active: false,\n      message: 'Hi again! Is there anything else we can help you with?'\n    }\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Update auto replies\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/autoreplies', [\n  'body' => '{\"welcome\":{\"active\":true,\"message\":\"This is an automatic reply sample message. See you soon!\"},\"away\":{\"active\":true,\"message\":\"Our team is not available at this time, please get in touch later.\",\"businessHours\":{\"monday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":19,\"minute\":30}}]},\"tuesday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":19,\"minute\":30}}]},\"wednesday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":19,\"minute\":30}}]},\"thursday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":21,\"minute\":0}}]},\"friday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":30},\"close\":{\"hour\":20,\"minute\":30}}]},\"saturday\":{\"mode\":\"24h_closed\"},\"sunday\":{\"mode\":\"24h_closed\"}}},\"follow\":[{\"active\":false,\"message\":\"Hi again! Is there anything else we can help you with?\"}]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Update auto replies\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'welcome' => [\n    'active' => null,\n    'message' => 'This is an automatic reply sample message. See you soon!'\n  ],\n  'away' => [\n    'active' => null,\n    'message' => 'Our team is not available at this time, please get in touch later.',\n    'businessHours' => [\n        'monday' => [\n                'mode' => 'hours',\n                'hours' => [\n                                [\n                                                                'open' => [\n                                                                                                                                'hour' => 9,\n                                                                                                                                'minute' => 0\n                                                                ],\n                                                                'close' => [\n                                                                                                                                'hour' => 19,\n                                                                                                                                'minute' => 30\n                                                                ]\n                                ]\n                ]\n        ],\n        'tuesday' => [\n                'mode' => 'hours',\n                'hours' => [\n                                [\n                                                                'open' => [\n                                                                                                                                'hour' => 9,\n                                                                                                                                'minute' => 0\n                                                                ],\n                                                                'close' => [\n                                                                                                                                'hour' => 19,\n                                                                                                                                'minute' => 30\n                                                                ]\n                                ]\n                ]\n        ],\n        'wednesday' => [\n                'mode' => 'hours',\n                'hours' => [\n                                [\n                                                                'open' => [\n                                                                                                                                'hour' => 9,\n                                                                                                                                'minute' => 0\n                                                                ],\n                                                                'close' => [\n                                                                                                                                'hour' => 19,\n                                                                                                                                'minute' => 30\n                                                                ]\n                                ]\n                ]\n        ],\n        'thursday' => [\n                'mode' => 'hours',\n                'hours' => [\n                                [\n                                                                'open' => [\n                                                                                                                                'hour' => 9,\n                                                                                                                                'minute' => 0\n                                                                ],\n                                                                'close' => [\n                                                                                                                                'hour' => 21,\n                                                                                                                                'minute' => 0\n                                                                ]\n                                ]\n                ]\n        ],\n        'friday' => [\n                'mode' => 'hours',\n                'hours' => [\n                                [\n                                                                'open' => [\n                                                                                                                                'hour' => 9,\n                                                                                                                                'minute' => 30\n                                                                ],\n                                                                'close' => [\n                                                                                                                                'hour' => 20,\n                                                                                                                                'minute' => 30\n                                                                ]\n                                ]\n                ]\n        ],\n        'saturday' => [\n                'mode' => '24h_closed'\n        ],\n        'sunday' => [\n                'mode' => '24h_closed'\n        ]\n    ]\n  ],\n  'follow' => [\n    [\n        'active' => null,\n        'message' => 'Hi again! Is there anything else we can help you with?'\n    ]\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/autoreplies');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Update auto replies\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/autoreplies\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'welcome' => [\n        'active' => null,\n        'message' => 'This is an automatic reply sample message. See you soon!'\n    ],\n    'away' => [\n        'active' => null,\n        'message' => 'Our team is not available at this time, please get in touch later.',\n        'businessHours' => [\n                'monday' => [\n                                'mode' => 'hours',\n                                'hours' => [\n                                                                [\n                                                                                                                                'open' => [\n                                                                                                                                                                                                                                                                'hour' => 9,\n                                                                                                                                                                                                                                                                'minute' => 0\n                                                                                                                                ],\n                                                                                                                                'close' => [\n                                                                                                                                                                                                                                                                'hour' => 19,\n                                                                                                                                                                                                                                                                'minute' => 30\n                                                                                                                                ]\n                                                                ]\n                                ]\n                ],\n                'tuesday' => [\n                                'mode' => 'hours',\n                                'hours' => [\n                                                                [\n                                                                                                                                'open' => [\n                                                                                                                                                                                                                                                                'hour' => 9,\n                                                                                                                                                                                                                                                                'minute' => 0\n                                                                                                                                ],\n                                                                                                                                'close' => [\n                                                                                                                                                                                                                                                                'hour' => 19,\n                                                                                                                                                                                                                                                                'minute' => 30\n                                                                                                                                ]\n                                                                ]\n                                ]\n                ],\n                'wednesday' => [\n                                'mode' => 'hours',\n                                'hours' => [\n                                                                [\n                                                                                                                                'open' => [\n                                                                                                                                                                                                                                                                'hour' => 9,\n                                                                                                                                                                                                                                                                'minute' => 0\n                                                                                                                                ],\n                                                                                                                                'close' => [\n                                                                                                                                                                                                                                                                'hour' => 19,\n                                                                                                                                                                                                                                                                'minute' => 30\n                                                                                                                                ]\n                                                                ]\n                                ]\n                ],\n                'thursday' => [\n                                'mode' => 'hours',\n                                'hours' => [\n                                                                [\n                                                                                                                                'open' => [\n                                                                                                                                                                                                                                                                'hour' => 9,\n                                                                                                                                                                                                                                                                'minute' => 0\n                                                                                                                                ],\n                                                                                                                                'close' => [\n                                                                                                                                                                                                                                                                'hour' => 21,\n                                                                                                                                                                                                                                                                'minute' => 0\n                                                                                                                                ]\n                                                                ]\n                                ]\n                ],\n                'friday' => [\n                                'mode' => 'hours',\n                                'hours' => [\n                                                                [\n                                                                                                                                'open' => [\n                                                                                                                                                                                                                                                                'hour' => 9,\n                                                                                                                                                                                                                                                                'minute' => 30\n                                                                                                                                ],\n                                                                                                                                'close' => [\n                                                                                                                                                                                                                                                                'hour' => 20,\n                                                                                                                                                                                                                                                                'minute' => 30\n                                                                                                                                ]\n                                                                ]\n                                ]\n                ],\n                'saturday' => [\n                                'mode' => '24h_closed'\n                ],\n                'sunday' => [\n                                'mode' => '24h_closed'\n                ]\n        ]\n    ],\n    'follow' => [\n        [\n                'active' => null,\n                'message' => 'Hi again! Is there anything else we can help you with?'\n        ]\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Update auto replies\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/autoreplies\"\n\npayload = {\n    \"welcome\": {\n        \"active\": True,\n        \"message\": \"This is an automatic reply sample message. See you soon!\"\n    },\n    \"away\": {\n        \"active\": True,\n        \"message\": \"Our team is not available at this time, please get in touch later.\",\n        \"businessHours\": {\n            \"monday\": {\n                \"mode\": \"hours\",\n                \"hours\": [\n                    {\n                        \"open\": {\n                            \"hour\": 9,\n                            \"minute\": 0\n                        },\n                        \"close\": {\n                            \"hour\": 19,\n                            \"minute\": 30\n                        }\n                    }\n                ]\n            },\n            \"tuesday\": {\n                \"mode\": \"hours\",\n                \"hours\": [\n                    {\n                        \"open\": {\n                            \"hour\": 9,\n                            \"minute\": 0\n                        },\n                        \"close\": {\n                            \"hour\": 19,\n                            \"minute\": 30\n                        }\n                    }\n                ]\n            },\n            \"wednesday\": {\n                \"mode\": \"hours\",\n                \"hours\": [\n                    {\n                        \"open\": {\n                            \"hour\": 9,\n                            \"minute\": 0\n                        },\n                        \"close\": {\n                            \"hour\": 19,\n                            \"minute\": 30\n                        }\n                    }\n                ]\n            },\n            \"thursday\": {\n                \"mode\": \"hours\",\n                \"hours\": [\n                    {\n                        \"open\": {\n                            \"hour\": 9,\n                            \"minute\": 0\n                        },\n                        \"close\": {\n                            \"hour\": 21,\n                            \"minute\": 0\n                        }\n                    }\n                ]\n            },\n            \"friday\": {\n                \"mode\": \"hours\",\n                \"hours\": [\n                    {\n                        \"open\": {\n                            \"hour\": 9,\n                            \"minute\": 30\n                        },\n                        \"close\": {\n                            \"hour\": 20,\n                            \"minute\": 30\n                        }\n                    }\n                ]\n            },\n            \"saturday\": { \"mode\": \"24h_closed\" },\n            \"sunday\": { \"mode\": \"24h_closed\" }\n        }\n    },\n    \"follow\": [\n        {\n            \"active\": False,\n            \"message\": \"Hi again! Is there anything else we can help you with?\"\n        }\n    ]\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update auto replies\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/autoreplies';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"welcome\":{\"active\":true,\"message\":\"This is an automatic reply sample message. See you soon!\"},\"away\":{\"active\":true,\"message\":\"Our team is not available at this time, please get in touch later.\",\"businessHours\":{\"monday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":19,\"minute\":30}}]},\"tuesday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":19,\"minute\":30}}]},\"wednesday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":19,\"minute\":30}}]},\"thursday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":21,\"minute\":0}}]},\"friday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":30},\"close\":{\"hour\":20,\"minute\":30}}]},\"saturday\":{\"mode\":\"24h_closed\"},\"sunday\":{\"mode\":\"24h_closed\"}}},\"follow\":[{\"active\":false,\"message\":\"Hi again! Is there anything else we can help you with?\"}]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update auto replies\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/autoreplies',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"welcome\":{\"active\":true,\"message\":\"This is an automatic reply sample message. See you soon!\"},\"away\":{\"active\":true,\"message\":\"Our team is not available at this time, please get in touch later.\",\"businessHours\":{\"monday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":19,\"minute\":30}}]},\"tuesday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":19,\"minute\":30}}]},\"wednesday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":19,\"minute\":30}}]},\"thursday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":21,\"minute\":0}}]},\"friday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":30},\"close\":{\"hour\":20,\"minute\":30}}]},\"saturday\":{\"mode\":\"24h_closed\"},\"sunday\":{\"mode\":\"24h_closed\"}}},\"follow\":[{\"active\":false,\"message\":\"Hi again! Is there anything else we can help you with?\"}]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Update auto replies\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/autoreplies\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"welcome\\\":{\\\"active\\\":true,\\\"message\\\":\\\"This is an automatic reply sample message. See you soon!\\\"},\\\"away\\\":{\\\"active\\\":true,\\\"message\\\":\\\"Our team is not available at this time, please get in touch later.\\\",\\\"businessHours\\\":{\\\"monday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":19,\\\"minute\\\":30}}]},\\\"tuesday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":19,\\\"minute\\\":30}}]},\\\"wednesday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":19,\\\"minute\\\":30}}]},\\\"thursday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":21,\\\"minute\\\":0}}]},\\\"friday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":30},\\\"close\\\":{\\\"hour\\\":20,\\\"minute\\\":30}}]},\\\"saturday\\\":{\\\"mode\\\":\\\"24h_closed\\\"},\\\"sunday\\\":{\\\"mode\\\":\\\"24h_closed\\\"}}},\\\"follow\\\":[{\\\"active\\\":false,\\\"message\\\":\\\"Hi again! Is there anything else we can help you with?\\\"}]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Update auto replies\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/autoreplies\"\n\n\tpayload := strings.NewReader(\"{\\\"welcome\\\":{\\\"active\\\":true,\\\"message\\\":\\\"This is an automatic reply sample message. See you soon!\\\"},\\\"away\\\":{\\\"active\\\":true,\\\"message\\\":\\\"Our team is not available at this time, please get in touch later.\\\",\\\"businessHours\\\":{\\\"monday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":19,\\\"minute\\\":30}}]},\\\"tuesday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":19,\\\"minute\\\":30}}]},\\\"wednesday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":19,\\\"minute\\\":30}}]},\\\"thursday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":21,\\\"minute\\\":0}}]},\\\"friday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":30},\\\"close\\\":{\\\"hour\\\":20,\\\"minute\\\":30}}]},\\\"saturday\\\":{\\\"mode\\\":\\\"24h_closed\\\"},\\\"sunday\\\":{\\\"mode\\\":\\\"24h_closed\\\"}}},\\\"follow\\\":[{\\\"active\\\":false,\\\"message\\\":\\\"Hi again! Is there anything else we can help you with?\\\"}]}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Update auto replies\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/autoreplies\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"welcome\\\":{\\\"active\\\":true,\\\"message\\\":\\\"This is an automatic reply sample message. See you soon!\\\"},\\\"away\\\":{\\\"active\\\":true,\\\"message\\\":\\\"Our team is not available at this time, please get in touch later.\\\",\\\"businessHours\\\":{\\\"monday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":19,\\\"minute\\\":30}}]},\\\"tuesday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":19,\\\"minute\\\":30}}]},\\\"wednesday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":19,\\\"minute\\\":30}}]},\\\"thursday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":21,\\\"minute\\\":0}}]},\\\"friday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":30},\\\"close\\\":{\\\"hour\\\":20,\\\"minute\\\":30}}]},\\\"saturday\\\":{\\\"mode\\\":\\\"24h_closed\\\"},\\\"sunday\\\":{\\\"mode\\\":\\\"24h_closed\\\"}}},\\\"follow\\\":[{\\\"active\\\":false,\\\"message\\\":\\\"Hi again! Is there anything else we can help you with?\\\"}]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Update auto replies\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/autoreplies\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"welcome\\\":{\\\"active\\\":true,\\\"message\\\":\\\"This is an automatic reply sample message. See you soon!\\\"},\\\"away\\\":{\\\"active\\\":true,\\\"message\\\":\\\"Our team is not available at this time, please get in touch later.\\\",\\\"businessHours\\\":{\\\"monday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":19,\\\"minute\\\":30}}]},\\\"tuesday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":19,\\\"minute\\\":30}}]},\\\"wednesday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":19,\\\"minute\\\":30}}]},\\\"thursday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":21,\\\"minute\\\":0}}]},\\\"friday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":30},\\\"close\\\":{\\\"hour\\\":20,\\\"minute\\\":30}}]},\\\"saturday\\\":{\\\"mode\\\":\\\"24h_closed\\\"},\\\"sunday\\\":{\\\"mode\\\":\\\"24h_closed\\\"}}},\\\"follow\\\":[{\\\"active\\\":false,\\\"message\\\":\\\"Hi again! Is there anything else we can help you with?\\\"}]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Update auto replies\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/devices/{deviceId}/autoreplies\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"welcome\\\":{\\\"active\\\":true,\\\"message\\\":\\\"This is an automatic reply sample message. See you soon!\\\"},\\\"away\\\":{\\\"active\\\":true,\\\"message\\\":\\\"Our team is not available at this time, please get in touch later.\\\",\\\"businessHours\\\":{\\\"monday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":19,\\\"minute\\\":30}}]},\\\"tuesday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":19,\\\"minute\\\":30}}]},\\\"wednesday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":19,\\\"minute\\\":30}}]},\\\"thursday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":21,\\\"minute\\\":0}}]},\\\"friday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":30},\\\"close\\\":{\\\"hour\\\":20,\\\"minute\\\":30}}]},\\\"saturday\\\":{\\\"mode\\\":\\\"24h_closed\\\"},\\\"sunday\\\":{\\\"mode\\\":\\\"24h_closed\\\"}}},\\\"follow\\\":[{\\\"active\\\":false,\\\"message\\\":\\\"Hi again! Is there anything else we can help you with?\\\"}]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Update auto replies\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"welcome\\\":{\\\"active\\\":true,\\\"message\\\":\\\"This is an automatic reply sample message. See you soon!\\\"},\\\"away\\\":{\\\"active\\\":true,\\\"message\\\":\\\"Our team is not available at this time, please get in touch later.\\\",\\\"businessHours\\\":{\\\"monday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":19,\\\"minute\\\":30}}]},\\\"tuesday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":19,\\\"minute\\\":30}}]},\\\"wednesday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":19,\\\"minute\\\":30}}]},\\\"thursday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":21,\\\"minute\\\":0}}]},\\\"friday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":30},\\\"close\\\":{\\\"hour\\\":20,\\\"minute\\\":30}}]},\\\"saturday\\\":{\\\"mode\\\":\\\"24h_closed\\\"},\\\"sunday\\\":{\\\"mode\\\":\\\"24h_closed\\\"}}},\\\"follow\\\":[{\\\"active\\\":false,\\\"message\\\":\\\"Hi again! Is there anything else we can help you with?\\\"}]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/autoreplies\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Update auto replies\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/autoreplies\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"welcome\\\":{\\\"active\\\":true,\\\"message\\\":\\\"This is an automatic reply sample message. See you soon!\\\"},\\\"away\\\":{\\\"active\\\":true,\\\"message\\\":\\\"Our team is not available at this time, please get in touch later.\\\",\\\"businessHours\\\":{\\\"monday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":19,\\\"minute\\\":30}}]},\\\"tuesday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":19,\\\"minute\\\":30}}]},\\\"wednesday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":19,\\\"minute\\\":30}}]},\\\"thursday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":0},\\\"close\\\":{\\\"hour\\\":21,\\\"minute\\\":0}}]},\\\"friday\\\":{\\\"mode\\\":\\\"hours\\\",\\\"hours\\\":[{\\\"open\\\":{\\\"hour\\\":9,\\\"minute\\\":30},\\\"close\\\":{\\\"hour\\\":20,\\\"minute\\\":30}}]},\\\"saturday\\\":{\\\"mode\\\":\\\"24h_closed\\\"},\\\"sunday\\\":{\\\"mode\\\":\\\"24h_closed\\\"}}},\\\"follow\\\":[{\\\"active\\\":false,\\\"message\\\":\\\"Hi again! Is there anything else we can help you with?\\\"}]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Update auto replies\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/autoreplies' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"welcome\":{\"active\":true,\"message\":\"This is an automatic reply sample message. See you soon!\"},\"away\":{\"active\":true,\"message\":\"Our team is not available at this time, please get in touch later.\",\"businessHours\":{\"monday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":19,\"minute\":30}}]},\"tuesday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":19,\"minute\":30}}]},\"wednesday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":19,\"minute\":30}}]},\"thursday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":0},\"close\":{\"hour\":21,\"minute\":0}}]},\"friday\":{\"mode\":\"hours\",\"hours\":[{\"open\":{\"hour\":9,\"minute\":30},\"close\":{\"hour\":20,\"minute\":30}}]},\"saturday\":{\"mode\":\"24h_closed\"},\"sunday\":{\"mode\":\"24h_closed\"}}},\"follow\":[{\"active\":false,\"message\":\"Hi again! Is there anything else we can help you with?\"}]}'"},{"lang":"ObjC","source":"// Update auto replies\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"welcome\": @{ @\"active\": @YES, @\"message\": @\"This is an automatic reply sample message. See you soon!\" },\n                              @\"away\": @{ @\"active\": @YES, @\"message\": @\"Our team is not available at this time, please get in touch later.\", @\"businessHours\": @{ @\"monday\": @{ @\"mode\": @\"hours\", @\"hours\": @[ @{ @\"open\": @{ @\"hour\": @9, @\"minute\": @0 }, @\"close\": @{ @\"hour\": @19, @\"minute\": @30 } } ] }, @\"tuesday\": @{ @\"mode\": @\"hours\", @\"hours\": @[ @{ @\"open\": @{ @\"hour\": @9, @\"minute\": @0 }, @\"close\": @{ @\"hour\": @19, @\"minute\": @30 } } ] }, @\"wednesday\": @{ @\"mode\": @\"hours\", @\"hours\": @[ @{ @\"open\": @{ @\"hour\": @9, @\"minute\": @0 }, @\"close\": @{ @\"hour\": @19, @\"minute\": @30 } } ] }, @\"thursday\": @{ @\"mode\": @\"hours\", @\"hours\": @[ @{ @\"open\": @{ @\"hour\": @9, @\"minute\": @0 }, @\"close\": @{ @\"hour\": @21, @\"minute\": @0 } } ] }, @\"friday\": @{ @\"mode\": @\"hours\", @\"hours\": @[ @{ @\"open\": @{ @\"hour\": @9, @\"minute\": @30 }, @\"close\": @{ @\"hour\": @20, @\"minute\": @30 } } ] }, @\"saturday\": @{ @\"mode\": @\"24h_closed\" }, @\"sunday\": @{ @\"mode\": @\"24h_closed\" } } },\n                              @\"follow\": @[ @{ @\"active\": @NO, @\"message\": @\"Hi again! Is there anything else we can help you with?\" } ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/autoreplies\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Update auto replies\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"welcome\": [\n    \"active\": true,\n    \"message\": \"This is an automatic reply sample message. See you soon!\"\n  ],\n  \"away\": [\n    \"active\": true,\n    \"message\": \"Our team is not available at this time, please get in touch later.\",\n    \"businessHours\": [\n      \"monday\": [\n        \"mode\": \"hours\",\n        \"hours\": [\n          [\n            \"open\": [\n              \"hour\": 9,\n              \"minute\": 0\n            ],\n            \"close\": [\n              \"hour\": 19,\n              \"minute\": 30\n            ]\n          ]\n        ]\n      ],\n      \"tuesday\": [\n        \"mode\": \"hours\",\n        \"hours\": [\n          [\n            \"open\": [\n              \"hour\": 9,\n              \"minute\": 0\n            ],\n            \"close\": [\n              \"hour\": 19,\n              \"minute\": 30\n            ]\n          ]\n        ]\n      ],\n      \"wednesday\": [\n        \"mode\": \"hours\",\n        \"hours\": [\n          [\n            \"open\": [\n              \"hour\": 9,\n              \"minute\": 0\n            ],\n            \"close\": [\n              \"hour\": 19,\n              \"minute\": 30\n            ]\n          ]\n        ]\n      ],\n      \"thursday\": [\n        \"mode\": \"hours\",\n        \"hours\": [\n          [\n            \"open\": [\n              \"hour\": 9,\n              \"minute\": 0\n            ],\n            \"close\": [\n              \"hour\": 21,\n              \"minute\": 0\n            ]\n          ]\n        ]\n      ],\n      \"friday\": [\n        \"mode\": \"hours\",\n        \"hours\": [\n          [\n            \"open\": [\n              \"hour\": 9,\n              \"minute\": 30\n            ],\n            \"close\": [\n              \"hour\": 20,\n              \"minute\": 30\n            ]\n          ]\n        ]\n      ],\n      \"saturday\": [\"mode\": \"24h_closed\"],\n      \"sunday\": [\"mode\": \"24h_closed\"]\n    ]\n  ],\n  \"follow\": [\n    [\n      \"active\": false,\n      \"message\": \"Hi again! Is there anything else we can help you with?\"\n    ]\n  ]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/autoreplies\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/autoassign":{"parameters":[],"get":{"summary":"Get chats auto-assignment","description":"Get chats automatic assignment configuration for the specific WhatsApp number.\n\n\n\nAutomatic chat assignment allows you to the internal criteria on which chats will be automatically assigned to your team members.\n\n\n\n**Supported configuration options:**\n\n\n\n- **offline** `boolean`: Enable or disable assigning chats to offline or unavailable users.\n\n- **reassign** `boolean`: Enable or disable re-assigning chats if the previously assigned user is not online or available\n\n- **excludeRoles** `array[string]`: Optional list user roles to always exclude from the chat automatic assignment.\n\n- **excludeUsers** `array[string]`: Optional list user IDs to always exclude from the chat automatic assignment.\n\n- **labels** `array[string]`: Optional list of labels that will be added to automatically assigned chats by the system.\n\n\n\n**Important**: automatic assignment feature is only available for numbers using the Platform Business and Enterprise plans.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fautoassign)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getChatAutoAssignment","security":[{"apiKey":[]}],"tags":["Automatic Assignment"],"responses":{"200":{"description":"Current automatic assignment configuration","schema":{"type":"object","properties":{"active":{"type":"boolean","description":"Enable or disable chats automatic assignment policy"},"online":{"type":"boolean","description":"Only automatically assign chats to online users. Cannot be used with `away`, `unavailable` or `offline` options."},"away":{"type":"boolean","description":"Enable or disable assigning chats to `away` users who have been inactive for more than 5 minutes."},"unavailable":{"type":"boolean","description":"Enable or disable assigning chats to users with `unavailable` status, whether they are online or not."},"offline":{"type":"boolean","description":"Enable or disable assigning chats to offline users who have been inactive for more than 5 minutes."},"reassign":{"type":"boolean","description":"Enable or disable re-assigning chats if the previously assigned user is not online or available"},"reassignOptions":{"type":"object","properties":{"resolved":{"type":"boolean","description":"Reassign resolved chats if the currently assigned user is not online or available. Defaults to: `false`"},"active":{"type":"boolean","description":"Re-assign active not yet resolved chats if the currently assigned user is not online or available. Defaults to: `false`"},"unassign":{"type":"boolean","description":"Unassign chats if there are no available users to be eligible for re-assignment. Defaults to: `false`"},"labels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Skip chats reassignment if any of the following labels is present in the chat."}},"additionalProperties":false,"description":"If `reassign` is `true`, optionally define custom chat re-assignment options."},"excludeRoles":{"type":"array","items":{"type":"string","enum":["admin","supervisor","agent"]},"minItems":0,"maxItems":3,"description":"Optional list user roles to always exclude from the chat automatic assignment."},"excludeUsers":{"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"User unique ID to exclude (24 characters hexadecimal string)"},"minItems":0,"maxItems":100,"description":"Optional list user IDs to always exclude from the chat automatic assignment."},"excludeDepartments":{"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Department unique ID to exclude (24 characters hexadecimal string)"},"minItems":0,"maxItems":10,"description":"Optional list department IDs to always exclude from the chat automatic assignment, including its team members"},"excludeNumbers":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":0,"maxItems":50,"description":"Optional list of phone numbers to be exclude from automatic chat assignment. The phone number must be in E.164 format, for example: +16001234560"},"labels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Optional list of labels that will be added to automatically assigned chats by the system."}},"required":["active"],"additionalProperties":false}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unauthorized user or missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Feature not available in current plan","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get chats automatic assignment configuration for the current WhatsApp number\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/autoassign \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get chats automatic assignment configuration for the current WhatsApp number\nhttp GET https://api.wassenger.com/v1/devices/{deviceId}/autoassign \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get chats automatic assignment configuration for the current WhatsApp number\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/autoassign';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get chats automatic assignment configuration for the current WhatsApp number\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/autoassign',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get chats automatic assignment configuration for the current WhatsApp number\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/autoassign');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get chats automatic assignment configuration for the current WhatsApp number\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}/autoassign', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get chats automatic assignment configuration for the current WhatsApp number\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/autoassign');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get chats automatic assignment configuration for the current WhatsApp number\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/autoassign\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get chats automatic assignment configuration for the current WhatsApp number\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/autoassign\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get chats automatic assignment configuration for the current WhatsApp number\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/autoassign';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get chats automatic assignment configuration for the current WhatsApp number\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/autoassign',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get chats automatic assignment configuration for the current WhatsApp number\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/autoassign\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get chats automatic assignment configuration for the current WhatsApp number\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/autoassign\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get chats automatic assignment configuration for the current WhatsApp number\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/autoassign\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get chats automatic assignment configuration for the current WhatsApp number\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/autoassign\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get chats automatic assignment configuration for the current WhatsApp number\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}/autoassign\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get chats automatic assignment configuration for the current WhatsApp number\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/autoassign\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get chats automatic assignment configuration for the current WhatsApp number\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/autoassign\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get chats automatic assignment configuration for the current WhatsApp number\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/autoassign' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get chats automatic assignment configuration for the current WhatsApp number\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/autoassign\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get chats automatic assignment configuration for the current WhatsApp number\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/autoassign\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Update chats auto-assignment","description":"Enable/disable and update chats automatic assignment configuration for the current WhatsApp number.\n\n\n\nAutomatic chat assignment allows you to the internal criteria on which chats will be automatically assigned to your team members.\n\n\n\n**Supported configuration options:**\n\n\n\n- **offline** `boolean`: Enable or disable assigning chats to offline or unavailable users.\n\n- **reassign** `boolean`: Enable or disable re-assigning chats if the previously assigned user is not online or available\n\n- **excludeRoles** `array[string]`: Optional list user roles to always exclude from the chat automatic assignment.\n\n- **excludeUsers** `array[string]`: Optional list user IDs to always exclude from the chat automatic assignment.\n\n- **labels** `array[string]`: Optional list of labels that will be added to automatically assigned chats by the system.\n\n\n\n**Important**: automatic assignment feature is only available for numbers using the Platform Business and Enterprise plans.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fautoassign&method=PATCH&body=%7B%0A%20%20%22active%22%3A%20true%2C%0A%20%20%22offline%22%3A%20true%2C%0A%20%20%22reassign%22%3A%20true%2C%0A%20%20%22labels%22%3A%20%5B%0A%20%20%20%20%22label1%22%2C%0A%20%20%20%20%22label2%22%0A%20%20%5D%2C%0A%20%20%22excludeRoles%22%3A%20%5B%0A%20%20%20%20%22admin%22%0A%20%20%5D%2C%0A%20%20%22excludeUsers%22%3A%20%5B%5D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateChatAutoAssignment","security":[{"apiKey":[]}],"tags":["Automatic Assignment"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"autoAssign","schema":{"type":"object","properties":{"active":{"type":"boolean","description":"Enable or disable chats automatic assignment policy"},"online":{"type":"boolean","description":"Only automatically assign chats to online users. Cannot be used with `away`, `unavailable` or `offline` options."},"away":{"type":"boolean","description":"Enable or disable assigning chats to `away` users who have been inactive for more than 5 minutes."},"unavailable":{"type":"boolean","description":"Enable or disable assigning chats to users with `unavailable` status, whether they are online or not."},"offline":{"type":"boolean","description":"Enable or disable assigning chats to offline users who have been inactive for more than 5 minutes."},"reassign":{"type":"boolean","description":"Enable or disable re-assigning chats if the previously assigned user is not online or available"},"reassignOptions":{"type":"object","properties":{"resolved":{"type":"boolean","description":"Reassign resolved chats if the currently assigned user is not online or available. Defaults to: `false`"},"active":{"type":"boolean","description":"Re-assign active not yet resolved chats if the currently assigned user is not online or available. Defaults to: `false`"},"unassign":{"type":"boolean","description":"Unassign chats if there are no available users to be eligible for re-assignment. Defaults to: `false`"},"labels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Skip chats reassignment if any of the following labels is present in the chat."}},"additionalProperties":false,"description":"If `reassign` is `true`, optionally define custom chat re-assignment options."},"excludeRoles":{"type":"array","items":{"type":"string","enum":["admin","supervisor","agent"]},"minItems":0,"maxItems":3,"description":"Optional list user roles to always exclude from the chat automatic assignment."},"excludeUsers":{"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"User unique ID to exclude (24 characters hexadecimal string)"},"minItems":0,"maxItems":100,"description":"Optional list user IDs to always exclude from the chat automatic assignment."},"excludeDepartments":{"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Department unique ID to exclude (24 characters hexadecimal string)"},"minItems":0,"maxItems":10,"description":"Optional list department IDs to always exclude from the chat automatic assignment, including its team members"},"excludeNumbers":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":0,"maxItems":50,"description":"Optional list of phone numbers to be exclude from automatic chat assignment. The phone number must be in E.164 format, for example: +16001234560"},"labels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Optional list of labels that will be added to automatically assigned chats by the system."}},"required":["active"],"additionalProperties":false}}],"responses":{"200":{"description":"Automatic assignment configuration updated successfully","schema":{"type":"object","properties":{"active":{"type":"boolean","description":"Enable or disable chats automatic assignment policy"},"online":{"type":"boolean","description":"Only automatically assign chats to online users. Cannot be used with `away`, `unavailable` or `offline` options."},"away":{"type":"boolean","description":"Enable or disable assigning chats to `away` users who have been inactive for more than 5 minutes."},"unavailable":{"type":"boolean","description":"Enable or disable assigning chats to users with `unavailable` status, whether they are online or not."},"offline":{"type":"boolean","description":"Enable or disable assigning chats to offline users who have been inactive for more than 5 minutes."},"reassign":{"type":"boolean","description":"Enable or disable re-assigning chats if the previously assigned user is not online or available"},"reassignOptions":{"type":"object","properties":{"resolved":{"type":"boolean","description":"Reassign resolved chats if the currently assigned user is not online or available. Defaults to: `false`"},"active":{"type":"boolean","description":"Re-assign active not yet resolved chats if the currently assigned user is not online or available. Defaults to: `false`"},"unassign":{"type":"boolean","description":"Unassign chats if there are no available users to be eligible for re-assignment. Defaults to: `false`"},"labels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Skip chats reassignment if any of the following labels is present in the chat."}},"additionalProperties":false,"description":"If `reassign` is `true`, optionally define custom chat re-assignment options."},"excludeRoles":{"type":"array","items":{"type":"string","enum":["admin","supervisor","agent"]},"minItems":0,"maxItems":3,"description":"Optional list user roles to always exclude from the chat automatic assignment."},"excludeUsers":{"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"User unique ID to exclude (24 characters hexadecimal string)"},"minItems":0,"maxItems":100,"description":"Optional list user IDs to always exclude from the chat automatic assignment."},"excludeDepartments":{"type":"array","items":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Department unique ID to exclude (24 characters hexadecimal string)"},"minItems":0,"maxItems":10,"description":"Optional list department IDs to always exclude from the chat automatic assignment, including its team members"},"excludeNumbers":{"type":"array","items":{"type":"string","minLength":8,"maxLength":16},"minItems":0,"maxItems":50,"description":"Optional list of phone numbers to be exclude from automatic chat assignment. The phone number must be in E.164 format, for example: +16001234560"},"labels":{"type":"array","items":{"type":"string","minLength":1,"maxLength":30},"minItems":0,"maxItems":5,"description":"Optional list of labels that will be added to automatically assigned chats by the system."}},"required":["active"],"additionalProperties":false}},"400":{"description":"Invalid or missing body fields","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unauthorized user or missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict - invalid or unsupported feature in your plan","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Update chats automatic assignment configuration for the current WhatsApp number\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/autoassign \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"active\":true,\"offline\":true,\"reassign\":true,\"labels\":[\"label1\",\"label2\"],\"excludeRoles\":[\"admin\"],\"excludeUsers\":[]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Update chats automatic assignment configuration for the current WhatsApp number\necho '{\"active\":true,\"offline\":true,\"reassign\":true,\"labels\":[\"label1\",\"label2\"],\"excludeRoles\":[\"admin\"],\"excludeUsers\":[]}' |  \\\n  http PATCH https://api.wassenger.com/v1/devices/{deviceId}/autoassign \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Update chats automatic assignment configuration for the current WhatsApp number\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/autoassign';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"active\":true,\"offline\":true,\"reassign\":true,\"labels\":[\"label1\",\"label2\"],\"excludeRoles\":[\"admin\"],\"excludeUsers\":[]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Update chats automatic assignment configuration for the current WhatsApp number\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/autoassign',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    active: true,\n    offline: true,\n    reassign: true,\n    labels: ['label1', 'label2'],\n    excludeRoles: ['admin'],\n    excludeUsers: []\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Update chats automatic assignment configuration for the current WhatsApp number\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/autoassign');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  active: true,\n  offline: true,\n  reassign: true,\n  labels: [\n    'label1',\n    'label2'\n  ],\n  excludeRoles: [\n    'admin'\n  ],\n  excludeUsers: []\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Update chats automatic assignment configuration for the current WhatsApp number\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}/autoassign', [\n  'body' => '{\"active\":true,\"offline\":true,\"reassign\":true,\"labels\":[\"label1\",\"label2\"],\"excludeRoles\":[\"admin\"],\"excludeUsers\":[]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Update chats automatic assignment configuration for the current WhatsApp number\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'active' => null,\n  'offline' => null,\n  'reassign' => null,\n  'labels' => [\n    'label1',\n    'label2'\n  ],\n  'excludeRoles' => [\n    'admin'\n  ],\n  'excludeUsers' => [\n    \n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/autoassign');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Update chats automatic assignment configuration for the current WhatsApp number\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/autoassign\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'active' => null,\n    'offline' => null,\n    'reassign' => null,\n    'labels' => [\n        'label1',\n        'label2'\n    ],\n    'excludeRoles' => [\n        'admin'\n    ],\n    'excludeUsers' => [\n        \n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Update chats automatic assignment configuration for the current WhatsApp number\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/autoassign\"\n\npayload = {\n    \"active\": True,\n    \"offline\": True,\n    \"reassign\": True,\n    \"labels\": [\"label1\", \"label2\"],\n    \"excludeRoles\": [\"admin\"],\n    \"excludeUsers\": []\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update chats automatic assignment configuration for the current WhatsApp number\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/autoassign';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"active\":true,\"offline\":true,\"reassign\":true,\"labels\":[\"label1\",\"label2\"],\"excludeRoles\":[\"admin\"],\"excludeUsers\":[]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update chats automatic assignment configuration for the current WhatsApp number\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/autoassign',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"active\":true,\"offline\":true,\"reassign\":true,\"labels\":[\"label1\",\"label2\"],\"excludeRoles\":[\"admin\"],\"excludeUsers\":[]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Update chats automatic assignment configuration for the current WhatsApp number\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/autoassign\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"active\\\":true,\\\"offline\\\":true,\\\"reassign\\\":true,\\\"labels\\\":[\\\"label1\\\",\\\"label2\\\"],\\\"excludeRoles\\\":[\\\"admin\\\"],\\\"excludeUsers\\\":[]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Update chats automatic assignment configuration for the current WhatsApp number\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/autoassign\"\n\n\tpayload := strings.NewReader(\"{\\\"active\\\":true,\\\"offline\\\":true,\\\"reassign\\\":true,\\\"labels\\\":[\\\"label1\\\",\\\"label2\\\"],\\\"excludeRoles\\\":[\\\"admin\\\"],\\\"excludeUsers\\\":[]}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Update chats automatic assignment configuration for the current WhatsApp number\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/autoassign\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"active\\\":true,\\\"offline\\\":true,\\\"reassign\\\":true,\\\"labels\\\":[\\\"label1\\\",\\\"label2\\\"],\\\"excludeRoles\\\":[\\\"admin\\\"],\\\"excludeUsers\\\":[]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Update chats automatic assignment configuration for the current WhatsApp number\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/autoassign\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"active\\\":true,\\\"offline\\\":true,\\\"reassign\\\":true,\\\"labels\\\":[\\\"label1\\\",\\\"label2\\\"],\\\"excludeRoles\\\":[\\\"admin\\\"],\\\"excludeUsers\\\":[]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Update chats automatic assignment configuration for the current WhatsApp number\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/devices/{deviceId}/autoassign\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"active\\\":true,\\\"offline\\\":true,\\\"reassign\\\":true,\\\"labels\\\":[\\\"label1\\\",\\\"label2\\\"],\\\"excludeRoles\\\":[\\\"admin\\\"],\\\"excludeUsers\\\":[]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Update chats automatic assignment configuration for the current WhatsApp number\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"active\\\":true,\\\"offline\\\":true,\\\"reassign\\\":true,\\\"labels\\\":[\\\"label1\\\",\\\"label2\\\"],\\\"excludeRoles\\\":[\\\"admin\\\"],\\\"excludeUsers\\\":[]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/autoassign\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Update chats automatic assignment configuration for the current WhatsApp number\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/autoassign\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"active\\\":true,\\\"offline\\\":true,\\\"reassign\\\":true,\\\"labels\\\":[\\\"label1\\\",\\\"label2\\\"],\\\"excludeRoles\\\":[\\\"admin\\\"],\\\"excludeUsers\\\":[]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Update chats automatic assignment configuration for the current WhatsApp number\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/autoassign' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"active\":true,\"offline\":true,\"reassign\":true,\"labels\":[\"label1\",\"label2\"],\"excludeRoles\":[\"admin\"],\"excludeUsers\":[]}'"},{"lang":"ObjC","source":"// Update chats automatic assignment configuration for the current WhatsApp number\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"active\": @YES,\n                              @\"offline\": @YES,\n                              @\"reassign\": @YES,\n                              @\"labels\": @[ @\"label1\", @\"label2\" ],\n                              @\"excludeRoles\": @[ @\"admin\" ],\n                              @\"excludeUsers\": @[  ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/autoassign\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Update chats automatic assignment configuration for the current WhatsApp number\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"active\": true,\n  \"offline\": true,\n  \"reassign\": true,\n  \"labels\": [\"label1\", \"label2\"],\n  \"excludeRoles\": [\"admin\"],\n  \"excludeUsers\": []\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/autoassign\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}/authcode":{"parameters":[],"post":{"description":"Request authentication code for the WhatsApp number session pairing via code verification, [instead of using QR code pairing](#operation/scanQR).\n\n\n\nWhen requesting the auth code, the system will send a verificaiton code request to the WhatsApp number mobile app that the user should approve and verify by entering the provided 8 characters authentication code.\n\n\n\nThis is an alternative number pairing method that does not require to use the camera and QR scan in order to pair the WhatsApp number session to the system.\n\n\n\n**Note**: you can specify a phone number to send the pairing code to speciyfing it in the JSON POST payload `phone` field. If no phone is provided, the previously connected phone number to the device will be used by default.\n\n\n\nIf the session is already authenticated, the API will return an error unless you specify the query param `?force=true`, in which case the previous session will be closed and a new one will be created.\n\n\n\nOnce the code is entered in the app, the API answers `409` with `errorCode: session:syncing` while WhatsApp loads the first synchronization, which can take a few minutes: stop requesting codes and wait until the number is online.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D%2Fauthcode&method=POST&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"requestNumberAuthCode","security":[{"apiKey":[]}],"tags":["Session"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"query","name":"force","type":"boolean","default":false,"description":"If `true`, forces to destroy and log out the existing WhatsApp session, and request a new auth code code. This will cause the session to forcely become unauthorized (logout) and require a new number session pairing."},{"in":"body","name":"phone","description":"Phone number to pair send the pairing code to","schema":{"type":"object","properties":{"phone":{"type":"string","minLength":8,"maxLength":16,"description":"Required if the device was never connected. Phone number to send the authorization code to. The phone number must be in E.164 format, for example: +16001234560"}},"additionalProperties":false}}],"responses":{"200":{"description":"Authentication code requested","schema":{"type":"object","properties":{"code":{"type":"string","description":"8 characters authentication code to be entered in the WhatsApp mobile app"}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Required permissions or number not previously paired via QR","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Number already linked: online, or paired and still syncing (`errorCode: session:syncing`)","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many scan requests","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"summary":"Request pairing code","x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Request number auth code to a WhatsApp number\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/devices/{deviceId}/authcode \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Request number auth code to a WhatsApp number\nhttp POST https://api.wassenger.com/v1/devices/{deviceId}/authcode \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Request number auth code to a WhatsApp number\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/authcode';\nconst options = {method: 'POST', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Request number auth code to a WhatsApp number\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/authcode',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Request number auth code to a WhatsApp number\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/authcode');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Request number auth code to a WhatsApp number\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/devices/{deviceId}/authcode', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Request number auth code to a WhatsApp number\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}/authcode');\n$request->setRequestMethod('POST');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Request number auth code to a WhatsApp number\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}/authcode\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Request number auth code to a WhatsApp number\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}/authcode\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.post(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Request number auth code to a WhatsApp number\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}/authcode';\nconst options = {method: 'POST', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Request number auth code to a WhatsApp number\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}/authcode',\n  method: 'POST',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Request number auth code to a WhatsApp number\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}/authcode\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Request number auth code to a WhatsApp number\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}/authcode\"\n\n\treq, _ := http.NewRequest(\"POST\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Request number auth code to a WhatsApp number\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}/authcode\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Request number auth code to a WhatsApp number\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}/authcode\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Request number auth code to a WhatsApp number\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/devices/{deviceId}/authcode\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Request number auth code to a WhatsApp number\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}/authcode\")\n  .post(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Request number auth code to a WhatsApp number\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}/authcode\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Request number auth code to a WhatsApp number\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}/authcode' -Method POST -Headers $headers"},{"lang":"ObjC","source":"// Request number auth code to a WhatsApp number\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}/authcode\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Request number auth code to a WhatsApp number\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}/authcode\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/devices/{deviceId}":{"parameters":[],"get":{"summary":"Get number by ID","description":"Retrieve WhatsApp number information by ID\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getDeviceById","security":[{"apiKey":[]}],"tags":["Devices"],"produces":["application/json"],"parameters":[{"in":"query","name":"include","type":"array","collectionFormat":"csv","description":"Include optional additional subentities in the response object, such as the list of available chat agents, WhatsApp business catalog and quick reply entries","items":{"type":"string","enum":["agents","quickReplies","catalog","autoReplies"]}},{"in":"query","name":"exclude","type":"array","collectionFormat":"csv","description":"Exclude optional subdocuments in the response object","items":{"type":"string","enum":["webhooks"]}}],"responses":{"200":{"description":"Number information","schema":{"$ref":"#/definitions/device"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get number by ID\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/devices/{deviceId} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get number by ID\nhttp GET https://api.wassenger.com/v1/devices/{deviceId} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get number by ID\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get number by ID\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get number by ID\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/devices/{deviceId}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get number by ID\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/devices/{deviceId}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get number by ID\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get number by ID\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get number by ID\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get number by ID\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get number by ID\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get number by ID\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get number by ID\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get number by ID\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get number by ID\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get number by ID\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/devices/{deviceId}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get number by ID\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get number by ID\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get number by ID\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get number by ID\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get number by ID\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"description":"Update WhatsApp number information and settings by ID\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D&method=PATCH&body=%7B%0A%20%20%22alias%22%3A%20%22My%20Business%20Name%22%2C%0A%20%20%22description%22%3A%20%22This%20is%20an%20optional%20description%20to%20identify%20the%20number%22%2C%0A%20%20%22billingPlan%22%3A%20%22io-professional%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateDevice","security":[{"apiKey":[]}],"tags":["Devices"],"produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"number","description":"Update number","schema":{"type":"object","properties":{"enable":{"type":"boolean"},"alias":{"type":"string","minLength":2,"maxLength":30},"description":{"type":"string","maxLength":80},"plan":{"type":"string","enum":["business","enterprise","professional","gateway-business","gateway-enterprise","gateway-professional","io-professional","io-business","io-enterprise"],"description":"Optionally upgrade or downgrade the billing plan. Note that charges may apply by upgrading the plan. Trial subscriptions are not allowed to change plan and will return an error, only paid subscriptions are allowed."},"settings":{"type":"object","properties":{"rebootPolicy":{"type":"string","enum":["disabled","10m","15m","20m","25m","30m","45m","1h","2h","3h","4h","5h","6h","8h","10h","12h","18h"],"description":"Defines the device session reboot policy. Disabled by default. You can enable it to force a session reboot of your device every period of time, starting from 1 hour up to 24 hours. This might prevent your device session to experience performance or memory issues, especially in Platform devices where session are long running for hours or even days. Reboot will cause up to 2 minutes downtime and message processing delay, but no messages will be lost during the process."},"retentionPolicy":{"type":"string","enum":["plan_defaults","never","5m","15m","30m","1h","12h","24h","2d","3d","4d","5d","6d","7d","10d"],"description":"Defines the data retention policy used for current device data, including messages, chats, contacts and files. This does not affect your device physical device data."},"deliverySpeed":{"type":"number","format":"float","enum":[150,140,120,100,90,80,70,60,50,40,30,20,15,12,10,9,8,7,6,5,4,3,2,1,0.9,0.8,0.7,0.6,0.5,0.4,0.3,0.2,0.1,0],"description":"Maximum allowed message delivery speed per minute in the current device. Use \"0\" for default plan limit. A different maximum delivery speed applies per subscription plan. See plan features for more details."},"assignChatOnReply":{"type":"boolean","description":"Assign a chat to the agent who replies to it when the chat has no assignee. Enabled by default. This is not the automatic assignment policy: it runs on every reply sent from the Web Console regardless of that policy, which is why turning automatic assignment off does not stop it."},"operativeHours":{"type":"object","properties":{"enable":{"type":"boolean","description":"Enable or disable operative hours for the device"},"timezone":{"type":"string","minLength":2,"maxLength":40,"enum":["Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmara","Africa/Asmera","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Timbuktu","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/ComodRivadavia","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Aruba","America/Asuncion","America/Atikokan","America/Atka","America/Bahia","America/Bahia_Banderas","America/Barbados","America/Belem","America/Belize","America/Blanc-Sablon","America/Boa_Vista","America/Bogota","America/Boise","America/Buenos_Aires","America/Cambridge_Bay","America/Campo_Grande","America/Cancun","America/Caracas","America/Catamarca","America/Cayenne","America/Cayman","America/Chicago","America/Chihuahua","America/Ciudad_Juarez","America/Coral_Harbour","America/Cordoba","America/Costa_Rica","America/Coyhaique","America/Creston","America/Cuiaba","America/Curacao","America/Danmarkshavn","America/Dawson","America/Dawson_Creek","America/Denver","America/Detroit","America/Dominica","America/Edmonton","America/Eirunepe","America/El_Salvador","America/Ensenada","America/Fort_Nelson","America/Fort_Wayne","America/Fortaleza","America/Glace_Bay","America/Godthab","America/Goose_Bay","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guatemala","America/Guayaquil","America/Guyana","America/Halifax","America/Havana","America/Hermosillo","America/Indiana/Indianapolis","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Indianapolis","America/Inuvik","America/Iqaluit","America/Jamaica","America/Jujuy","America/Juneau","America/Kentucky/Louisville","America/Kentucky/Monticello","America/Knox_IN","America/Kralendijk","America/La_Paz","America/Lima","America/Los_Angeles","America/Louisville","America/Lower_Princes","America/Maceio","America/Managua","America/Manaus","America/Marigot","America/Martinique","America/Matamoros","America/Mazatlan","America/Mendoza","America/Menominee","America/Merida","America/Metlakatla","America/Mexico_City","America/Miquelon","America/Moncton","America/Monterrey","America/Montevideo","America/Montreal","America/Montserrat","America/Nassau","America/New_York","America/Nipigon","America/Nome","America/Noronha","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Nuuk","America/Ojinaga","America/Panama","America/Pangnirtung","America/Paramaribo","America/Phoenix","America/Port-au-Prince","America/Port_of_Spain","America/Porto_Acre","America/Porto_Velho","America/Puerto_Rico","America/Punta_Arenas","America/Rainy_River","America/Rankin_Inlet","America/Recife","America/Regina","America/Resolute","America/Rio_Branco","America/Rosario","America/Santa_Isabel","America/Santarem","America/Santiago","America/Santo_Domingo","America/Sao_Paulo","America/Scoresbysund","America/Shiprock","America/Sitka","America/St_Barthelemy","America/St_Johns","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Swift_Current","America/Tegucigalpa","America/Thule","America/Thunder_Bay","America/Tijuana","America/Toronto","America/Tortola","America/Vancouver","America/Virgin","America/Whitehorse","America/Winnipeg","America/Yakutat","America/Yellowknife","Antarctica/Casey","Antarctica/Davis","Antarctica/DumontDUrville","Antarctica/Macquarie","Antarctica/Mawson","Antarctica/McMurdo","Antarctica/Palmer","Antarctica/Rothera","Antarctica/South_Pole","Antarctica/Syowa","Antarctica/Troll","Antarctica/Vostok","Arctic/Longyearbyen","Asia/Aden","Asia/Almaty","Asia/Amman","Asia/Anadyr","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Ashkhabad","Asia/Atyrau","Asia/Baghdad","Asia/Bahrain","Asia/Baku","Asia/Bangkok","Asia/Barnaul","Asia/Beirut","Asia/Bishkek","Asia/Brunei","Asia/Calcutta","Asia/Chita","Asia/Choibalsan","Asia/Chongqing","Asia/Chungking","Asia/Colombo","Asia/Dacca","Asia/Damascus","Asia/Dhaka","Asia/Dili","Asia/Dubai","Asia/Dushanbe","Asia/Famagusta","Asia/Gaza","Asia/Harbin","Asia/Hebron","Asia/Ho_Chi_Minh","Asia/Hong_Kong","Asia/Hovd","Asia/Irkutsk","Asia/Istanbul","Asia/Jakarta","Asia/Jayapura","Asia/Jerusalem","Asia/Kabul","Asia/Kamchatka","Asia/Karachi","Asia/Kashgar","Asia/Kathmandu","Asia/Katmandu","Asia/Khandyga","Asia/Kolkata","Asia/Krasnoyarsk","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Kuwait","Asia/Macao","Asia/Macau","Asia/Magadan","Asia/Makassar","Asia/Manila","Asia/Muscat","Asia/Nicosia","Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk","Asia/Oral","Asia/Phnom_Penh","Asia/Pontianak","Asia/Pyongyang","Asia/Qatar","Asia/Qostanay","Asia/Qyzylorda","Asia/Rangoon","Asia/Riyadh","Asia/Saigon","Asia/Sakhalin","Asia/Samarkand","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Srednekolymsk","Asia/Taipei","Asia/Tashkent","Asia/Tbilisi","Asia/Tehran","Asia/Tel_Aviv","Asia/Thimbu","Asia/Thimphu","Asia/Tokyo","Asia/Tomsk","Asia/Ujung_Pandang","Asia/Ulaanbaatar","Asia/Ulan_Bator","Asia/Urumqi","Asia/Ust-Nera","Asia/Vientiane","Asia/Vladivostok","Asia/Yakutsk","Asia/Yangon","Asia/Yekaterinburg","Asia/Yerevan","Atlantic/Azores","Atlantic/Bermuda","Atlantic/Canary","Atlantic/Cape_Verde","Atlantic/Faeroe","Atlantic/Faroe","Atlantic/Jan_Mayen","Atlantic/Madeira","Atlantic/Reykjavik","Atlantic/South_Georgia","Atlantic/St_Helena","Atlantic/Stanley","Australia/ACT","Australia/Adelaide","Australia/Brisbane","Australia/Broken_Hill","Australia/Canberra","Australia/Currie","Australia/Darwin","Australia/Eucla","Australia/Hobart","Australia/LHI","Australia/Lindeman","Australia/Lord_Howe","Australia/Melbourne","Australia/NSW","Australia/North","Australia/Perth","Australia/Queensland","Australia/South","Australia/Sydney","Australia/Tasmania","Australia/Victoria","Australia/West","Australia/Yancowinna","Brazil/Acre","Brazil/DeNoronha","Brazil/East","Brazil/West","CET","CST6CDT","Canada/Atlantic","Canada/Central","Canada/Eastern","Canada/Mountain","Canada/Newfoundland","Canada/Pacific","Canada/Saskatchewan","Canada/Yukon","Chile/Continental","Chile/EasterIsland","Cuba","EET","EST","EST5EDT","Egypt","Eire","Etc/GMT","Etc/GMT+0","Etc/GMT+1","Etc/GMT+10","Etc/GMT+11","Etc/GMT+12","Etc/GMT+2","Etc/GMT+3","Etc/GMT+4","Etc/GMT+5","Etc/GMT+6","Etc/GMT+7","Etc/GMT+8","Etc/GMT+9","Etc/GMT-0","Etc/GMT-1","Etc/GMT-10","Etc/GMT-11","Etc/GMT-12","Etc/GMT-13","Etc/GMT-14","Etc/GMT-2","Etc/GMT-3","Etc/GMT-4","Etc/GMT-5","Etc/GMT-6","Etc/GMT-7","Etc/GMT-8","Etc/GMT-9","Etc/GMT0","Etc/Greenwich","Etc/UCT","Etc/UTC","Etc/Universal","Etc/Zulu","Europe/Amsterdam","Europe/Andorra","Europe/Astrakhan","Europe/Athens","Europe/Belfast","Europe/Belgrade","Europe/Berlin","Europe/Bratislava","Europe/Brussels","Europe/Bucharest","Europe/Budapest","Europe/Busingen","Europe/Chisinau","Europe/Copenhagen","Europe/Dublin","Europe/Gibraltar","Europe/Guernsey","Europe/Helsinki","Europe/Isle_of_Man","Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kiev","Europe/Kirov","Europe/Kyiv","Europe/Lisbon","Europe/Ljubljana","Europe/London","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Mariehamn","Europe/Minsk","Europe/Monaco","Europe/Moscow","Europe/Nicosia","Europe/Oslo","Europe/Paris","Europe/Podgorica","Europe/Prague","Europe/Riga","Europe/Rome","Europe/Samara","Europe/San_Marino","Europe/Sarajevo","Europe/Saratov","Europe/Simferopol","Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Tiraspol","Europe/Ulyanovsk","Europe/Uzhgorod","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw","Europe/Zagreb","Europe/Zaporozhye","Europe/Zurich","GB","GB-Eire","GMT","GMT+0","GMT-0","GMT0","Greenwich","HST","Hongkong","Iceland","Indian/Antananarivo","Indian/Chagos","Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives","Indian/Mauritius","Indian/Mayotte","Indian/Reunion","Iran","Israel","Jamaica","Japan","Kwajalein","Libya","MET","MST","MST7MDT","Mexico/BajaNorte","Mexico/BajaSur","Mexico/General","NZ","NZ-CHAT","Navajo","PRC","PST8PDT","Pacific/Apia","Pacific/Auckland","Pacific/Bougainville","Pacific/Chatham","Pacific/Chuuk","Pacific/Easter","Pacific/Efate","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Fiji","Pacific/Funafuti","Pacific/Galapagos","Pacific/Gambier","Pacific/Guadalcanal","Pacific/Guam","Pacific/Honolulu","Pacific/Johnston","Pacific/Kanton","Pacific/Kiritimati","Pacific/Kosrae","Pacific/Kwajalein","Pacific/Majuro","Pacific/Marquesas","Pacific/Midway","Pacific/Nauru","Pacific/Niue","Pacific/Norfolk","Pacific/Noumea","Pacific/Pago_Pago","Pacific/Palau","Pacific/Pitcairn","Pacific/Pohnpei","Pacific/Ponape","Pacific/Port_Moresby","Pacific/Rarotonga","Pacific/Saipan","Pacific/Samoa","Pacific/Tahiti","Pacific/Tarawa","Pacific/Tongatapu","Pacific/Truk","Pacific/Wake","Pacific/Wallis","Pacific/Yap","Poland","Portugal","ROC","ROK","Singapore","Turkey","UCT","US/Alaska","US/Aleutian","US/Arizona","US/Central","US/East-Indiana","US/Eastern","US/Hawaii","US/Indiana-Starke","US/Michigan","US/Mountain","US/Pacific","US/Samoa","UTC","Universal","W-SU","WET","Zulu"],"description":"Local timezone applied to operative hours. A request without it keeps the current one; a number that has none gets Europe/London."},"policies":{"type":"array","items":{"type":"object","properties":{"days":{"type":"array","items":{"type":"number","format":"float","minimum":1,"maximum":7,"description":"Day of the week in numeric representation: 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday, 7 = Sunday"},"minItems":1,"maxItems":7},"off":{"type":"boolean","description":"Set `true` to disable the device from being operative on the selected week days for a 24 hours period. Not compatible when `allDay` = `true`."},"allDay":{"type":"boolean","description":"Enable device operative all day 24 hours for the selected days in the policy. If `true`, start and finish hours will be ignored"},"start":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false},"finish":{"type":"object","properties":{"hour":{"type":"number","format":"float","minimum":0,"maximum":23,"description":"Hour value from 0 to 23 in standard 24h notation"},"minute":{"type":"number","format":"float","minimum":0,"maximum":59,"description":"Minute value from 0 to 59"}},"additionalProperties":false}},"additionalProperties":false},"minItems":1,"maxItems":7,"description":"Week day hourly range policies to be applied to the device"}},"additionalProperties":false,"description":"Optional device operative hours per week day. During the non-operative hours the device will be put into sleep mode and remain offline, meaning no outbound or inbound messages will be processed or delivered outside operative hours, unless the user explicity re-activates the device by awakening it from the web console or API wake up endpoint."}},"additionalProperties":false},"webhooks":{"type":"array","items":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","maxLength":24,"minLength":24},"maxItems":50,"description":"Optionally restrict device webhook event notifications to the given webhook endpoint IDs. If not defined, all webhook endpoints at level account will be used instead."}},"additionalProperties":false}}],"responses":{"202":{"description":"Number updated","schema":{"$ref":"#/definitions/device"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"summary":"Update number","x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Update number\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/devices/{deviceId} \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"alias\":\"My Business Name\",\"description\":\"This is an optional description to identify the number\",\"billingPlan\":\"io-professional\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Update number\necho '{\"alias\":\"My Business Name\",\"description\":\"This is an optional description to identify the number\",\"billingPlan\":\"io-professional\"}' |  \\\n  http PATCH https://api.wassenger.com/v1/devices/{deviceId} \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Update number\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"alias\":\"My Business Name\",\"description\":\"This is an optional description to identify the number\",\"billingPlan\":\"io-professional\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Update number\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    alias: 'My Business Name',\n    description: 'This is an optional description to identify the number',\n    billingPlan: 'io-professional'\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Update number\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  alias: 'My Business Name',\n  description: 'This is an optional description to identify the number',\n  billingPlan: 'io-professional'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Update number\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/devices/{deviceId}', [\n  'body' => '{\"alias\":\"My Business Name\",\"description\":\"This is an optional description to identify the number\",\"billingPlan\":\"io-professional\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Update number\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'alias' => 'My Business Name',\n  'description' => 'This is an optional description to identify the number',\n  'billingPlan' => 'io-professional'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Update number\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'alias' => 'My Business Name',\n    'description' => 'This is an optional description to identify the number',\n    'billingPlan' => 'io-professional'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Update number\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}\"\n\npayload = {\n    \"alias\": \"My Business Name\",\n    \"description\": \"This is an optional description to identify the number\",\n    \"billingPlan\": \"io-professional\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update number\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"alias\":\"My Business Name\",\"description\":\"This is an optional description to identify the number\",\"billingPlan\":\"io-professional\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update number\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"alias\":\"My Business Name\",\"description\":\"This is an optional description to identify the number\",\"billingPlan\":\"io-professional\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Update number\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"alias\\\":\\\"My Business Name\\\",\\\"description\\\":\\\"This is an optional description to identify the number\\\",\\\"billingPlan\\\":\\\"io-professional\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Update number\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}\"\n\n\tpayload := strings.NewReader(\"{\\\"alias\\\":\\\"My Business Name\\\",\\\"description\\\":\\\"This is an optional description to identify the number\\\",\\\"billingPlan\\\":\\\"io-professional\\\"}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Update number\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"alias\\\":\\\"My Business Name\\\",\\\"description\\\":\\\"This is an optional description to identify the number\\\",\\\"billingPlan\\\":\\\"io-professional\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Update number\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"alias\\\":\\\"My Business Name\\\",\\\"description\\\":\\\"This is an optional description to identify the number\\\",\\\"billingPlan\\\":\\\"io-professional\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Update number\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/devices/{deviceId}\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"alias\\\":\\\"My Business Name\\\",\\\"description\\\":\\\"This is an optional description to identify the number\\\",\\\"billingPlan\\\":\\\"io-professional\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Update number\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"alias\\\":\\\"My Business Name\\\",\\\"description\\\":\\\"This is an optional description to identify the number\\\",\\\"billingPlan\\\":\\\"io-professional\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Update number\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"alias\\\":\\\"My Business Name\\\",\\\"description\\\":\\\"This is an optional description to identify the number\\\",\\\"billingPlan\\\":\\\"io-professional\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Update number\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"alias\":\"My Business Name\",\"description\":\"This is an optional description to identify the number\",\"billingPlan\":\"io-professional\"}'"},{"lang":"ObjC","source":"// Update number\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"alias\": @\"My Business Name\",\n                              @\"description\": @\"This is an optional description to identify the number\",\n                              @\"billingPlan\": @\"io-professional\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Update number\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"alias\": \"My Business Name\",\n  \"description\": \"This is an optional description to identify the number\",\n  \"billingPlan\": \"io-professional\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"description":"Delete a WhatsApp number by ID. This action also will cancel the billing subscription. Proceed with caution, this action is not reversible.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdevices%2F%7BdeviceId%7D&method=DELETE&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deleteDevice","security":[{"apiKey":[]}],"tags":["Devices"],"produces":["application/json"],"parameters":[{"in":"body","name":"device","description":"Delete device","schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":100},"feedback":{"type":"string","maxLength":2048}},"additionalProperties":false}}],"responses":{"200":{"description":"Number deleted","schema":{"$ref":"#/definitions/device"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized access due to invalid or expired API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required API token","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Number not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Device already deleted","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"summary":"Delete number","x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Delete number subscription\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/devices/{deviceId} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Delete number subscription\nhttp DELETE https://api.wassenger.com/v1/devices/{deviceId} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Delete number subscription\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Delete number subscription\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Delete number subscription\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Delete number subscription\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/devices/{deviceId}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Delete number subscription\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/devices/{deviceId}');\n$request->setRequestMethod('DELETE');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Delete number subscription\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/devices/{deviceId}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Delete number subscription\nimport requests\n\nurl = \"https://api.wassenger.com/v1/devices/{deviceId}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.delete(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete number subscription\nconst url = 'https://api.wassenger.com/v1/devices/{deviceId}';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete number subscription\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/devices/{deviceId}',\n  method: 'DELETE',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Delete number subscription\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/devices/{deviceId}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Delete number subscription\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/devices/{deviceId}\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Delete number subscription\nvar client = new RestClient(\"https://api.wassenger.com/v1/devices/{deviceId}\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Delete number subscription\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/devices/{deviceId}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Delete number subscription\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/devices/{deviceId}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Delete number subscription\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/devices/{deviceId}\")\n  .delete(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Delete number subscription\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/devices/{deviceId}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Delete number subscription\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/devices/{deviceId}' -Method DELETE -Headers $headers"},{"lang":"ObjC","source":"// Delete number subscription\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/devices/{deviceId}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Delete number subscription\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/devices/{deviceId}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/deals/{dealId}/suggestion":{"parameters":[],"delete":{"summary":"Dismiss the AI suggestion","description":"Discard the stage suggestion on a deal.\n\n\n\nSuggestions are proposals: the analysis job writes them, a person accepts\n\none by moving the deal or dismisses it here. Accepting needs no call of\n\nits own, because moving the stage clears the suggestion with it.\n\n\n\nA suggestion also expires on its own as soon as a message arrives that it\n\ndid not read.\n\n\n\n**Note**: the conversation analysis that writes suggestions is included\n\nin every current Platform plan.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdeals%2F%7BdealId%7D%2Fsuggestion&method=DELETE&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"dismissDealSuggestion","security":[{"apiKey":[]}],"tags":["Deals"],"parameters":[],"responses":{"200":{"description":"The deal, with no suggestion on it","schema":{"$ref":"#/definitions/deal"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unsupported operation - plan upgrade required","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Deal not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Dismiss the suggestion on a deal\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/deals/{dealId}/suggestion \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Dismiss the suggestion on a deal\nhttp DELETE https://api.wassenger.com/v1/deals/{dealId}/suggestion \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Dismiss the suggestion on a deal\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}/suggestion';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Dismiss the suggestion on a deal\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/deals/{dealId}/suggestion',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Dismiss the suggestion on a deal\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/deals/{dealId}/suggestion');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Dismiss the suggestion on a deal\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/deals/{dealId}/suggestion', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Dismiss the suggestion on a deal\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/deals/{dealId}/suggestion');\n$request->setRequestMethod('DELETE');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Dismiss the suggestion on a deal\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/deals/{dealId}/suggestion\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Dismiss the suggestion on a deal\nimport requests\n\nurl = \"https://api.wassenger.com/v1/deals/{dealId}/suggestion\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.delete(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Dismiss the suggestion on a deal\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}/suggestion';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Dismiss the suggestion on a deal\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/deals/{dealId}/suggestion',\n  method: 'DELETE',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Dismiss the suggestion on a deal\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/deals/{dealId}/suggestion\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Dismiss the suggestion on a deal\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/deals/{dealId}/suggestion\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Dismiss the suggestion on a deal\nvar client = new RestClient(\"https://api.wassenger.com/v1/deals/{dealId}/suggestion\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Dismiss the suggestion on a deal\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/deals/{dealId}/suggestion\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Dismiss the suggestion on a deal\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/deals/{dealId}/suggestion\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Dismiss the suggestion on a deal\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/deals/{dealId}/suggestion\")\n  .delete(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Dismiss the suggestion on a deal\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/deals/{dealId}/suggestion\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Dismiss the suggestion on a deal\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/deals/{dealId}/suggestion' -Method DELETE -Headers $headers"},{"lang":"ObjC","source":"// Dismiss the suggestion on a deal\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/deals/{dealId}/suggestion\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Dismiss the suggestion on a deal\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/deals/{dealId}/suggestion\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/deals/{dealId}/stage":{"parameters":[],"patch":{"summary":"Move deal to another stage","description":"Move a deal to another stage of its pipeline.\n\n\n\n`previousStage` is required and enforced atomically in the database: when it no longer matches the current stage (someone else moved the card first), the request fails with 409 and no actions or webhooks fire twice. Reload and retry.\n\n\n\nMoving into a won or lost stage closes the deal; moving a closed deal back to an open stage reopens it. Stage actions (assign agent or department, add or remove labels) run on the linked chat in the background.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdeals%2F%7BdealId%7D%2Fstage&method=PATCH&body=%7B%0A%20%20%22stage%22%3A%20%225f7b1b1b1b1b1b1b1b1b1b1d%22%2C%0A%20%20%22previousStage%22%3A%20%225f7b1b1b1b1b1b1b1b1b1b1c%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"moveDealStage","security":[{"apiKey":[]}],"tags":["Deals"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"stage","description":"Stage transition","schema":{"type":"object","properties":{"stage":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Target stage ID. Required"},"previousStage":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Stage the client last saw. The request is rejected with 409 when it no longer matches, so concurrent moves never overwrite each other"},"lostReason":{"type":"string","minLength":1,"maxLength":60,"description":"Reason the deal was lost. Only meaningful when moving to a lost stage"}},"required":["stage","previousStage"],"additionalProperties":false}}],"responses":{"200":{"description":"Deal moved","schema":{"$ref":"#/definitions/deal"}},"400":{"description":"Stage does not belong to the pipeline","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unsupported operation - plan upgrade required","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Deal not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"The deal stage changed underneath: reload and retry","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Move a deal to the negotiation stage\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/deals/{dealId}/stage \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"stage\":\"5f7b1b1b1b1b1b1b1b1b1b1d\",\"previousStage\":\"5f7b1b1b1b1b1b1b1b1b1b1c\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Move a deal to the negotiation stage\necho '{\"stage\":\"5f7b1b1b1b1b1b1b1b1b1b1d\",\"previousStage\":\"5f7b1b1b1b1b1b1b1b1b1b1c\"}' |  \\\n  http PATCH https://api.wassenger.com/v1/deals/{dealId}/stage \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Move a deal to the negotiation stage\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}/stage';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"stage\":\"5f7b1b1b1b1b1b1b1b1b1b1d\",\"previousStage\":\"5f7b1b1b1b1b1b1b1b1b1b1c\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Move a deal to the negotiation stage\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/deals/{dealId}/stage',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {stage: '5f7b1b1b1b1b1b1b1b1b1b1d', previousStage: '5f7b1b1b1b1b1b1b1b1b1b1c'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Move a deal to the negotiation stage\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/deals/{dealId}/stage');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  stage: '5f7b1b1b1b1b1b1b1b1b1b1d',\n  previousStage: '5f7b1b1b1b1b1b1b1b1b1b1c'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Move a deal to the negotiation stage\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/deals/{dealId}/stage', [\n  'body' => '{\"stage\":\"5f7b1b1b1b1b1b1b1b1b1b1d\",\"previousStage\":\"5f7b1b1b1b1b1b1b1b1b1b1c\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Move a deal to the negotiation stage\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'stage' => '5f7b1b1b1b1b1b1b1b1b1b1d',\n  'previousStage' => '5f7b1b1b1b1b1b1b1b1b1b1c'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/deals/{dealId}/stage');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Move a deal to the negotiation stage\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/deals/{dealId}/stage\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'stage' => '5f7b1b1b1b1b1b1b1b1b1b1d',\n    'previousStage' => '5f7b1b1b1b1b1b1b1b1b1b1c'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Move a deal to the negotiation stage\nimport requests\n\nurl = \"https://api.wassenger.com/v1/deals/{dealId}/stage\"\n\npayload = {\n    \"stage\": \"5f7b1b1b1b1b1b1b1b1b1b1d\",\n    \"previousStage\": \"5f7b1b1b1b1b1b1b1b1b1b1c\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Move a deal to the negotiation stage\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}/stage';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"stage\":\"5f7b1b1b1b1b1b1b1b1b1b1d\",\"previousStage\":\"5f7b1b1b1b1b1b1b1b1b1b1c\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Move a deal to the negotiation stage\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/deals/{dealId}/stage',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"stage\":\"5f7b1b1b1b1b1b1b1b1b1b1d\",\"previousStage\":\"5f7b1b1b1b1b1b1b1b1b1b1c\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Move a deal to the negotiation stage\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/deals/{dealId}/stage\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"stage\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1d\\\",\\\"previousStage\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1c\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Move a deal to the negotiation stage\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/deals/{dealId}/stage\"\n\n\tpayload := strings.NewReader(\"{\\\"stage\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1d\\\",\\\"previousStage\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1c\\\"}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Move a deal to the negotiation stage\nvar client = new RestClient(\"https://api.wassenger.com/v1/deals/{dealId}/stage\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"stage\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1d\\\",\\\"previousStage\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1c\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Move a deal to the negotiation stage\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/deals/{dealId}/stage\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"stage\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1d\\\",\\\"previousStage\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1c\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Move a deal to the negotiation stage\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/deals/{dealId}/stage\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"stage\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1d\\\",\\\"previousStage\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1c\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Move a deal to the negotiation stage\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"stage\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1d\\\",\\\"previousStage\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1c\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/deals/{dealId}/stage\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Move a deal to the negotiation stage\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/deals/{dealId}/stage\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"stage\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1d\\\",\\\"previousStage\\\":\\\"5f7b1b1b1b1b1b1b1b1b1b1c\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Move a deal to the negotiation stage\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/deals/{dealId}/stage' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"stage\":\"5f7b1b1b1b1b1b1b1b1b1b1d\",\"previousStage\":\"5f7b1b1b1b1b1b1b1b1b1b1c\"}'"},{"lang":"ObjC","source":"// Move a deal to the negotiation stage\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"stage\": @\"5f7b1b1b1b1b1b1b1b1b1b1d\",\n                              @\"previousStage\": @\"5f7b1b1b1b1b1b1b1b1b1b1c\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/deals/{dealId}/stage\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Move a deal to the negotiation stage\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"stage\": \"5f7b1b1b1b1b1b1b1b1b1b1d\",\n  \"previousStage\": \"5f7b1b1b1b1b1b1b1b1b1b1c\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/deals/{dealId}/stage\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/deals/{dealId}/risk":{"parameters":[],"delete":{"summary":"Dismiss the AI risk alert","description":"Discard the risk alert on a deal.\n\n\n\nA risk alert is not a proposal: there is nothing to accept, only something\n\nto know. It clears itself when the team replies to the conversation, and a\n\ndeal that is won, lost or archived drops it too. This is how a person\n\nclears one that is simply wrong.\n\n\n\n**Note**: the conversation analysis that writes risk alerts is included\n\nin every current Platform plan.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdeals%2F%7BdealId%7D%2Frisk&method=DELETE&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"dismissDealRisk","security":[{"apiKey":[]}],"tags":["Deals"],"parameters":[],"responses":{"200":{"description":"The deal, with no risk alert on it","schema":{"$ref":"#/definitions/deal"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unsupported operation - plan upgrade required","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Deal not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Dismiss the risk alert on a deal\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/deals/{dealId}/risk \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Dismiss the risk alert on a deal\nhttp DELETE https://api.wassenger.com/v1/deals/{dealId}/risk \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Dismiss the risk alert on a deal\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}/risk';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Dismiss the risk alert on a deal\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/deals/{dealId}/risk',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Dismiss the risk alert on a deal\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/deals/{dealId}/risk');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Dismiss the risk alert on a deal\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/deals/{dealId}/risk', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Dismiss the risk alert on a deal\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/deals/{dealId}/risk');\n$request->setRequestMethod('DELETE');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Dismiss the risk alert on a deal\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/deals/{dealId}/risk\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Dismiss the risk alert on a deal\nimport requests\n\nurl = \"https://api.wassenger.com/v1/deals/{dealId}/risk\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.delete(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Dismiss the risk alert on a deal\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}/risk';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Dismiss the risk alert on a deal\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/deals/{dealId}/risk',\n  method: 'DELETE',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Dismiss the risk alert on a deal\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/deals/{dealId}/risk\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Dismiss the risk alert on a deal\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/deals/{dealId}/risk\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Dismiss the risk alert on a deal\nvar client = new RestClient(\"https://api.wassenger.com/v1/deals/{dealId}/risk\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Dismiss the risk alert on a deal\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/deals/{dealId}/risk\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Dismiss the risk alert on a deal\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/deals/{dealId}/risk\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Dismiss the risk alert on a deal\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/deals/{dealId}/risk\")\n  .delete(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Dismiss the risk alert on a deal\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/deals/{dealId}/risk\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Dismiss the risk alert on a deal\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/deals/{dealId}/risk' -Method DELETE -Headers $headers"},{"lang":"ObjC","source":"// Dismiss the risk alert on a deal\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/deals/{dealId}/risk\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Dismiss the risk alert on a deal\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/deals/{dealId}/risk\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/deals/{dealId}/notes/{noteId}":{"parameters":[],"patch":{"summary":"Update deal note","description":"Edit a note, schedule it, or complete it.\n\n\n\nEditing the text or the due date is reserved to the note author and to\n\nadmins and supervisors. Completing a task is not: anybody who can see the\n\ndeal can tick off the work.\n\n\n\nSend `dueAt: null` to turn a task back into a plain note.\n\n\n\nPass `files` to change the attachments. It is the COMPLETE list the note\n\nmust carry afterwards, not a delta: ids you leave out are detached, ids\n\nyou keep stay attached, and `[]` removes all of them. Upload anything new\n\nbeforehand through `POST /files` with `permission=public`. The same limits\n\nas on create apply. A detached file is NOT deleted and stays protected\n\nfrom the retention sweep, because the same file may be attached elsewhere.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdeals%2F%7BdealId%7D%2Fnotes%2F%7BnoteId%7D&method=PATCH&body=%7B%0A%20%20%22done%22%3A%20true%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateDealNote","security":[{"apiKey":[]}],"tags":["Deals"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"note","description":"Note fields to update","schema":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":2000,"description":"Note body"},"dueAt":{"type":["string","null"],"format":"date-time","description":"Due date, or null to turn the task back into a plain note"},"done":{"type":"boolean","description":"Complete the task, or reopen it"},"files":{"type":"array","items":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$"},"maxItems":3,"description":"The complete list of attachment ids the note must carry after the update, up to 3. Ids missing from the list are detached; an empty array removes all of them. Upload new files first with POST /files"}},"additionalProperties":false}}],"responses":{"200":{"description":"Note updated","schema":{"$ref":"#/definitions/dealNote"}},"400":{"description":"Invalid note payload, or an attachment that does not exist, is too large or is of an unsupported type","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unsupported operation - plan upgrade required, or the note belongs to another user","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Deal or note not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Complete a task\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId} \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"done\":true}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Complete a task\necho '{\"done\":true}' |  \\\n  http PATCH https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId} \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Complete a task\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"done\":true}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Complete a task\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {done: true}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Complete a task\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  done: true\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Complete a task\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}', [\n  'body' => '{\"done\":true}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Complete a task\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'done' => null\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Complete a task\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'done' => null\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Complete a task\nimport requests\n\nurl = \"https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}\"\n\npayload = { \"done\": True }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Complete a task\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"done\":true}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Complete a task\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"done\":true}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Complete a task\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"done\\\":true}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Complete a task\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}\"\n\n\tpayload := strings.NewReader(\"{\\\"done\\\":true}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Complete a task\nvar client = new RestClient(\"https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"done\\\":true}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Complete a task\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"done\\\":true}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Complete a task\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"done\\\":true}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Complete a task\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"done\\\":true}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Complete a task\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"done\\\":true}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Complete a task\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"done\":true}'"},{"lang":"ObjC","source":"// Complete a task\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"done\": @YES };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Complete a task\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"done\": true] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Delete deal note","description":"Delete a note from a deal.\n\n\n\nReserved to the note author and to admins and supervisors.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdeals%2F%7BdealId%7D%2Fnotes%2F%7BnoteId%7D&method=DELETE&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deleteDealNote","security":[{"apiKey":[]}],"tags":["Deals"],"parameters":[],"responses":{"200":{"description":"Note deleted","schema":{"$ref":"#/definitions/dealNote"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unsupported operation - plan upgrade required, or the note belongs to another user","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Deal or note not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Delete a note\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Delete a note\nhttp DELETE https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Delete a note\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Delete a note\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Delete a note\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Delete a note\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Delete a note\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}');\n$request->setRequestMethod('DELETE');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Delete a note\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Delete a note\nimport requests\n\nurl = \"https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.delete(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete a note\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete a note\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}',\n  method: 'DELETE',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Delete a note\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Delete a note\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Delete a note\nvar client = new RestClient(\"https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Delete a note\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Delete a note\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Delete a note\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}\")\n  .delete(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Delete a note\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Delete a note\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}' -Method DELETE -Headers $headers"},{"lang":"ObjC","source":"// Delete a note\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Delete a note\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/deals/{dealId}/notes/{noteId}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/deals/{dealId}/notes":{"parameters":[],"get":{"summary":"List deal notes","description":"Every note and task of a single deal, newest first.\n\n\n\nA note that carries a `dueAt` date is a task: same document, same list.\n\nNotes live with the deal, not with the conversation, so they survive the\n\nchat retention window and exist for deals with no conversation attached.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdeals%2F%7BdealId%7D%2Fnotes)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"listDealNotes","security":[{"apiKey":[]}],"tags":["Deals"],"parameters":[{"in":"query","name":"limit","type":"number","required":false,"minimum":1,"maximum":200,"description":"Max results, default 50, max 200"},{"in":"query","name":"skip","type":"number","required":false,"minimum":0,"maximum":10000,"description":"Skip N results"}],"responses":{"200":{"description":"Deal notes, newest first","schema":{"type":"array","items":{"$ref":"#/definitions/dealNote"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Deal not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Read the notes of a deal\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/deals/{dealId}/notes \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Read the notes of a deal\nhttp GET https://api.wassenger.com/v1/deals/{dealId}/notes \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Read the notes of a deal\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}/notes';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Read the notes of a deal\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/deals/{dealId}/notes',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Read the notes of a deal\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/deals/{dealId}/notes');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Read the notes of a deal\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/deals/{dealId}/notes', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Read the notes of a deal\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/deals/{dealId}/notes');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Read the notes of a deal\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/deals/{dealId}/notes\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Read the notes of a deal\nimport requests\n\nurl = \"https://api.wassenger.com/v1/deals/{dealId}/notes\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Read the notes of a deal\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}/notes';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Read the notes of a deal\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/deals/{dealId}/notes',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Read the notes of a deal\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/deals/{dealId}/notes\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Read the notes of a deal\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/deals/{dealId}/notes\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Read the notes of a deal\nvar client = new RestClient(\"https://api.wassenger.com/v1/deals/{dealId}/notes\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Read the notes of a deal\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/deals/{dealId}/notes\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Read the notes of a deal\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/deals/{dealId}/notes\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Read the notes of a deal\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/deals/{dealId}/notes\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Read the notes of a deal\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/deals/{dealId}/notes\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Read the notes of a deal\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/deals/{dealId}/notes' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Read the notes of a deal\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/deals/{dealId}/notes\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Read the notes of a deal\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/deals/{dealId}/notes\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"post":{"summary":"Create deal note","description":"Add a note to a deal.\n\n\n\nPass `dueAt` to make it a task: the note then shows as pending work until\n\nsomebody completes it. Leave it out for a plain note.\n\n\n\nPass `event` with the id of one of the deal's own events (see\n\n`GET /deals/{dealId}/events`) to attach the note as a comment under that\n\nevent in the record's activity trail.\n\n\n\nPass `files` with the ids of up to 3 files uploaded beforehand\n\nthrough `POST /files` to attach them to the note. Accepted types are JPEG,\n\nPNG and WebP images, PDF, Word, Excel, PowerPoint, plain text and Markdown,\n\nup to 10 MB each. Upload them with `permission=public` so every teammate who\n\ncan read the deal can open them. Attached files are marked as protected and\n\nare never removed by the file retention sweep.\n\n\n\nPass the `Idempotency-Key` header with a 24-character hex id you generate\n\nyourself to make the create safe to retry: the id becomes the note's own,\n\nso a repeat of the same request returns the note the first one created\n\ninstead of adding a second one.\n\n\n\n**Note**: this API resource is available in the Platform Professional subscription and above.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdeals%2F%7BdealId%7D%2Fnotes&method=POST&body=%7B%0A%20%20%22text%22%3A%20%22Send%20the%20quote%20and%20confirm%20the%20delivery%20date%22%2C%0A%20%20%22dueAt%22%3A%20%222026-09-01T10%3A00%3A00.000Z%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"createDealNote","security":[{"apiKey":[]}],"tags":["Deals"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"note","description":"Create a new deal note","schema":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":2000,"description":"Note body. Required"},"dueAt":{"type":"string","format":"date-time","description":"Due date. A note that has one is a task"},"event":{"type":"string","pattern":"^[a-f0-9]{24}$","description":"Id of one of the deal's own events. The note becomes a comment nested under that event in the record's trail"},"files":{"type":"array","items":{"type":"string","pattern":"^[0-9A-Fa-f]{24}$"},"maxItems":3,"description":"Ids of up to 3 previously uploaded files to attach to the note. Upload them first with POST /files"}},"required":["text"],"additionalProperties":false}},{"name":"Idempotency-Key","in":"header","required":false,"type":"string","pattern":"^[0-9a-fA-F]{24}$","description":"Optional. A 24-character hex ObjectId generated by the client, used as the note's own id. Retrying a request with the same key returns the note it already created, with the same `200` and the same body, rather than creating a duplicate."}],"responses":{"200":{"description":"Note created, or the note a previous request with the same `Idempotency-Key` already created","schema":{"$ref":"#/definitions/dealNote"}},"400":{"description":"Invalid note payload, a malformed `Idempotency-Key`, or an attachment that does not exist, is too large or is of an unsupported type","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unsupported operation - plan upgrade required","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Deal not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"The supplied `Idempotency-Key` is already in use by a note outside this deal","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Maximum number of notes per deal reached","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Add a task due tomorrow\ncurl --request POST \\\n  --url https://api.wassenger.com/v1/deals/{dealId}/notes \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"text\":\"Send the quote and confirm the delivery date\",\"dueAt\":\"2026-09-01T10:00:00.000Z\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Add a task due tomorrow\necho '{\"text\":\"Send the quote and confirm the delivery date\",\"dueAt\":\"2026-09-01T10:00:00.000Z\"}' |  \\\n  http POST https://api.wassenger.com/v1/deals/{dealId}/notes \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Add a task due tomorrow\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}/notes';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"text\":\"Send the quote and confirm the delivery date\",\"dueAt\":\"2026-09-01T10:00:00.000Z\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Add a task due tomorrow\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'POST',\n  url: 'https://api.wassenger.com/v1/deals/{dealId}/notes',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    text: 'Send the quote and confirm the delivery date',\n    dueAt: '2026-09-01T10:00:00.000Z'\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Add a task due tomorrow\nconst unirest = require('unirest');\n\nconst req = unirest('POST', 'https://api.wassenger.com/v1/deals/{dealId}/notes');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  text: 'Send the quote and confirm the delivery date',\n  dueAt: '2026-09-01T10:00:00.000Z'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Add a task due tomorrow\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('POST', 'https://api.wassenger.com/v1/deals/{dealId}/notes', [\n  'body' => '{\"text\":\"Send the quote and confirm the delivery date\",\"dueAt\":\"2026-09-01T10:00:00.000Z\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Add a task due tomorrow\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'text' => 'Send the quote and confirm the delivery date',\n  'dueAt' => '2026-09-01T10:00:00.000Z'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/deals/{dealId}/notes');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Add a task due tomorrow\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/deals/{dealId}/notes\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'text' => 'Send the quote and confirm the delivery date',\n    'dueAt' => '2026-09-01T10:00:00.000Z'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Add a task due tomorrow\nimport requests\n\nurl = \"https://api.wassenger.com/v1/deals/{dealId}/notes\"\n\npayload = {\n    \"text\": \"Send the quote and confirm the delivery date\",\n    \"dueAt\": \"2026-09-01T10:00:00.000Z\"\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Add a task due tomorrow\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}/notes';\nconst options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"text\":\"Send the quote and confirm the delivery date\",\"dueAt\":\"2026-09-01T10:00:00.000Z\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Add a task due tomorrow\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/deals/{dealId}/notes',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"text\":\"Send the quote and confirm the delivery date\",\"dueAt\":\"2026-09-01T10:00:00.000Z\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Add a task due tomorrow\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/deals/{dealId}/notes\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"text\\\":\\\"Send the quote and confirm the delivery date\\\",\\\"dueAt\\\":\\\"2026-09-01T10:00:00.000Z\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Add a task due tomorrow\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/deals/{dealId}/notes\"\n\n\tpayload := strings.NewReader(\"{\\\"text\\\":\\\"Send the quote and confirm the delivery date\\\",\\\"dueAt\\\":\\\"2026-09-01T10:00:00.000Z\\\"}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Add a task due tomorrow\nvar client = new RestClient(\"https://api.wassenger.com/v1/deals/{dealId}/notes\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"text\\\":\\\"Send the quote and confirm the delivery date\\\",\\\"dueAt\\\":\\\"2026-09-01T10:00:00.000Z\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Add a task due tomorrow\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Post,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/deals/{dealId}/notes\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"text\\\":\\\"Send the quote and confirm the delivery date\\\",\\\"dueAt\\\":\\\"2026-09-01T10:00:00.000Z\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Add a task due tomorrow\nHttpResponse<String> response = Unirest.post(\"https://api.wassenger.com/v1/deals/{dealId}/notes\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"text\\\":\\\"Send the quote and confirm the delivery date\\\",\\\"dueAt\\\":\\\"2026-09-01T10:00:00.000Z\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Add a task due tomorrow\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"text\\\":\\\"Send the quote and confirm the delivery date\\\",\\\"dueAt\\\":\\\"2026-09-01T10:00:00.000Z\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/deals/{dealId}/notes\")\n  .post(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Add a task due tomorrow\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/deals/{dealId}/notes\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"text\\\":\\\"Send the quote and confirm the delivery date\\\",\\\"dueAt\\\":\\\"2026-09-01T10:00:00.000Z\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Add a task due tomorrow\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/deals/{dealId}/notes' -Method POST -Headers $headers -ContentType 'application/json' -Body '{\"text\":\"Send the quote and confirm the delivery date\",\"dueAt\":\"2026-09-01T10:00:00.000Z\"}'"},{"lang":"ObjC","source":"// Add a task due tomorrow\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"text\": @\"Send the quote and confirm the delivery date\",\n                              @\"dueAt\": @\"2026-09-01T10:00:00.000Z\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/deals/{dealId}/notes\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"POST\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Add a task due tomorrow\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"text\": \"Send the quote and confirm the delivery date\",\n  \"dueAt\": \"2026-09-01T10:00:00.000Z\"\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/deals/{dealId}/notes\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"POST\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/deals/{dealId}/events":{"parameters":[],"get":{"summary":"List deal history","description":"Every recorded event of a single deal, newest first.\n\n\n\nDeal events are also written onto the linked conversation as timeline\n\npills; this endpoint answers the other question — what has happened to\n\nTHIS deal — including for deals with no conversation attached.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdeals%2F%7BdealId%7D%2Fevents)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"listDealEvents","security":[{"apiKey":[]}],"tags":["Deals"],"parameters":[{"in":"query","name":"limit","type":"number","required":false,"minimum":1,"maximum":200,"description":"Max results, default 50, max 200"},{"in":"query","name":"skip","type":"number","required":false,"minimum":0,"maximum":10000,"description":"Skip N results"}],"responses":{"200":{"description":"Deal history, newest first","schema":{"type":"array","items":{"type":"object"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Deal not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Read the history of a deal\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/deals/{dealId}/events \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Read the history of a deal\nhttp GET https://api.wassenger.com/v1/deals/{dealId}/events \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Read the history of a deal\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}/events';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Read the history of a deal\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/deals/{dealId}/events',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Read the history of a deal\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/deals/{dealId}/events');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Read the history of a deal\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/deals/{dealId}/events', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Read the history of a deal\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/deals/{dealId}/events');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Read the history of a deal\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/deals/{dealId}/events\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Read the history of a deal\nimport requests\n\nurl = \"https://api.wassenger.com/v1/deals/{dealId}/events\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Read the history of a deal\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}/events';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Read the history of a deal\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/deals/{dealId}/events',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Read the history of a deal\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/deals/{dealId}/events\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Read the history of a deal\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/deals/{dealId}/events\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Read the history of a deal\nvar client = new RestClient(\"https://api.wassenger.com/v1/deals/{dealId}/events\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Read the history of a deal\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/deals/{dealId}/events\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Read the history of a deal\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/deals/{dealId}/events\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Read the history of a deal\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/deals/{dealId}/events\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Read the history of a deal\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/deals/{dealId}/events\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Read the history of a deal\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/deals/{dealId}/events' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Read the history of a deal\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/deals/{dealId}/events\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Read the history of a deal\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/deals/{dealId}/events\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/deals/{dealId}/chat":{"parameters":[],"put":{"summary":"Link deal to a conversation","description":"Point a deal at the conversation of a contact on the deal's own number.\n\n\n\nThe body names a **contact**, not a chat: `contactWid` is the identity the funnel keys on, and the conversation is resolved from it server-side across the `@c.us`/`@lid` equivalence. Linking repoints the deal's counterparty as well as its conversation — every identity the deal has held stays searchable, so neither the old contact nor the new one can end up with a second open deal in the pipeline.\n\n\n\nUse the same request to move a deal to a different conversation. There is no unlink: clearing the conversation would be undone by the reconciliation job on its next pass, which re-links a deal whose contact has a conversation.\n\n\n\n**Note**: this API resource is available in the Platform Professional subscription and above.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdeals%2F%7BdealId%7D%2Fchat&method=PUT&body=%7B%0A%20%20%22contactWid%22%3A%20%2234600111222%40c.us%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"linkDealChat","security":[{"apiKey":[]}],"tags":["Deals"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"chat","description":"Contact whose conversation the deal is linked to","schema":{"type":"object","properties":{"contactWid":{"type":"string","pattern":"@(c\\.us|lid|g\\.us|newsletter|broadcast)$","minLength":5,"maxLength":50,"description":"WhatsApp ID of the contact whose conversation the deal is linked to. Required"}},"required":["contactWid"],"additionalProperties":false}}],"responses":{"200":{"description":"Deal linked","schema":{"$ref":"#/definitions/deal"}},"400":{"description":"The contact has no conversation on the deal number","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Unsupported operation - plan upgrade required, or the conversation is not readable by the user","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Deal not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Another open deal already exists for that contact in the pipeline","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Link a deal to the conversation of a contact\ncurl --request PUT \\\n  --url https://api.wassenger.com/v1/deals/{dealId}/chat \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"contactWid\":\"34600111222@c.us\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Link a deal to the conversation of a contact\necho '{\"contactWid\":\"34600111222@c.us\"}' |  \\\n  http PUT https://api.wassenger.com/v1/deals/{dealId}/chat \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Link a deal to the conversation of a contact\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}/chat';\nconst options = {\n  method: 'PUT',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"contactWid\":\"34600111222@c.us\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Link a deal to the conversation of a contact\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PUT',\n  url: 'https://api.wassenger.com/v1/deals/{dealId}/chat',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {contactWid: '34600111222@c.us'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Link a deal to the conversation of a contact\nconst unirest = require('unirest');\n\nconst req = unirest('PUT', 'https://api.wassenger.com/v1/deals/{dealId}/chat');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  contactWid: '34600111222@c.us'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Link a deal to the conversation of a contact\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PUT', 'https://api.wassenger.com/v1/deals/{dealId}/chat', [\n  'body' => '{\"contactWid\":\"34600111222@c.us\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Link a deal to the conversation of a contact\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'contactWid' => '34600111222@c.us'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/deals/{dealId}/chat');\n$request->setRequestMethod('PUT');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Link a deal to the conversation of a contact\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/deals/{dealId}/chat\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PUT\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'contactWid' => '34600111222@c.us'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Link a deal to the conversation of a contact\nimport requests\n\nurl = \"https://api.wassenger.com/v1/deals/{dealId}/chat\"\n\npayload = { \"contactWid\": \"34600111222@c.us\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.put(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Link a deal to the conversation of a contact\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}/chat';\nconst options = {\n  method: 'PUT',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"contactWid\":\"34600111222@c.us\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Link a deal to the conversation of a contact\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/deals/{dealId}/chat',\n  method: 'PUT',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"contactWid\":\"34600111222@c.us\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Link a deal to the conversation of a contact\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/deals/{dealId}/chat\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Put.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"contactWid\\\":\\\"34600111222@c.us\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Link a deal to the conversation of a contact\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/deals/{dealId}/chat\"\n\n\tpayload := strings.NewReader(\"{\\\"contactWid\\\":\\\"34600111222@c.us\\\"}\")\n\n\treq, _ := http.NewRequest(\"PUT\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Link a deal to the conversation of a contact\nvar client = new RestClient(\"https://api.wassenger.com/v1/deals/{dealId}/chat\");\nvar request = new RestRequest(Method.PUT);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"contactWid\\\":\\\"34600111222@c.us\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Link a deal to the conversation of a contact\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Put,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/deals/{dealId}/chat\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"contactWid\\\":\\\"34600111222@c.us\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Link a deal to the conversation of a contact\nHttpResponse<String> response = Unirest.put(\"https://api.wassenger.com/v1/deals/{dealId}/chat\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"contactWid\\\":\\\"34600111222@c.us\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Link a deal to the conversation of a contact\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"contactWid\\\":\\\"34600111222@c.us\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/deals/{dealId}/chat\")\n  .put(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Link a deal to the conversation of a contact\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PUT\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/deals/{dealId}/chat\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"contactWid\\\":\\\"34600111222@c.us\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Link a deal to the conversation of a contact\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/deals/{dealId}/chat' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{\"contactWid\":\"34600111222@c.us\"}'"},{"lang":"ObjC","source":"// Link a deal to the conversation of a contact\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"contactWid\": @\"34600111222@c.us\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/deals/{dealId}/chat\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PUT\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Link a deal to the conversation of a contact\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"contactWid\": \"34600111222@c.us\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/deals/{dealId}/chat\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PUT\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/deals/{dealId}":{"parameters":[],"get":{"summary":"Get deal","description":"Get a deal by ID\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdeals%2F%7BdealId%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getDeal","security":[{"apiKey":[]}],"tags":["Deals"],"parameters":[],"responses":{"200":{"description":"Deal information","schema":{"$ref":"#/definitions/deal"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Deal not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get a deal by ID\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/deals/{dealId} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get a deal by ID\nhttp GET https://api.wassenger.com/v1/deals/{dealId} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get a deal by ID\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get a deal by ID\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/deals/{dealId}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get a deal by ID\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/deals/{dealId}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get a deal by ID\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/deals/{dealId}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get a deal by ID\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/deals/{dealId}');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get a deal by ID\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/deals/{dealId}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get a deal by ID\nimport requests\n\nurl = \"https://api.wassenger.com/v1/deals/{dealId}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get a deal by ID\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get a deal by ID\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/deals/{dealId}',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get a deal by ID\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/deals/{dealId}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get a deal by ID\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/deals/{dealId}\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get a deal by ID\nvar client = new RestClient(\"https://api.wassenger.com/v1/deals/{dealId}\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get a deal by ID\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/deals/{dealId}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get a deal by ID\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/deals/{dealId}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get a deal by ID\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/deals/{dealId}\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get a deal by ID\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/deals/{dealId}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get a deal by ID\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/deals/{dealId}' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get a deal by ID\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/deals/{dealId}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get a deal by ID\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/deals/{dealId}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Update deal","description":"Partially update a deal: title, amount, currency, agent or department.\n\n\n\nStage transitions have their own endpoint: `PATCH /deals/{dealId}/stage`.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdeals%2F%7BdealId%7D&method=PATCH&body=%7B%0A%20%20%22amount%22%3A%202500%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateDeal","security":[{"apiKey":[]}],"tags":["Deals"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"deal","description":"Update deal","schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":120,"description":"Deal title"},"amount":{"type":["number","null"],"format":"float","minimum":0,"maximum":999999999,"description":"Deal monetary value"},"currency":{"type":["string","null"],"minLength":3,"maxLength":3,"description":"ISO 4217 currency code, or null to clear it back to the pipeline default"},"agent":{"type":["string","null"],"pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Agent user ID assigned to the deal"},"department":{"type":["string","null"],"pattern":"^[0-9A-Fa-f]{24}$","minLength":24,"maxLength":24,"description":"Department ID assigned to the deal"}},"additionalProperties":false}}],"responses":{"200":{"description":"Deal updated","schema":{"$ref":"#/definitions/deal"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Deal not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Update the deal amount\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/deals/{dealId} \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"amount\":2500}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Update the deal amount\necho '{\"amount\":2500}' |  \\\n  http PATCH https://api.wassenger.com/v1/deals/{dealId} \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Update the deal amount\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"amount\":2500}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Update the deal amount\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/deals/{dealId}',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {amount: 2500}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Update the deal amount\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/deals/{dealId}');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  amount: 2500\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Update the deal amount\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/deals/{dealId}', [\n  'body' => '{\"amount\":2500}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Update the deal amount\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'amount' => 2500\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/deals/{dealId}');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Update the deal amount\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/deals/{dealId}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'amount' => 2500\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Update the deal amount\nimport requests\n\nurl = \"https://api.wassenger.com/v1/deals/{dealId}\"\n\npayload = { \"amount\": 2500 }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update the deal amount\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"amount\":2500}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update the deal amount\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/deals/{dealId}',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"amount\":2500}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Update the deal amount\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/deals/{dealId}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"amount\\\":2500}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Update the deal amount\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/deals/{dealId}\"\n\n\tpayload := strings.NewReader(\"{\\\"amount\\\":2500}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Update the deal amount\nvar client = new RestClient(\"https://api.wassenger.com/v1/deals/{dealId}\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"amount\\\":2500}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Update the deal amount\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/deals/{dealId}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"amount\\\":2500}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Update the deal amount\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/deals/{dealId}\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"amount\\\":2500}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Update the deal amount\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"amount\\\":2500}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/deals/{dealId}\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Update the deal amount\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/deals/{dealId}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"amount\\\":2500}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Update the deal amount\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/deals/{dealId}' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"amount\":2500}'"},{"lang":"ObjC","source":"// Update the deal amount\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"amount\": @2500 };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/deals/{dealId}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Update the deal amount\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"amount\": 2500] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/deals/{dealId}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Archive deal","description":"Archive a deal by ID. Archived deals disappear from the board but are preserved for history.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fdeals%2F%7BdealId%7D&method=DELETE&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"archiveDeal","security":[{"apiKey":[]}],"tags":["Deals"],"parameters":[],"responses":{"200":{"description":"Deal archived","schema":{"$ref":"#/definitions/deal"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Deal not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Archive a deal\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/deals/{dealId} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Archive a deal\nhttp DELETE https://api.wassenger.com/v1/deals/{dealId} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Archive a deal\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Archive a deal\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/deals/{dealId}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Archive a deal\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/deals/{dealId}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Archive a deal\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/deals/{dealId}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Archive a deal\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/deals/{dealId}');\n$request->setRequestMethod('DELETE');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Archive a deal\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/deals/{dealId}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Archive a deal\nimport requests\n\nurl = \"https://api.wassenger.com/v1/deals/{dealId}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.delete(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Archive a deal\nconst url = 'https://api.wassenger.com/v1/deals/{dealId}';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Archive a deal\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/deals/{dealId}',\n  method: 'DELETE',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Archive a deal\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/deals/{dealId}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Archive a deal\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/deals/{dealId}\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Archive a deal\nvar client = new RestClient(\"https://api.wassenger.com/v1/deals/{dealId}\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Archive a deal\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/deals/{dealId}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Archive a deal\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/deals/{dealId}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Archive a deal\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/deals/{dealId}\")\n  .delete(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Archive a deal\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/deals/{dealId}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Archive a deal\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/deals/{dealId}' -Method DELETE -Headers $headers"},{"lang":"ObjC","source":"// Archive a deal\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/deals/{dealId}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Archive a deal\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/deals/{dealId}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/campaigns/{campaignId}/status":{"parameters":[],"put":{"summary":"Start/stop campaign","description":"Start or stop campaign delivery.\n\n\n\n- Only campaigns with status `pending` or `paused` can be started.\n\n- Only campaigns with status `pending` or `processing` can be stopped.\n\n\n\nIf you want to permanently cancel or delete a campaign, use the [delete campaign endpoint](#operation/deleteCampaign) instead.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fcampaigns%2F%7Bid%7D%2Fstatus&method=PUT&body=%7B%0A%20%20%22action%22%3A%20%22start%22%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateCampaign","security":[{"apiKey":[]}],"tags":["Campaigns"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"campaign","schema":{"type":"object","properties":{"action":{"type":"string","enum":["start","stop"],"description":"Start or stop a campaign"}},"required":["action"],"additionalProperties":false}}],"responses":{"202":{"description":"Campaign updated","schema":{"$ref":"#/definitions/campaign"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Campaign is no longer editable","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Start campaign delivery now\ncurl --request PUT \\\n  --url https://api.wassenger.com/v1/campaigns/{id}/status \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"action\":\"start\"}'\n\n\n// Stop campaign delivery\ncurl --request PUT \\\n  --url https://api.wassenger.com/v1/campaigns/{id}/status \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"action\":\"stop\"}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Start campaign delivery now\necho '{\"action\":\"start\"}' |  \\\n  http PUT https://api.wassenger.com/v1/campaigns/{id}/status \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Stop campaign delivery\necho '{\"action\":\"stop\"}' |  \\\n  http PUT https://api.wassenger.com/v1/campaigns/{id}/status \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Start campaign delivery now\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/campaigns/{id}/status';\nconst options = {\n  method: 'PUT',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"start\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Stop campaign delivery\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/campaigns/{id}/status';\nconst options = {\n  method: 'PUT',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"stop\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Start campaign delivery now\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PUT',\n  url: 'https://api.wassenger.com/v1/campaigns/{id}/status',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {action: 'start'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Stop campaign delivery\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PUT',\n  url: 'https://api.wassenger.com/v1/campaigns/{id}/status',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {action: 'stop'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Start campaign delivery now\nconst unirest = require('unirest');\n\nconst req = unirest('PUT', 'https://api.wassenger.com/v1/campaigns/{id}/status');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  action: 'start'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Stop campaign delivery\nconst unirest = require('unirest');\n\nconst req = unirest('PUT', 'https://api.wassenger.com/v1/campaigns/{id}/status');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  action: 'stop'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Start campaign delivery now\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PUT', 'https://api.wassenger.com/v1/campaigns/{id}/status', [\n  'body' => '{\"action\":\"start\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Stop campaign delivery\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PUT', 'https://api.wassenger.com/v1/campaigns/{id}/status', [\n  'body' => '{\"action\":\"stop\"}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Start campaign delivery now\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'action' => 'start'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/campaigns/{id}/status');\n$request->setRequestMethod('PUT');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Stop campaign delivery\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'action' => 'stop'\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/campaigns/{id}/status');\n$request->setRequestMethod('PUT');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Start campaign delivery now\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/campaigns/{id}/status\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PUT\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'action' => 'start'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Stop campaign delivery\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/campaigns/{id}/status\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PUT\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'action' => 'stop'\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Start campaign delivery now\nimport requests\n\nurl = \"https://api.wassenger.com/v1/campaigns/{id}/status\"\n\npayload = { \"action\": \"start\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.put(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Stop campaign delivery\nimport requests\n\nurl = \"https://api.wassenger.com/v1/campaigns/{id}/status\"\n\npayload = { \"action\": \"stop\" }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.put(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Start campaign delivery now\nconst url = 'https://api.wassenger.com/v1/campaigns/{id}/status';\nconst options = {\n  method: 'PUT',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"start\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Stop campaign delivery\nconst url = 'https://api.wassenger.com/v1/campaigns/{id}/status';\nconst options = {\n  method: 'PUT',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"action\":\"stop\"}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Start campaign delivery now\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/campaigns/{id}/status',\n  method: 'PUT',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"action\":\"start\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Stop campaign delivery\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/campaigns/{id}/status',\n  method: 'PUT',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"action\":\"stop\"}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Start campaign delivery now\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/campaigns/{id}/status\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Put.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"action\\\":\\\"start\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Stop campaign delivery\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/campaigns/{id}/status\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Put.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"action\\\":\\\"stop\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Start campaign delivery now\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/campaigns/{id}/status\"\n\n\tpayload := strings.NewReader(\"{\\\"action\\\":\\\"start\\\"}\")\n\n\treq, _ := http.NewRequest(\"PUT\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Stop campaign delivery\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/campaigns/{id}/status\"\n\n\tpayload := strings.NewReader(\"{\\\"action\\\":\\\"stop\\\"}\")\n\n\treq, _ := http.NewRequest(\"PUT\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Start campaign delivery now\nvar client = new RestClient(\"https://api.wassenger.com/v1/campaigns/{id}/status\");\nvar request = new RestRequest(Method.PUT);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"action\\\":\\\"start\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Stop campaign delivery\nvar client = new RestClient(\"https://api.wassenger.com/v1/campaigns/{id}/status\");\nvar request = new RestRequest(Method.PUT);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"action\\\":\\\"stop\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Start campaign delivery now\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Put,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/campaigns/{id}/status\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"action\\\":\\\"start\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Stop campaign delivery\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Put,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/campaigns/{id}/status\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"action\\\":\\\"stop\\\"}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Start campaign delivery now\nHttpResponse<String> response = Unirest.put(\"https://api.wassenger.com/v1/campaigns/{id}/status\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"action\\\":\\\"start\\\"}\")\n  .asString();\n\n\n// Stop campaign delivery\nHttpResponse<String> response = Unirest.put(\"https://api.wassenger.com/v1/campaigns/{id}/status\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"action\\\":\\\"stop\\\"}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Start campaign delivery now\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"action\\\":\\\"start\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/campaigns/{id}/status\")\n  .put(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Stop campaign delivery\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"action\\\":\\\"stop\\\"}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/campaigns/{id}/status\")\n  .put(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Start campaign delivery now\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PUT\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/campaigns/{id}/status\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"action\\\":\\\"start\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Stop campaign delivery\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PUT\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/campaigns/{id}/status\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"action\\\":\\\"stop\\\"}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Start campaign delivery now\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/campaigns/{id}/status' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{\"action\":\"start\"}'\n\n\n# Stop campaign delivery\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/campaigns/{id}/status' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{\"action\":\"stop\"}'"},{"lang":"ObjC","source":"// Start campaign delivery now\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"action\": @\"start\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/campaigns/{id}/status\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PUT\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Stop campaign delivery\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"action\": @\"stop\" };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/campaigns/{id}/status\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PUT\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Start campaign delivery now\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"action\": \"start\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/campaigns/{id}/status\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PUT\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Stop campaign delivery\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"action\": \"stop\"] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/campaigns/{id}/status\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PUT\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/campaigns/{campaignId}/contacts":{"parameters":[],"get":{"summary":"List campaign contacts","description":"Retrieve the list of contacts for a specific campaign.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fcampaigns%2F%7Bid%7D%2Fcontacts&params=%5B%7B%22key%22%3A%22size%22%2C%22value%22%3A100%7D%2C%7B%22key%22%3A%22page%22%2C%22value%22%3A0%7D%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getCampaignContacts","security":[{"apiKey":[]}],"tags":["Campaigns"],"consumes":["application/json"],"parameters":[{"in":"query","name":"search","description":"Search contacts by phone number, contact name or target group ID","type":"string","maxLength":50,"minLength":1},{"in":"query","name":"target","type":"array","minItems":1,"maxItems":50,"collectionFormat":"csv","description":"Filter by contact target: phone number (+1234567890) or group WhatsApp ID (123456789000000000@g.us)","items":{"type":"string","maxLength":30,"minLength":10,"pattern":"^\\+?([0-9-]{9,28})(@g.us|@c.us)?$/"}},{"in":"query","name":"kind","type":"array","minItems":1,"maxItems":3,"collectionFormat":"csv","description":"Filter by target kind","items":{"type":"string","enum":["user","group","channel"]}},{"in":"query","name":"status","type":"array","minItems":1,"maxItems":3,"collectionFormat":"csv","description":"Filter by delivery status","items":{"type":"string","enum":["user","group","channel"]}},{"in":"query","name":"ack","type":"array","minItems":1,"maxItems":4,"collectionFormat":"csv","description":"Filter by delivery ACK status","items":{"type":"string","enum":["pending","sent","delivered","read"]}},{"in":"query","name":"wid","type":"array","minItems":1,"maxItems":50,"collectionFormat":"csv","description":"Filter contacts by WhatsApp message IDs","items":{"type":"string","maxLength":22,"minLength":20,"pattern":"^3[0-9a-fA-F]{19,21}$"}},{"in":"query","name":"size","type":"number","default":100,"maximum":1000,"minimum":1,"description":"Results size per request"},{"in":"query","name":"page","type":"number","default":0,"maximum":50,"minimum":0,"description":"Results page number to browser sequences of entries"},{"in":"query","name":"sort","type":"string","default":"date:desc","enum":["date:desc","date:asc"],"description":"Results sorting criteria by message delivery date"}],"responses":{"200":{"description":"Campaign contacts","schema":{"type":"array","items":{"$ref":"#/definitions/campaignContact"}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Campaign is no longer editable","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get contacts in a campaign\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/campaigns/{id}/contacts?size=100&page=0' \\\n  --header 'Token: <api token goes here>'\n\n\n// Search contacts by text\ncurl --request GET \\\n  --url 'https://api.wassenger.com/v1/campaigns/{id}/contacts?search=%2B1234567890' \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get contacts in a campaign\nhttp GET 'https://api.wassenger.com/v1/campaigns/{id}/contacts?size=100&page=0' \\\n  Token:'<api token goes here>'\n\n\n// Search contacts by text\nhttp GET 'https://api.wassenger.com/v1/campaigns/{id}/contacts?search=%2B1234567890' \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get contacts in a campaign\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/campaigns/{id}/contacts?size=100&page=0';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Search contacts by text\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/campaigns/{id}/contacts?search=%2B1234567890';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get contacts in a campaign\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/campaigns/{id}/contacts',\n  params: {size: '100', page: '0'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Search contacts by text\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/campaigns/{id}/contacts',\n  params: {search: '+1234567890'},\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get contacts in a campaign\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/campaigns/{id}/contacts');\n\nreq.query({\n  size: '100',\n  page: '0'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Search contacts by text\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/campaigns/{id}/contacts');\n\nreq.query({\n  search: '+1234567890'\n});\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get contacts in a campaign\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/campaigns/{id}/contacts?size=100&page=0', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Search contacts by text\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/campaigns/{id}/contacts?search=%2B1234567890', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get contacts in a campaign\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/campaigns/{id}/contacts');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'size' => '100',\n  'page' => '0'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Search contacts by text\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/campaigns/{id}/contacts');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'search' => '+1234567890'\n]));\n\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get contacts in a campaign\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/campaigns/{id}/contacts?size=100&page=0\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Search contacts by text\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/campaigns/{id}/contacts?search=%2B1234567890\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get contacts in a campaign\nimport requests\n\nurl = \"https://api.wassenger.com/v1/campaigns/{id}/contacts\"\n\nquerystring = {\"size\":\"100\",\"page\":\"0\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())\n\n\n# Search contacts by text\nimport requests\n\nurl = \"https://api.wassenger.com/v1/campaigns/{id}/contacts\"\n\nquerystring = {\"search\":\"+1234567890\"}\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers, params=querystring)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get contacts in a campaign\nconst url = 'https://api.wassenger.com/v1/campaigns/{id}/contacts?size=100&page=0';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Search contacts by text\nconst url = 'https://api.wassenger.com/v1/campaigns/{id}/contacts?search=%2B1234567890';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get contacts in a campaign\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/campaigns/{id}/contacts?size=100&page=0',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Search contacts by text\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/campaigns/{id}/contacts?search=%2B1234567890',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get contacts in a campaign\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/campaigns/{id}/contacts?size=100&page=0\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Search contacts by text\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/campaigns/{id}/contacts?search=%2B1234567890\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get contacts in a campaign\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/campaigns/{id}/contacts?size=100&page=0\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Search contacts by text\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/campaigns/{id}/contacts?search=%2B1234567890\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get contacts in a campaign\nvar client = new RestClient(\"https://api.wassenger.com/v1/campaigns/{id}/contacts?size=100&page=0\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Search contacts by text\nvar client = new RestClient(\"https://api.wassenger.com/v1/campaigns/{id}/contacts?search=%2B1234567890\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get contacts in a campaign\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/campaigns/{id}/contacts?size=100&page=0\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Search contacts by text\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/campaigns/{id}/contacts?search=%2B1234567890\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get contacts in a campaign\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/campaigns/{id}/contacts?size=100&page=0\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Search contacts by text\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/campaigns/{id}/contacts?search=%2B1234567890\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get contacts in a campaign\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/campaigns/{id}/contacts?size=100&page=0\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Search contacts by text\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/campaigns/{id}/contacts?search=%2B1234567890\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get contacts in a campaign\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/campaigns/{id}/contacts?size=100&page=0\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Search contacts by text\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/campaigns/{id}/contacts?search=%2B1234567890\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get contacts in a campaign\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/campaigns/{id}/contacts?size=100&page=0' -Method GET -Headers $headers\n\n\n# Search contacts by text\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/campaigns/{id}/contacts?search=%2B1234567890' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get contacts in a campaign\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/campaigns/{id}/contacts?size=100&page=0\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Search contacts by text\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/campaigns/{id}/contacts?search=%2B1234567890\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get contacts in a campaign\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/campaigns/{id}/contacts?size=100&page=0\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Search contacts by text\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/campaigns/{id}/contacts?search=%2B1234567890\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Update campaign contacts","description":"Update or upsert contacts in an existing campaign.\n\n\n\nBy default, contacts are partially updated (upsert). To overwrite all contacts, use the URL query param `overwrite=true` in the call.\n\n\n\nOnly campaigns with `draft`, `pending` and `paused` status can be updated.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fcampaigns%2F%7Bid%7D%2Fcontacts&method=PATCH&body=%5B%0A%20%20%7B%0A%20%20%20%20%22target%22%3A%20%22%2B1234567890%22%2C%0A%20%20%20%20%22name%22%3A%20%22Contact%20name%22%2C%0A%20%20%20%20%22message%22%3A%20%22Sample%20message%20to%20send%20to%20this%20contact%20on%20this%20campaign%22%0A%20%20%7D%0A%5D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateCampaignContacts","security":[{"apiKey":[]}],"tags":["Campaigns"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"query","name":"overwrite","type":"boolean","default":false,"description":"Use `overwrite=true` to update all contacts in the campaign, overwriting previous existing contacts"},{"in":"body","name":"contacts","schema":{"type":"array","items":{"type":"object","properties":{"phone":{"type":"string","minLength":6,"maxLength":16,"description":"Target contact phone number in E164 format. Example: `+1234567890`"},"group":{"type":"string","pattern":"^([0-9-]{15,30})(@g.us)?$","minLength":10,"maxLength":30,"description":"Target group chat WhatsApp ID. Example: `123456789000000000@g.us`"},"name":{"type":"string","maxLength":50,"description":"Optional. Target contact name. If not specified, the internal CRM contact name, if it exists, will be used instead. In case there is no contact available, the field will be empty"},"message":{"type":"string","minLength":2,"maxLength":10000,"description":"Optional. Message to be sent to the specific phone number. If not specified, the campaign message will be used instead. Message can use WhatsApp text-rich syntax to format the message."},"url":{"type":"string","maxLength":2048,"description":"Optional file URL header to be sent for this specific contact. Only applicable to WABA API numbers using template messages with a multimedia header. The URL must point to a valid image (`image/*`), video (`video/mp4`), or document file (`application/pdf`)."},"reference":{"type":"string","maxLength":200,"description":"Optional message reference identifier. The reference edentifier will be notified via webhook events. See the [webhooks documentation](/help/webhooks) for more information."},"source":{"type":"string","maxLength":20,"enum":["import","contacts"],"description":"Campaign recipients source. Use `import` for the file imported recipients via Excel/CSV/Google Sheets, or `contacts` for CRM loaded contacts source."},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-zA-Z0-9_]*$","minLength":1,"maxLength":50,"description":"Variable key name"},"value":{"type":"string","minLength":1,"maxLength":500,"description":"Variable value"},"component":{"type":"string","pattern":"^(body|header|header_location|button_url_\\d+|button_copy_code_\\d+)$","description":"Variable component type: body, header, header_location (for location headers), button_url_N (for dynamic URL buttons), or button_copy_code_N (for copy code buttons). If omitted, it is inferred from the variable key prefix (`header_*` -> header, `header_location_*` -> header_location, `button_url_N*` -> button_url_N, `button_copy_code_N*` -> button_copy_code_N), defaulting to `body`."}},"required":["key","value"],"additionalProperties":false},"maxItems":30,"description":"Optional list of variables to use in the message. Variables can be used to personalize the message content. See the [variables documentation](/help/template) for more details."}},"additionalProperties":false,"description":"Campaign target contact entry. You can specify either a `phone` or `group` field, but not both. If you specify a `group` field, the message will be sent to all participants in the group."},"minItems":0,"maxItems":2000}}],"responses":{"200":{"description":"Campaign contacts updated","schema":{"type":"object","properties":{"total":{"type":"number","description":"Total number of contacts in the campaign"},"updated":{"type":"number","description":"Total number of updated contacts"},"valid":{"type":"number","description":"Number of recipients that can receive the campaign"},"invalid":{"type":"array","description":"List of invalid contacts that were not updated","items":{"type":"object","properties":{"phone":{"type":"string","description":"Contact phone number"},"error":{"type":"string","description":"Error message describing why the contact is invalid"}}}},"excluded":{"type":"object","description":"Breakdown of recipients excluded because they cannot receive a campaign","properties":{"removed":{"type":"number","description":"Recipients removed from this number's contacts"},"unsubscribed":{"type":"number","description":"Recipients that unsubscribed from campaigns (replied to opt out)"},"excluded":{"type":"number","description":"Recipients manually excluded from all campaigns"},"blocked":{"type":"number","description":"Recipients that are blocked"},"inactive":{"type":"number","description":"Recipients with an otherwise inactive contact"}}}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Campaign is no longer editable","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Update campaign contacts\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/campaigns/{id}/contacts \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '[{\"target\":\"+1234567890\",\"name\":\"Contact name\",\"message\":\"Sample message to send to this contact on this campaign\"}]'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Update campaign contacts\necho '[{\"target\":\"+1234567890\",\"name\":\"Contact name\",\"message\":\"Sample message to send to this contact on this campaign\"}]' |  \\\n  http PATCH https://api.wassenger.com/v1/campaigns/{id}/contacts \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Update campaign contacts\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/campaigns/{id}/contacts';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"target\":\"+1234567890\",\"name\":\"Contact name\",\"message\":\"Sample message to send to this contact on this campaign\"}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Update campaign contacts\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/campaigns/{id}/contacts',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: [\n    {\n      target: '+1234567890',\n      name: 'Contact name',\n      message: 'Sample message to send to this contact on this campaign'\n    }\n  ]\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Update campaign contacts\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/campaigns/{id}/contacts');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send([\n  {\n    target: '+1234567890',\n    name: 'Contact name',\n    message: 'Sample message to send to this contact on this campaign'\n  }\n]);\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Update campaign contacts\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/campaigns/{id}/contacts', [\n  'body' => '[{\"target\":\"+1234567890\",\"name\":\"Contact name\",\"message\":\"Sample message to send to this contact on this campaign\"}]',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Update campaign contacts\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  [\n    'target' => '+1234567890',\n    'name' => 'Contact name',\n    'message' => 'Sample message to send to this contact on this campaign'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/campaigns/{id}/contacts');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Update campaign contacts\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/campaigns/{id}/contacts\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    [\n        'target' => '+1234567890',\n        'name' => 'Contact name',\n        'message' => 'Sample message to send to this contact on this campaign'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Update campaign contacts\nimport requests\n\nurl = \"https://api.wassenger.com/v1/campaigns/{id}/contacts\"\n\npayload = [\n    {\n        \"target\": \"+1234567890\",\n        \"name\": \"Contact name\",\n        \"message\": \"Sample message to send to this contact on this campaign\"\n    }\n]\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update campaign contacts\nconst url = 'https://api.wassenger.com/v1/campaigns/{id}/contacts';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '[{\"target\":\"+1234567890\",\"name\":\"Contact name\",\"message\":\"Sample message to send to this contact on this campaign\"}]'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update campaign contacts\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/campaigns/{id}/contacts',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '[{\"target\":\"+1234567890\",\"name\":\"Contact name\",\"message\":\"Sample message to send to this contact on this campaign\"}]'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Update campaign contacts\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/campaigns/{id}/contacts\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"[{\\\"target\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Contact name\\\",\\\"message\\\":\\\"Sample message to send to this contact on this campaign\\\"}]\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Update campaign contacts\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/campaigns/{id}/contacts\"\n\n\tpayload := strings.NewReader(\"[{\\\"target\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Contact name\\\",\\\"message\\\":\\\"Sample message to send to this contact on this campaign\\\"}]\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Update campaign contacts\nvar client = new RestClient(\"https://api.wassenger.com/v1/campaigns/{id}/contacts\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"[{\\\"target\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Contact name\\\",\\\"message\\\":\\\"Sample message to send to this contact on this campaign\\\"}]\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Update campaign contacts\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/campaigns/{id}/contacts\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"[{\\\"target\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Contact name\\\",\\\"message\\\":\\\"Sample message to send to this contact on this campaign\\\"}]\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Update campaign contacts\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/campaigns/{id}/contacts\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"[{\\\"target\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Contact name\\\",\\\"message\\\":\\\"Sample message to send to this contact on this campaign\\\"}]\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Update campaign contacts\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"[{\\\"target\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Contact name\\\",\\\"message\\\":\\\"Sample message to send to this contact on this campaign\\\"}]\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/campaigns/{id}/contacts\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Update campaign contacts\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/campaigns/{id}/contacts\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"[{\\\"target\\\":\\\"+1234567890\\\",\\\"name\\\":\\\"Contact name\\\",\\\"message\\\":\\\"Sample message to send to this contact on this campaign\\\"}]\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Update campaign contacts\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/campaigns/{id}/contacts' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '[{\"target\":\"+1234567890\",\"name\":\"Contact name\",\"message\":\"Sample message to send to this contact on this campaign\"}]'"},{"lang":"ObjC","source":"// Update campaign contacts\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @[ @{ @\"target\": @\"+1234567890\", @\"name\": @\"Contact name\", @\"message\": @\"Sample message to send to this contact on this campaign\" } ];\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/campaigns/{id}/contacts\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Update campaign contacts\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  [\n    \"target\": \"+1234567890\",\n    \"name\": \"Contact name\",\n    \"message\": \"Sample message to send to this contact on this campaign\"\n  ]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/campaigns/{id}/contacts\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Delete campaign contacts","description":"Delete all or specific campaign contacts by using the available search filters.\n\n\n\nThis action can only be performend on campaigns with the `draft` or `paused` status.\n\nIf the campaign is already processing or it was completed, this action is not allowed.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fcampaigns%2F%7Bid%7D%2Fcontacts&method=DELETE&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deleteCampaignContacts","security":[{"apiKey":[]}],"tags":["Campaigns"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"contacts","schema":{"type":"object","properties":{"wids":{"type":"array","items":{"type":"string","pattern":"^3[0-9a-fA-F]{19,21}$","minLength":20,"maxLength":22},"maxItems":500,"description":"Delete campaign contacts by WhatsApp message IDs (WID). Example: `3EB04FD61059A925F101A0`"},"contacts":{"type":"array","items":{"type":"string","pattern":"^([0-9-]{8,30})(@g.us|@c.us)?$","minLength":8,"maxLength":30,"description":"WhatsApp Contact ID to delete"},"maxItems":500,"description":"Delete campaign contacts by WhatsApp IDs. Example: `1234567890@c.us` for users or `123456789000000000@g.us` for groups"},"phones":{"type":"array","items":{"type":"string","minLength":6,"maxLength":16},"maxItems":500,"description":"Delete campaign contacts by phone number in E164 format. Example: `+1234567890`"},"groups":{"type":"array","items":{"type":"string","pattern":"^([0-9-]{15,30})(@g.us)?$","minLength":10,"maxLength":30},"maxItems":500,"description":"Delete campaign contacts by group chat WhatsApp ID. Example: `123456789000000000@g.us`"}},"additionalProperties":false}}],"responses":{"200":{"description":"Contacts deleted successfully","schema":{"type":"object","properties":{"deleted":{"type":"number","description":"Total number of deleted contacts"},"active":{"type":"number","default":0,"description":"Total number of active contacts after deletion"}}}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Campaign is no longer editable","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Delete all contacts in the campaign\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/campaigns/{id}/contacts \\\n  --header 'Token: <api token goes here>'\n\n\n// Delete contacts by phone number in the campaign\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/campaigns/{id}/contacts \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"phones\":[\"+1234567890\",\"+1234567890\",\"+1234567890\"],\"groups\":[\"123456789000000000@g.us\",\"123456789000000000@g.us\"]}'\n\n\n// Delete contacts by WhatsApp IDs in the campaign\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/campaigns/{id}/contacts \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"wids\":[\"3EB03450462A256E81D0\",\"3EB03450462A256E81D1\",\"3EB03450462A256E81D2\"]}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Delete all contacts in the campaign\nhttp DELETE https://api.wassenger.com/v1/campaigns/{id}/contacts \\\n  Token:'<api token goes here>'\n\n\n// Delete contacts by phone number in the campaign\necho '{\"phones\":[\"+1234567890\",\"+1234567890\",\"+1234567890\"],\"groups\":[\"123456789000000000@g.us\",\"123456789000000000@g.us\"]}' |  \\\n  http DELETE https://api.wassenger.com/v1/campaigns/{id}/contacts \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'\n\n\n// Delete contacts by WhatsApp IDs in the campaign\necho '{\"wids\":[\"3EB03450462A256E81D0\",\"3EB03450462A256E81D1\",\"3EB03450462A256E81D2\"]}' |  \\\n  http DELETE https://api.wassenger.com/v1/campaigns/{id}/contacts \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Delete all contacts in the campaign\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/campaigns/{id}/contacts';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete contacts by phone number in the campaign\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/campaigns/{id}/contacts';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phones\":[\"+1234567890\",\"+1234567890\",\"+1234567890\"],\"groups\":[\"123456789000000000@g.us\",\"123456789000000000@g.us\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete contacts by WhatsApp IDs in the campaign\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/campaigns/{id}/contacts';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"wids\":[\"3EB03450462A256E81D0\",\"3EB03450462A256E81D1\",\"3EB03450462A256E81D2\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Delete all contacts in the campaign\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/campaigns/{id}/contacts',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete contacts by phone number in the campaign\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/campaigns/{id}/contacts',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    phones: ['+1234567890', '+1234567890', '+1234567890'],\n    groups: ['123456789000000000@g.us', '123456789000000000@g.us']\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete contacts by WhatsApp IDs in the campaign\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/campaigns/{id}/contacts',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {wids: ['3EB03450462A256E81D0', '3EB03450462A256E81D1', '3EB03450462A256E81D2']}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Delete all contacts in the campaign\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/campaigns/{id}/contacts');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Delete contacts by phone number in the campaign\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/campaigns/{id}/contacts');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  phones: [\n    '+1234567890',\n    '+1234567890',\n    '+1234567890'\n  ],\n  groups: [\n    '123456789000000000@g.us',\n    '123456789000000000@g.us'\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});\n\n\n// Delete contacts by WhatsApp IDs in the campaign\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/campaigns/{id}/contacts');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  wids: [\n    '3EB03450462A256E81D0',\n    '3EB03450462A256E81D1',\n    '3EB03450462A256E81D2'\n  ]\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Delete all contacts in the campaign\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/campaigns/{id}/contacts', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Delete contacts by phone number in the campaign\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/campaigns/{id}/contacts', [\n  'body' => '{\"phones\":[\"+1234567890\",\"+1234567890\",\"+1234567890\"],\"groups\":[\"123456789000000000@g.us\",\"123456789000000000@g.us\"]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();\n\n\n// Delete contacts by WhatsApp IDs in the campaign\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/campaigns/{id}/contacts', [\n  'body' => '{\"wids\":[\"3EB03450462A256E81D0\",\"3EB03450462A256E81D1\",\"3EB03450462A256E81D2\"]}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Delete all contacts in the campaign\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/campaigns/{id}/contacts');\n$request->setRequestMethod('DELETE');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Delete contacts by phone number in the campaign\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'phones' => [\n    '+1234567890',\n    '+1234567890',\n    '+1234567890'\n  ],\n  'groups' => [\n    '123456789000000000@g.us',\n    '123456789000000000@g.us'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/campaigns/{id}/contacts');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();\n\n\n// Delete contacts by WhatsApp IDs in the campaign\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'wids' => [\n    '3EB03450462A256E81D0',\n    '3EB03450462A256E81D1',\n    '3EB03450462A256E81D2'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/campaigns/{id}/contacts');\n$request->setRequestMethod('DELETE');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Delete all contacts in the campaign\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/campaigns/{id}/contacts\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Delete contacts by phone number in the campaign\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/campaigns/{id}/contacts\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'phones' => [\n        '+1234567890',\n        '+1234567890',\n        '+1234567890'\n    ],\n    'groups' => [\n        '123456789000000000@g.us',\n        '123456789000000000@g.us'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n\n\n// Delete contacts by WhatsApp IDs in the campaign\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/campaigns/{id}/contacts\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'wids' => [\n        '3EB03450462A256E81D0',\n        '3EB03450462A256E81D1',\n        '3EB03450462A256E81D2'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Delete all contacts in the campaign\nimport requests\n\nurl = \"https://api.wassenger.com/v1/campaigns/{id}/contacts\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.delete(url, headers=headers)\n\nprint(response.json())\n\n\n# Delete contacts by phone number in the campaign\nimport requests\n\nurl = \"https://api.wassenger.com/v1/campaigns/{id}/contacts\"\n\npayload = {\n    \"phones\": [\"+1234567890\", \"+1234567890\", \"+1234567890\"],\n    \"groups\": [\"123456789000000000@g.us\", \"123456789000000000@g.us\"]\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())\n\n\n# Delete contacts by WhatsApp IDs in the campaign\nimport requests\n\nurl = \"https://api.wassenger.com/v1/campaigns/{id}/contacts\"\n\npayload = { \"wids\": [\"3EB03450462A256E81D0\", \"3EB03450462A256E81D1\", \"3EB03450462A256E81D2\"] }\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.delete(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete all contacts in the campaign\nconst url = 'https://api.wassenger.com/v1/campaigns/{id}/contacts';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete contacts by phone number in the campaign\nconst url = 'https://api.wassenger.com/v1/campaigns/{id}/contacts';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"phones\":[\"+1234567890\",\"+1234567890\",\"+1234567890\"],\"groups\":[\"123456789000000000@g.us\",\"123456789000000000@g.us\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}\n\n\n// Delete contacts by WhatsApp IDs in the campaign\nconst url = 'https://api.wassenger.com/v1/campaigns/{id}/contacts';\nconst options = {\n  method: 'DELETE',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"wids\":[\"3EB03450462A256E81D0\",\"3EB03450462A256E81D1\",\"3EB03450462A256E81D2\"]}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete all contacts in the campaign\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/campaigns/{id}/contacts',\n  method: 'DELETE',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Delete contacts by phone number in the campaign\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/campaigns/{id}/contacts',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"phones\":[\"+1234567890\",\"+1234567890\",\"+1234567890\"],\"groups\":[\"123456789000000000@g.us\",\"123456789000000000@g.us\"]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n\n\n// Delete contacts by WhatsApp IDs in the campaign\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/campaigns/{id}/contacts',\n  method: 'DELETE',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"wids\":[\"3EB03450462A256E81D0\",\"3EB03450462A256E81D1\",\"3EB03450462A256E81D2\"]}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Delete all contacts in the campaign\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/campaigns/{id}/contacts\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Delete contacts by phone number in the campaign\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/campaigns/{id}/contacts\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"phones\\\":[\\\"+1234567890\\\",\\\"+1234567890\\\",\\\"+1234567890\\\"],\\\"groups\\\":[\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\"]}\"\n\nresponse = http.request(request)\nputs response.read_body\n\n\n# Delete contacts by WhatsApp IDs in the campaign\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/campaigns/{id}/contacts\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"wids\\\":[\\\"3EB03450462A256E81D0\\\",\\\"3EB03450462A256E81D1\\\",\\\"3EB03450462A256E81D2\\\"]}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Delete all contacts in the campaign\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/campaigns/{id}/contacts\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Delete contacts by phone number in the campaign\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/campaigns/{id}/contacts\"\n\n\tpayload := strings.NewReader(\"{\\\"phones\\\":[\\\"+1234567890\\\",\\\"+1234567890\\\",\\\"+1234567890\\\"],\\\"groups\\\":[\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\"]}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}\n\n\n// Delete contacts by WhatsApp IDs in the campaign\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/campaigns/{id}/contacts\"\n\n\tpayload := strings.NewReader(\"{\\\"wids\\\":[\\\"3EB03450462A256E81D0\\\",\\\"3EB03450462A256E81D1\\\",\\\"3EB03450462A256E81D2\\\"]}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Delete all contacts in the campaign\nvar client = new RestClient(\"https://api.wassenger.com/v1/campaigns/{id}/contacts\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);\n\n\n// Delete contacts by phone number in the campaign\nvar client = new RestClient(\"https://api.wassenger.com/v1/campaigns/{id}/contacts\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"phones\\\":[\\\"+1234567890\\\",\\\"+1234567890\\\",\\\"+1234567890\\\"],\\\"groups\\\":[\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\"]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);\n\n\n// Delete contacts by WhatsApp IDs in the campaign\nvar client = new RestClient(\"https://api.wassenger.com/v1/campaigns/{id}/contacts\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"wids\\\":[\\\"3EB03450462A256E81D0\\\",\\\"3EB03450462A256E81D1\\\",\\\"3EB03450462A256E81D2\\\"]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Delete all contacts in the campaign\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/campaigns/{id}/contacts\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Delete contacts by phone number in the campaign\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/campaigns/{id}/contacts\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"phones\\\":[\\\"+1234567890\\\",\\\"+1234567890\\\",\\\"+1234567890\\\"],\\\"groups\\\":[\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\"]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}\n\n\n// Delete contacts by WhatsApp IDs in the campaign\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/campaigns/{id}/contacts\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"wids\\\":[\\\"3EB03450462A256E81D0\\\",\\\"3EB03450462A256E81D1\\\",\\\"3EB03450462A256E81D2\\\"]}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Delete all contacts in the campaign\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/campaigns/{id}/contacts\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();\n\n\n// Delete contacts by phone number in the campaign\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/campaigns/{id}/contacts\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"phones\\\":[\\\"+1234567890\\\",\\\"+1234567890\\\",\\\"+1234567890\\\"],\\\"groups\\\":[\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\"]}\")\n  .asString();\n\n\n// Delete contacts by WhatsApp IDs in the campaign\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/campaigns/{id}/contacts\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"wids\\\":[\\\"3EB03450462A256E81D0\\\",\\\"3EB03450462A256E81D1\\\",\\\"3EB03450462A256E81D2\\\"]}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Delete all contacts in the campaign\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/campaigns/{id}/contacts\")\n  .delete(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Delete contacts by phone number in the campaign\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"phones\\\":[\\\"+1234567890\\\",\\\"+1234567890\\\",\\\"+1234567890\\\"],\\\"groups\\\":[\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\"]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/campaigns/{id}/contacts\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()\n\n\n// Delete contacts by WhatsApp IDs in the campaign\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"wids\\\":[\\\"3EB03450462A256E81D0\\\",\\\"3EB03450462A256E81D1\\\",\\\"3EB03450462A256E81D2\\\"]}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/campaigns/{id}/contacts\")\n  .delete(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Delete all contacts in the campaign\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/campaigns/{id}/contacts\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Delete contacts by phone number in the campaign\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/campaigns/{id}/contacts\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"phones\\\":[\\\"+1234567890\\\",\\\"+1234567890\\\",\\\"+1234567890\\\"],\\\"groups\\\":[\\\"123456789000000000@g.us\\\",\\\"123456789000000000@g.us\\\"]}\");\n\nCURLcode ret = curl_easy_perform(hnd);\n\n\n// Delete contacts by WhatsApp IDs in the campaign\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/campaigns/{id}/contacts\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"wids\\\":[\\\"3EB03450462A256E81D0\\\",\\\"3EB03450462A256E81D1\\\",\\\"3EB03450462A256E81D2\\\"]}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Delete all contacts in the campaign\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/campaigns/{id}/contacts' -Method DELETE -Headers $headers\n\n\n# Delete contacts by phone number in the campaign\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/campaigns/{id}/contacts' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"phones\":[\"+1234567890\",\"+1234567890\",\"+1234567890\"],\"groups\":[\"123456789000000000@g.us\",\"123456789000000000@g.us\"]}'\n\n\n# Delete contacts by WhatsApp IDs in the campaign\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/campaigns/{id}/contacts' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{\"wids\":[\"3EB03450462A256E81D0\",\"3EB03450462A256E81D1\",\"3EB03450462A256E81D2\"]}'"},{"lang":"ObjC","source":"// Delete all contacts in the campaign\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/campaigns/{id}/contacts\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Delete contacts by phone number in the campaign\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"phones\": @[ @\"+1234567890\", @\"+1234567890\", @\"+1234567890\" ],\n                              @\"groups\": @[ @\"123456789000000000@g.us\", @\"123456789000000000@g.us\" ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/campaigns/{id}/contacts\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];\n\n\n// Delete contacts by WhatsApp IDs in the campaign\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"wids\": @[ @\"3EB03450462A256E81D0\", @\"3EB03450462A256E81D1\", @\"3EB03450462A256E81D2\" ] };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/campaigns/{id}/contacts\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Delete all contacts in the campaign\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/campaigns/{id}/contacts\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Delete contacts by phone number in the campaign\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"phones\": [\"+1234567890\", \"+1234567890\", \"+1234567890\"],\n  \"groups\": [\"123456789000000000@g.us\", \"123456789000000000@g.us\"]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/campaigns/{id}/contacts\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()\n\n\n// Delete contacts by WhatsApp IDs in the campaign\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\"wids\": [\"3EB03450462A256E81D0\", \"3EB03450462A256E81D1\", \"3EB03450462A256E81D2\"]] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/campaigns/{id}/contacts\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/campaigns/{campaignId}":{"parameters":[],"get":{"summary":"Get campaign","description":"Get campaign information by ID\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fcampaigns%2F%7Bid%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"getCampaign","security":[{"apiKey":[]}],"tags":["Campaigns"],"consumes":["application/json"],"parameters":[],"responses":{"200":{"description":"Campaign information","schema":{"$ref":"#/definitions/campaign"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Get campaign by ID\ncurl --request GET \\\n  --url https://api.wassenger.com/v1/campaigns/{id} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Get campaign by ID\nhttp GET https://api.wassenger.com/v1/campaigns/{id} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Get campaign by ID\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/campaigns/{id}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Get campaign by ID\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'GET',\n  url: 'https://api.wassenger.com/v1/campaigns/{id}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Get campaign by ID\nconst unirest = require('unirest');\n\nconst req = unirest('GET', 'https://api.wassenger.com/v1/campaigns/{id}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Get campaign by ID\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('GET', 'https://api.wassenger.com/v1/campaigns/{id}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Get campaign by ID\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/campaigns/{id}');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Get campaign by ID\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/campaigns/{id}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Get campaign by ID\nimport requests\n\nurl = \"https://api.wassenger.com/v1/campaigns/{id}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get campaign by ID\nconst url = 'https://api.wassenger.com/v1/campaigns/{id}';\nconst options = {method: 'GET', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Get campaign by ID\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/campaigns/{id}',\n  method: 'GET',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Get campaign by ID\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/campaigns/{id}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Get campaign by ID\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/campaigns/{id}\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Get campaign by ID\nvar client = new RestClient(\"https://api.wassenger.com/v1/campaigns/{id}\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Get campaign by ID\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Get,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/campaigns/{id}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Get campaign by ID\nHttpResponse<String> response = Unirest.get(\"https://api.wassenger.com/v1/campaigns/{id}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Get campaign by ID\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/campaigns/{id}\")\n  .get()\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Get campaign by ID\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/campaigns/{id}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Get campaign by ID\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/campaigns/{id}' -Method GET -Headers $headers"},{"lang":"ObjC","source":"// Get campaign by ID\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/campaigns/{id}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"GET\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Get campaign by ID\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/campaigns/{id}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"GET\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"patch":{"summary":"Update campaign","description":"Update an existing campaign by ID\n\n\n\nCampaigns can be partially updated by sending only the fields to update.\n\n\n\nOnly campaigns with status `draft`, `pending`, `paused` can be updated.\n\nThe `name` can be updated in any status.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fcampaigns%2F%7Bid%7D&method=PATCH&body=%7B%0A%20%20%22name%22%3A%20%22New%20campaign%20name%22%2C%0A%20%20%22settings%22%3A%20%7B%0A%20%20%20%20%22speed%22%3A%202%2C%0A%20%20%20%20%22timezone%22%3A%20%22America%2FNew_York%22%2C%0A%20%20%20%20%22date%22%3A%20%222026-11-13T09%3A42%3A46.078Z%22%0A%20%20%7D%0A%7D)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"updateCampaign","security":[{"apiKey":[]}],"tags":["Campaigns"],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"campaign","schema":{"type":"object","properties":{"message":{"type":"string","minLength":2,"maxLength":10000,"description":"Optional. General message to be sent in the campaign. If not specified, the campaign message will be used instead. Message can use [template variables](/help/templates) and [WhatsApp text-rich syntax](/help/text-format) to format the message."},"template":{"type":"object","properties":{"name":{"type":"string","pattern":"^[a-z0-9_]+$","maxLength":512,"description":"Template name (lowercase, alphanumeric and underscores only)"},"language":{"type":"string","maxLength":5,"minLength":2,"description":"Language code for the template. Example: `en_US`, `de_DE`, `es_MX`, etc."}},"required":["name"],"additionalProperties":false,"description":"WABA pre-approved template message to send. Required if `message` and `file` fields are empty. Only available in WABA enabled numbers."},"file":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"Optional. Image, video or document file ID (`image/*`, `video/mp4`, or `application/pdf`) to be sent in every message in this campaign. **The file must be previously uploaded** using the [File Upload API](#tag/Files/operation/uploadFile). Set to `null` to remove the existing file."},"filename":{"type":"string","maxLength":50,"description":"Optional. Filename to be used when the user downloads the file. Only applicable to WABA API numbers."},"activate":{"type":"boolean","description":"Optional. Activate the campaign after updating it. If not specified, the campaign will remain in draft mode.\\n**Important**: only campaigns with a configured date and at least one contact can be activated, otherwise an error will be returned.","default":false},"settings":{"type":"object","properties":{"speed":{"type":"number","format":"float","minimum":0,"maximum":5,"enum":[0.025,0.0286,0.0333,0.04,0.05,0.0667,0.1,0.15,0.2,0.3,0.5,1,1.25,1.5,1.75,2,2.5,3,4,5],"description":"Campaign messages delivery speed per minute. To reduce risk of getting banned due to spam/bulk messaging, use 1 messages per minute or higher. Alternatively, for faster delivery use: `0.5` = 2 messages per minute, `0.3` = 3 messages per minute, `0.2` = 4 messages per minute"},"date":{"type":"string","format":"date-time","description":"Campaign delivery date and time in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. Example: `2024-01-15T14:00:00Z`. Time is by default based on your account time zone configuration, but you can override it by specifying a `timezone` field in the settings (see below)"},"expiration":{"type":"string","enum":["4h","8h","12h","24h","2d","3d","4d","5d","6d","7d","15d"],"description":"Optional. Campaign expiration time. Defaults to 3 days = `3d`. If the campaigns messages are not fully processed by the given time, the campaign will be automatically stopped and marked as `incomplete`. Example: `24h`"},"timezone":{"type":"string","minLength":1,"maxLength":100,"description":"Optional. Time zone to use. If not specified, your default account time zone will be used. Example: `America/New_York`. [See the list of allowed time zones values here](https://bit.ly/3wvIqJC)"}},"additionalProperties":false,"description":"Campaign settings such as delivery date and time, messages delivery speed, time zone, and allowed delivery hours"},"contacts":{"type":"array","items":{"type":"object","properties":{"phone":{"type":"string","minLength":6,"maxLength":16,"description":"Target contact phone number in E164 format. Example: `+1234567890`"},"group":{"type":"string","pattern":"^([0-9-]{15,30})(@g.us)?$","minLength":10,"maxLength":30,"description":"Target group chat WhatsApp ID. Example: `123456789000000000@g.us`"},"name":{"type":"string","maxLength":50,"description":"Optional. Target contact name. If not specified, the internal CRM contact name, if it exists, will be used instead. In case there is no contact available, the field will be empty"},"message":{"type":"string","minLength":2,"maxLength":10000,"description":"Optional. Message to be sent to the specific phone number. If not specified, the campaign message will be used instead. Message can use WhatsApp text-rich syntax to format the message."},"url":{"type":"string","maxLength":2048,"description":"Optional file URL header to be sent for this specific contact. Only applicable to WABA API numbers using template messages with a multimedia header. The URL must point to a valid image (`image/*`), video (`video/mp4`), or document file (`application/pdf`)."},"reference":{"type":"string","maxLength":200,"description":"Optional message reference identifier. The reference edentifier will be notified via webhook events. See the [webhooks documentation](/help/webhooks) for more information."},"source":{"type":"string","maxLength":20,"enum":["import","contacts"],"description":"Campaign recipients source. Use `import` for the file imported recipients via Excel/CSV/Google Sheets, or `contacts` for CRM loaded contacts source."},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-zA-Z0-9_]*$","minLength":1,"maxLength":50,"description":"Variable key name"},"value":{"type":"string","minLength":1,"maxLength":500,"description":"Variable value"},"component":{"type":"string","pattern":"^(body|header|header_location|button_url_\\d+|button_copy_code_\\d+)$","description":"Variable component type: body, header, header_location (for location headers), button_url_N (for dynamic URL buttons), or button_copy_code_N (for copy code buttons). If omitted, it is inferred from the variable key prefix (`header_*` -> header, `header_location_*` -> header_location, `button_url_N*` -> button_url_N, `button_copy_code_N*` -> button_copy_code_N), defaulting to `body`."}},"required":["key","value"],"additionalProperties":false},"maxItems":30,"description":"Optional list of variables to use in the message. Variables can be used to personalize the message content. See the [variables documentation](/help/template) for more details."}},"additionalProperties":false,"description":"Campaign target contact entry. You can specify either a `phone` or `group` field, but not both. If you specify a `group` field, the message will be sent to all participants in the group."},"minItems":0,"maxItems":2000},"actions":{"type":"array","items":{"type":"object","properties":{"action":{"type":"string","maxLength":50,"enum":["chat:assign","chat:unassign","chat:resolve","chat:unresolve","chat:read","chat:unread","labels:add","labels:set","labels:remove","metadata:add","metadata:set","metadata:remove"],"description":"Action command. See above the supported commands and params"},"params":{"type":"object","properties":{},"description":"Optional param to use per action. See the documentation above for further details about supported params per specific action command."}},"required":["action"],"additionalProperties":false},"maxItems":10,"description":"Optional list of actions to trigger after the message delivery.\n\n\n\nActions scope are limited to the chat/contact receiving the message.\n\n\n\nIf the message delivery fails, actions will be ignored.\n\n\n\n**Note**: this feature is only applicable to devices with multi-agent chat support.\n\n\n\n### Supported actions\n\n\n\n* **Action**: `chat:assign`\n* **Description**: Assign chat to an agent.\n* **Params**:\n  - **agent**: `string` (optional) - Required if `department` is not defined. Agent ID to assign the chat to after message delivery. You can retrieve the agents ID [from here](#operation/getDeviceAgents)\n  - **department**: `string` (optional) - Required if `agent` is not defined. Department ID to assign the chat to after message delivery. It can be together with `agent` field to assign a chat to both an agent and department. You can retrieve the department ID [from here](#operation/getDepartments)\n  - **assigner**: `string` (optional) - Optinoal. Agent ID who assigns the chat to the other agent\n----\n* **Action**: `chat:unassign`\n* **Description**: Unassign chat from existing agent\n* **Params**:\n  - **assigner**: `string` (optional) - Agent ID who assigns the chat to the other agent. You can retrieve the agents ID [from here](#operation/getDeviceAgents)\n----\n* **Action**: `chat:resolve`\n* **Description**: Resolve chat if not already resolved. Cannot be used along with `chat:unresolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `chat:unresolve`\n* **Description**: Unresolve chat if already resolved. Cannot be used along with `chat:resolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `chat:read`\n* **Description**: Mark the chat internally as read in the web chat interface after the message is delivered. Cannot be used along with `chat:resolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `chat:unread`\n* **Description**: Mark the chat internally as unread in the web chat interface after the message is delivered. Cannot be used along with `chat:resolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `labels:add`\n* **Description**: Add label(s) to the chat after the message is delivered\n* **Params**:\n  - **labels**: `array` (optional) - Label tags to add to the chat while keeping the existing ones. You can obtain a list of existing labels [querying this endpoint](#operation/getLabels)\n----\n* **Action**: `labels:remove`\n* **Description**: Remove label(s) from the chat, when already present, after the message is delivered\n* **Params**:\n  - **labels**: `array` (optional) - Label tags to remove from the chat. You can obtain a list of existing labels [querying this endpoint](#operation/getLabels)\n----\n* **Action**: `labels:set`\n* **Description**: Set and override label(s) in the chat after the message is delivered\n* **Params**:\n  - **labels**: `array` (optional) - Label tags to set and override in the chat. You can obtain a list of existing labels [querying this endpoint](#operation/getLabels)\n----\n* **Action**: `metadata:set`\n* **Description**: Set and override metadata key-value entries in the target chat's contact entity after the message is delivered\n* **Params**:\n  - **metadata**: `array` (optional) - Metadata entries with `key` and `value` properties to set and override in the chat's contact\n----\n* **Action**: `metadata:add`\n* **Description**: Add or override by `key` field existing metadata key-value entries in the target chat's contact entity after the message is delivered\n* **Params**:\n  - **metadata**: `array` (optional) - Metadata entries with `key` and `value` properties to append in the chat's contact\n----\n* **Action**: `metadata:remove`\n* **Description**: Remove existing metadata entries by `key` field in the target chat's contact entity after the message is delivered\n* **Params**:\n  - **keys**: `array` (optional) - Metadata entries to remove by `key` in the chat's contact"},"unsubscribe":{"type":"object","properties":{"active":{"type":"boolean","description":"Set `true` to enable automatic campaigns opt-out feature. If enabled, users can reply a pre-defined word to stop receiving messages from the campaign. **Note**: this feature is included in all current Platform plans.","default":false},"word":{"type":"string","minLength":2,"maxLength":30,"description":"Unsubscribe word to stop receiving messages from the campaign. If not specified, the default word `stop` will be used."},"message":{"type":"string","minLength":10,"maxLength":500,"description":"Unsubscribe message to append at the end of the campaign message to inform recipients how to unsubscribe from future campaigns. The message must contain a value specificed in the `word` field or `stop` as part of the message text. Required when `active` is `true`. Example message: `Reply *stop* to unsubscribe`. **Note**: message is ignored when sending WABA templates due to pre-approved content restrictions, instead you can add unsubscribe message in the template message footer."},"actions":{"type":"array","items":{"type":"object","properties":{"action":{"type":"string","maxLength":50,"enum":["chat:assign","chat:unassign","chat:resolve","chat:unresolve","chat:read","chat:unread","labels:add","labels:set","labels:remove","metadata:add","metadata:set","metadata:remove","message:send"],"description":"Action command. See above the supported commands and params"},"params":{"type":"object","properties":{},"description":"Optional params to use per action. See the documentation above for further details about supported params per specific action command."}},"required":["action"],"additionalProperties":false},"maxItems":10,"description":"Optional list of actions to trigger after the user replies unsubscribes. \n\n\n\nActions will only be executed on the specific chat that triggered the unsubscribe feature replying with the specific word, e.g: `stop`.\n\n\n\n**Note**: this feature is only applicable if the campaign has the unsubscribe feature enabled, which is included in all current Platform plans.\n\n\n\n### Supported actions\n\n\n\n* **Action**: `message:send`\n* **Description**: Send an automated message to confirm the user has opted-out successfully. This action is limited to campaigns with the opt-out feature enabled.\n* **Params**:\n  - **message**: `string` (optional) - Message text to send as a reply automated action\n----\n* **Action**: `chat:assign`\n* **Description**: Assign chat to an agent.\n* **Params**:\n  - **agent**: `string` (optional) - Required if `department` is not defined. Agent ID to assign the chat to after message delivery. You can retrieve the agents ID [from here](#operation/getDeviceAgents)\n  - **department**: `string` (optional) - Required if `agent` is not defined. Department ID to assign the chat to after message delivery. It can be together with `agent` field to assign a chat to both an agent and department. You can retrieve the department ID [from here](#operation/getDepartments)\n  - **assigner**: `string` (optional) - Optinoal. Agent ID who assigns the chat to the other agent\n----\n* **Action**: `chat:unassign`\n* **Description**: Unassign chat from existing agent\n* **Params**:\n  - **assigner**: `string` (optional) - Agent ID who assigns the chat to the other agent. You can retrieve the agents ID [from here](#operation/getDeviceAgents)\n----\n* **Action**: `chat:resolve`\n* **Description**: Resolve chat if not already resolved. Cannot be used along with `chat:unresolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `chat:unresolve`\n* **Description**: Unresolve chat if already resolved. Cannot be used along with `chat:resolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `chat:read`\n* **Description**: Mark the chat internally as read in the web chat interface after the message is delivered. Cannot be used along with `chat:resolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `chat:unread`\n* **Description**: Mark the chat internally as unread in the web chat interface after the message is delivered. Cannot be used along with `chat:resolve` action.\n* **Params**: `no params accepted`\n----\n* **Action**: `labels:add`\n* **Description**: Add label(s) to the chat after the message is delivered\n* **Params**:\n  - **labels**: `array` (optional) - Label tags to add to the chat while keeping the existing ones. You can obtain a list of existing labels [querying this endpoint](#operation/getLabels)\n----\n* **Action**: `labels:remove`\n* **Description**: Remove label(s) from the chat, when already present, after the message is delivered\n* **Params**:\n  - **labels**: `array` (optional) - Label tags to remove from the chat. You can obtain a list of existing labels [querying this endpoint](#operation/getLabels)\n----\n* **Action**: `labels:set`\n* **Description**: Set and override label(s) in the chat after the message is delivered\n* **Params**:\n  - **labels**: `array` (optional) - Label tags to set and override in the chat. You can obtain a list of existing labels [querying this endpoint](#operation/getLabels)\n----\n* **Action**: `metadata:set`\n* **Description**: Set and override metadata key-value entries in the target chat's contact entity after the message is delivered\n* **Params**:\n  - **metadata**: `array` (optional) - Metadata entries with `key` and `value` properties to set and override in the chat's contact\n----\n* **Action**: `metadata:add`\n* **Description**: Add or override by `key` field existing metadata key-value entries in the target chat's contact entity after the message is delivered\n* **Params**:\n  - **metadata**: `array` (optional) - Metadata entries with `key` and `value` properties to append in the chat's contact\n----\n* **Action**: `metadata:remove`\n* **Description**: Remove existing metadata entries by `key` field in the target chat's contact entity after the message is delivered\n* **Params**:\n  - **keys**: `array` (optional) - Metadata entries to remove by `key` in the chat's contact"}},"additionalProperties":false,"description":"Optionally allow users to unsubscribe from the campaign messages. If enabled, users can reply a pre-defined word to stop receiving messages from in future campaigns."},"name":{"type":"string","minLength":1,"maxLength":50,"description":"Campaign name"},"device":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","minLength":24,"maxLength":24,"description":"WhatsApp target device ID to be used for the campaign messages delivery"}},"additionalProperties":false}}],"responses":{"202":{"description":"Campaign updated","schema":{"$ref":"#/definitions/campaign"}},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Campaign is no longer editable: only its `name` can be updated (error code `campaigns:not_editable`)","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Update campaign\ncurl --request PATCH \\\n  --url https://api.wassenger.com/v1/campaigns/{id} \\\n  --header 'Content-Type: application/json' \\\n  --header 'Token: <api token goes here>' \\\n  --data '{\"name\":\"New campaign name\",\"settings\":{\"speed\":2,\"timezone\":\"America/New_York\",\"date\":\"2026-11-13T09:42:46.078Z\"}}'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Update campaign\necho '{\"name\":\"New campaign name\",\"settings\":{\"speed\":2,\"timezone\":\"America/New_York\",\"date\":\"2026-11-13T09:42:46.078Z\"}}' |  \\\n  http PATCH https://api.wassenger.com/v1/campaigns/{id} \\\n  Content-Type:application/json \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Update campaign\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/campaigns/{id}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"New campaign name\",\"settings\":{\"speed\":2,\"timezone\":\"America/New_York\",\"date\":\"2026-11-13T09:42:46.078Z\"}}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Update campaign\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'PATCH',\n  url: 'https://api.wassenger.com/v1/campaigns/{id}',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  data: {\n    name: 'New campaign name',\n    settings: {speed: 2, timezone: 'America/New_York', date: '2026-11-13T09:42:46.078Z'}\n  }\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Update campaign\nconst unirest = require('unirest');\n\nconst req = unirest('PATCH', 'https://api.wassenger.com/v1/campaigns/{id}');\n\nreq.headers({\n  'Content-Type': 'application/json',\n  Token: '<api token goes here>'\n});\n\nreq.type('json');\nreq.send({\n  name: 'New campaign name',\n  settings: {\n    speed: 2,\n    timezone: 'America/New_York',\n    date: '2026-11-13T09:42:46.078Z'\n  }\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Update campaign\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('PATCH', 'https://api.wassenger.com/v1/campaigns/{id}', [\n  'body' => '{\"name\":\"New campaign name\",\"settings\":{\"speed\":2,\"timezone\":\"America/New_York\",\"date\":\"2026-11-13T09:42:46.078Z\"}}',\n  'headers' => [\n    'Content-Type' => 'application/json',\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Update campaign\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append(json_encode([\n  'name' => 'New campaign name',\n  'settings' => [\n    'speed' => 2,\n    'timezone' => 'America/New_York',\n    'date' => '2026-11-13T09:42:46.078Z'\n  ]\n]));\n$request->setRequestUrl('https://api.wassenger.com/v1/campaigns/{id}');\n$request->setRequestMethod('PATCH');\n$request->setBody($body);\n\n$request->setHeaders([\n  'Content-Type' => 'application/json',\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Update campaign\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/campaigns/{id}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PATCH\",\n  CURLOPT_POSTFIELDS => json_encode([\n    'name' => 'New campaign name',\n    'settings' => [\n        'speed' => 2,\n        'timezone' => 'America/New_York',\n        'date' => '2026-11-13T09:42:46.078Z'\n    ]\n  ]),\n  CURLOPT_HTTPHEADER => [\n    \"Content-Type: application/json\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Update campaign\nimport requests\n\nurl = \"https://api.wassenger.com/v1/campaigns/{id}\"\n\npayload = {\n    \"name\": \"New campaign name\",\n    \"settings\": {\n        \"speed\": 2,\n        \"timezone\": \"America/New_York\",\n        \"date\": \"2026-11-13T09:42:46.078Z\"\n    }\n}\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Token\": \"<api token goes here>\"\n}\n\nresponse = requests.patch(url, json=payload, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update campaign\nconst url = 'https://api.wassenger.com/v1/campaigns/{id}';\nconst options = {\n  method: 'PATCH',\n  headers: {'Content-Type': 'application/json', Token: '<api token goes here>'},\n  body: '{\"name\":\"New campaign name\",\"settings\":{\"speed\":2,\"timezone\":\"America/New_York\",\"date\":\"2026-11-13T09:42:46.078Z\"}}'\n};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Update campaign\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/campaigns/{id}',\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    Token: '<api token goes here>'\n  },\n  processData: false,\n  data: '{\"name\":\"New campaign name\",\"settings\":{\"speed\":2,\"timezone\":\"America/New_York\",\"date\":\"2026-11-13T09:42:46.078Z\"}}'\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Update campaign\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/campaigns/{id}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"Content-Type\"] = 'application/json'\nrequest[\"Token\"] = '<api token goes here>'\nrequest.body = \"{\\\"name\\\":\\\"New campaign name\\\",\\\"settings\\\":{\\\"speed\\\":2,\\\"timezone\\\":\\\"America/New_York\\\",\\\"date\\\":\\\"2026-11-13T09:42:46.078Z\\\"}}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Update campaign\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/campaigns/{id}\"\n\n\tpayload := strings.NewReader(\"{\\\"name\\\":\\\"New campaign name\\\",\\\"settings\\\":{\\\"speed\\\":2,\\\"timezone\\\":\\\"America/New_York\\\",\\\"date\\\":\\\"2026-11-13T09:42:46.078Z\\\"}}\")\n\n\treq, _ := http.NewRequest(\"PATCH\", url, payload)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Update campaign\nvar client = new RestClient(\"https://api.wassenger.com/v1/campaigns/{id}\");\nvar request = new RestRequest(Method.PATCH);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nrequest.AddParameter(\"application/json\", \"{\\\"name\\\":\\\"New campaign name\\\",\\\"settings\\\":{\\\"speed\\\":2,\\\"timezone\\\":\\\"America/New_York\\\",\\\"date\\\":\\\"2026-11-13T09:42:46.078Z\\\"}}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Update campaign\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Patch,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/campaigns/{id}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n    Content = new StringContent(\"{\\\"name\\\":\\\"New campaign name\\\",\\\"settings\\\":{\\\"speed\\\":2,\\\"timezone\\\":\\\"America/New_York\\\",\\\"date\\\":\\\"2026-11-13T09:42:46.078Z\\\"}}\")\n    {\n        Headers =\n        {\n            ContentType = new MediaTypeHeaderValue(\"application/json\")\n        }\n    }\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Update campaign\nHttpResponse<String> response = Unirest.patch(\"https://api.wassenger.com/v1/campaigns/{id}\")\n  .header(\"Content-Type\", \"application/json\")\n  .header(\"Token\", \"<api token goes here>\")\n  .body(\"{\\\"name\\\":\\\"New campaign name\\\",\\\"settings\\\":{\\\"speed\\\":2,\\\"timezone\\\":\\\"America/New_York\\\",\\\"date\\\":\\\"2026-11-13T09:42:46.078Z\\\"}}\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Update campaign\nval client = OkHttpClient()\n\nval mediaType = MediaType.parse(\"application/json\")\nval body = RequestBody.create(mediaType, \"{\\\"name\\\":\\\"New campaign name\\\",\\\"settings\\\":{\\\"speed\\\":2,\\\"timezone\\\":\\\"America/New_York\\\",\\\"date\\\":\\\"2026-11-13T09:42:46.078Z\\\"}}\")\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/campaigns/{id}\")\n  .patch(body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Update campaign\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/campaigns/{id}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Content-Type: application/json\");\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"{\\\"name\\\":\\\"New campaign name\\\",\\\"settings\\\":{\\\"speed\\\":2,\\\"timezone\\\":\\\"America/New_York\\\",\\\"date\\\":\\\"2026-11-13T09:42:46.078Z\\\"}}\");\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Update campaign\n$headers=@{}\n$headers.Add(\"Content-Type\", \"application/json\")\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/campaigns/{id}' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{\"name\":\"New campaign name\",\"settings\":{\"speed\":2,\"timezone\":\"America/New_York\",\"date\":\"2026-11-13T09:42:46.078Z\"}}'"},{"lang":"ObjC","source":"// Update campaign\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Content-Type\": @\"application/json\",\n                           @\"Token\": @\"<api token goes here>\" };\nNSDictionary *parameters = @{ @\"name\": @\"New campaign name\",\n                              @\"settings\": @{ @\"speed\": @2, @\"timezone\": @\"America/New_York\", @\"date\": @\"2026-11-13T09:42:46.078Z\" } };\n\nNSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/campaigns/{id}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"PATCH\"];\n[request setAllHTTPHeaderFields:headers];\n[request setHTTPBody:postData];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Update campaign\nimport Foundation\n\nlet headers = [\n  \"Content-Type\": \"application/json\",\n  \"Token\": \"<api token goes here>\"\n]\nlet parameters = [\n  \"name\": \"New campaign name\",\n  \"settings\": [\n    \"speed\": 2,\n    \"timezone\": \"America/New_York\",\n    \"date\": \"2026-11-13T09:42:46.078Z\"\n  ]\n] as [String : Any]\n\nlet postData = JSONSerialization.data(withJSONObject: parameters, options: [])\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/campaigns/{id}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"PATCH\"\nrequest.allHTTPHeaderFields = headers\nrequest.httpBody = postData as Data\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]},"delete":{"summary":"Delete campaign","description":"Delete an existing campaign.\n\n\n\nOnly campaigns with status `draft`, `failed`, `incompleted` or `stopped` can be deleted.\n\nIf the campaign is already processing, it should be stopped fisrt.\n\nIf the campaign is already completed, it will be automatically deleted after 90 days.\n\n\n----\n\n\n💻 👉 **[Test this endpoint in the API live tester](/help/api-tester?path=%2Fv1%2Fcampaigns%2F%7Bid%7D&method=DELETE&body=)**\n\n\n>👋 **Need help?** Explore [all the tutorials](/help/category/tutorials), [100+ use case examples](/help/api-examples) and [play with the API live tester](/help/api-tester) with ready-to-use code examples in 15+ programming languages, including JavaScript/Node.js, PHP, Python, C#, Java, Ruby, Swift, Kotlin, Powershell, cURL and more.\n\n\n_chatgpt-assistant-banner_","operationId":"deleteCampaign","security":[{"apiKey":[]}],"tags":["Campaigns"],"consumes":["application/json"],"produces":["application/json"],"parameters":[],"responses":{"204":{"description":"Campaign deleted successfully"},"400":{"description":"Invalid query or body request data","schema":{"$ref":"#/definitions/error"}},"401":{"description":"Unauthorized - Invalid or missing API token","schema":{"$ref":"#/definitions/error"}},"403":{"description":"Missing required permissions","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Resource not found","schema":{"$ref":"#/definitions/error"}},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/error"}},"429":{"description":"Too many requests - Try again later","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error"}},"501":{"description":"Not implemented","schema":{"$ref":"#/definitions/error"}},"503":{"description":"Service temporarily unavailable - Try again later","schema":{"$ref":"#/definitions/error"}}},"x-codeSamples":[{"lang":"cURL","source":"// This code example requires you to have installed curl package\n// Installation instructions here: https://curl.haxx.se/download.html\n\n// Delete campaign by ID\ncurl --request DELETE \\\n  --url https://api.wassenger.com/v1/campaigns/{id} \\\n  --header 'Token: <api token goes here>'"},{"lang":"HTTPie","source":"// This code example requires to have installed httpie package, an powerful alternative to curl and wget\n// Installation instructions here: https://httpie.org/docs#installation\n\n// Delete campaign by ID\nhttp DELETE https://api.wassenger.com/v1/campaigns/{id} \\\n  Token:'<api token goes here>'"},{"lang":"Node","source":"// This code example requires you to have installed node-fetch Node.js package.\n// Install it by running: npm install --save node-fetch or yarn add node-fetch\n\n// Delete campaign by ID\nconst fetch = require('node-fetch');\n\nconst url = 'https://api.wassenger.com/v1/campaigns/{id}';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (axios)","source":"// Delete campaign by ID\nconst axios = require('axios').default;\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://api.wassenger.com/v1/campaigns/{id}',\n  headers: {Token: '<api token goes here>'}\n};\n\ntry {\n  const { data } = await axios.request(options);\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"Node (unirest)","source":"// This code example requires you to have installed unirest Node.js package.\n// Install it by running: npm install --save unirest or yarn add unirest\n\n// Delete campaign by ID\nconst unirest = require('unirest');\n\nconst req = unirest('DELETE', 'https://api.wassenger.com/v1/campaigns/{id}');\n\nreq.headers({\n  Token: '<api token goes here>'\n});\n\nreq.end(function (res) {\n  if (res.error) throw new Error(res.error);\n\n  console.log(res.body);\n});"},{"lang":"PHP (Guzzle)","source":"// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP.\n// Install it first following these instructions:\n// https://docs.guzzlephp.org/en/stable/overview.html#installation\n\n// Delete campaign by ID\n<?php\n\n$client = new \\GuzzleHttp\\Client();\n\n$response = $client->request('DELETE', 'https://api.wassenger.com/v1/campaigns/{id}', [\n  'headers' => [\n    'Token' => '<api token goes here>',\n  ],\n]);\n\necho $response->getBody();"},{"lang":"PHP (http2)","source":"// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.\n// Install it by running: pecl install pecl_http\n// More information: https://mdref.m6w6.name/http\n\n// Delete campaign by ID\n<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://api.wassenger.com/v1/campaigns/{id}');\n$request->setRequestMethod('DELETE');\n$request->setHeaders([\n  'Token' => '<api token goes here>'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"},{"lang":"PHP (curl)","source":"// Delete campaign by ID\n<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://api.wassenger.com/v1/campaigns/{id}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_HTTPHEADER => [\n    \"Content-Length: 0\",\n    \"Token: <api token goes here>\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Python","source":"# Examples requires to have installed requests Python package.\n# Install it by running: pip install requests\n\n# Delete campaign by ID\nimport requests\n\nurl = \"https://api.wassenger.com/v1/campaigns/{id}\"\n\nheaders = {\"Token\": \"<api token goes here>\"}\n\nresponse = requests.delete(url, headers=headers)\n\nprint(response.json())"},{"lang":"JavaScript","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete campaign by ID\nconst url = 'https://api.wassenger.com/v1/campaigns/{id}';\nconst options = {method: 'DELETE', headers: {Token: '<api token goes here>'}};\n\ntry {\n  const response = await fetch(url, options);\n  const data = await response.json();\n  console.log(data);\n} catch (error) {\n  console.error(error);\n}"},{"lang":"jQuery","source":"// IMPORTANT NOTICE:\n// Performing HTTPS requests to the API from a JavaScript in a web browser is\n// forbidden by default due to cross-origin security policies (CORS).\n// More information here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n//\n// Communicating directly from JavaScript in a web browser with the API\n// is considered security bad practice and completely discouraged\n// as this will expose your API secret key, enabling a third-party user\n// to easily steal your key and have full privilege access to your account via API.\n//\n// We strongly recommend to do not expose the API key in the web browser JavaScript code.\n// Always use your server to communicate with the API without exposing the API key.\n\n// Delete campaign by ID\nconst settings = {\n  async: true,\n  crossDomain: true,\n  url: 'https://api.wassenger.com/v1/campaigns/{id}',\n  method: 'DELETE',\n  headers: {\n    Token: '<api token goes here>'\n  }\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"},{"lang":"Ruby","source":"# Delete campaign by ID\nrequire 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.wassenger.com/v1/campaigns/{id}\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Token\"] = '<api token goes here>'\n\nresponse = http.request(request)\nputs response.read_body"},{"lang":"Go","source":"// Delete campaign by ID\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io\"\n)\n\nfunc main() {\n\n\turl := \"https://api.wassenger.com/v1/campaigns/{id}\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Token\", \"<api token goes here>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"},{"lang":"C# (RestClient)","source":"// This code requires you to have installed RestSharp package.\n// Documentation: https://restsharp.dev\n// Installation: https://www.nuget.org/packages/RestSharp\n\n// Delete campaign by ID\nvar client = new RestClient(\"https://api.wassenger.com/v1/campaigns/{id}\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"Token\", \"<api token goes here>\");\nIRestResponse response = client.Execute(request);"},{"lang":"C# (HttpClient)","source":"// This code uses the built-in HttpClient package in the .NET framework.\n// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0\n\n// Delete campaign by ID\nusing System.Net.Http.Headers;\nvar client = new HttpClient();\nvar request = new HttpRequestMessage\n{\n    Method = HttpMethod.Delete,\n    RequestUri = new Uri(\"https://api.wassenger.com/v1/campaigns/{id}\"),\n    Headers =\n    {\n        { \"Token\", \"<api token goes here>\" },\n    },\n};\nusing (var response = await client.SendAsync(request))\n{\n    response.EnsureSuccessStatusCode();\n    var body = await response.Content.ReadAsStringAsync();\n    Console.WriteLine(body);\n}"},{"lang":"Java","source":"// This code requires you to have installed Unirest package.\n// Documentation: https://kong.github.io/unirest-java/#requests\n// Installation: http://kong.github.io/unirest-java/\n\n// Delete campaign by ID\nHttpResponse<String> response = Unirest.delete(\"https://api.wassenger.com/v1/campaigns/{id}\")\n  .header(\"Token\", \"<api token goes here>\")\n  .asString();"},{"lang":"Kotlin","source":"// This code requires to have installed okhttp package.\n// Documentation: https://square.github.io/okhttp/recipes/\n// Installation via Maven: https://square.github.io/okhttp/#releases\n\n// Delete campaign by ID\nval client = OkHttpClient()\n\nval request = Request.Builder()\n  .url(\"https://api.wassenger.com/v1/campaigns/{id}\")\n  .delete(null)\n  .addHeader(\"Token\", \"<api token goes here>\")\n  .build()\n\nval response = client.newCall(request).execute()"},{"lang":"C","source":"// Delete campaign by ID\nCURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https://api.wassenger.com/v1/campaigns/{id}\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"Token: <api token goes here>\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\nCURLcode ret = curl_easy_perform(hnd);"},{"lang":"Powershell","source":"# Delete campaign by ID\n$headers=@{}\n$headers.Add(\"Token\", \"<api token goes here>\")\n$response = Invoke-WebRequest -Uri 'https://api.wassenger.com/v1/campaigns/{id}' -Method DELETE -Headers $headers"},{"lang":"ObjC","source":"// Delete campaign by ID\n#import <Foundation/Foundation.h>\n\nNSDictionary *headers = @{ @\"Token\": @\"<api token goes here>\" };\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"https://api.wassenger.com/v1/campaigns/{id}\"]\n                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy\n                                                   timeoutInterval:10.0];\n[request setHTTPMethod:@\"DELETE\"];\n[request setAllHTTPHeaderFields:headers];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request\n                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n                                                if (error) {\n                                                    NSLog(@\"%@\", error);\n                                                } else {\n                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;\n                                                    NSLog(@\"%@\", httpResponse);\n                                                }\n                                            }];\n[dataTask resume];"},{"lang":"Swift","source":"// Delete campaign by ID\nimport Foundation\n\nlet headers = [\"Token\": \"<api token goes here>\"]\n\nlet request = NSMutableURLRequest(url: NSURL(string: \"https://api.wassenger.com/v1/campaigns/{id}\")! as URL,\n                                        cachePolicy: .useProtocolCachePolicy,\n                                    timeoutInterval: 10.0)\nrequest.httpMethod = \"DELETE\"\nrequest.allHTTPHeaderFields = headers\n\nlet session = URLSession.shared\nlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in\n  if (error != nil) {\n    print(error as Any)\n  } else {\n    let httpResponse = response as? HTTPURLResponse\n    print(httpResponse)\n  }\n})\n\ndataTask.resume()"}]}},"/bridges/kv/{key}":{"parameters":[],"get":{"summary":"Read bridge key","description":"Read a key of the key-value store of the calling bridge.\n\n\n\nAnswers `{ value, expiresAt }`, or 404 `install:kv_not_found` when the key is not there or already expired.","operationId":"getBridgeKey","security":[{"apiKey":[]}],"tags":["Integrations"],"parameters":[{"name":"key","in":"path","required":true,"type":"string","description":"Key of the store, matching `^[A-Za-z0-9:._-]{1,128}$`."}],"responses":{"400":{"description":"A key this store cannot serve"},"404":{"description":"No such key: `install:kv_not_found`"},"default":{"description":"The value and when it expires","schema":{"type":"object"}}}},"put":{"summary":"Write bridge key","description":"Write a key of the key-value store of the calling bridge, with a time to live between 1 second and 7 days.\n\n\n\nSame rules as the install store: no delete, `ifAbsent` and `ifValue` as conditions, and 409 `install:kv_conflict` with the live value in `meta.value` when one does not hold. The reserved `rt:` prefix here only takes the schedule lock and the revoked marker.","operationId":"setBridgeKey","security":[{"apiKey":[]}],"tags":["Integrations"],"parameters":[{"name":"key","in":"path","required":true,"type":"string","description":"Key of the store, matching `^[A-Za-z0-9:._-]{1,128}$`."},{"name":"body","in":"body","required":true,"schema":{"type":"object"}}],"responses":{"400":{"description":"A key, value or ttl this store cannot take"},"409":{"description":"The condition did not hold"},"default":{"description":"Written","schema":{"type":"object"}}}}}},"x-express-openapi-disable-response-validation-middleware":true,"x-express-openapi-additional-middleware":[null],"x-express-openapi-schema-extension":{"definitions":{"schema":{"properties":{"oneOf":{"type":"array","minItems":1,"items":{}}}}}}}