curl --request POST \
--url https://dash.dmly.io/api/agency/v1/workspaces/{workspace}/channel-connections \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"platform": "whatsapp",
"return_url": "https://app.example.com/integrations/callback",
"state": "cust_8841"
}
'import requests
url = "https://dash.dmly.io/api/agency/v1/workspaces/{workspace}/channel-connections"
payload = {
"platform": "whatsapp",
"return_url": "https://app.example.com/integrations/callback",
"state": "cust_8841"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
platform: 'whatsapp',
return_url: 'https://app.example.com/integrations/callback',
state: 'cust_8841'
})
};
fetch('https://dash.dmly.io/api/agency/v1/workspaces/{workspace}/channel-connections', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://dash.dmly.io/api/agency/v1/workspaces/{workspace}/channel-connections",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'platform' => 'whatsapp',
'return_url' => 'https://app.example.com/integrations/callback',
'state' => 'cust_8841'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://dash.dmly.io/api/agency/v1/workspaces/{workspace}/channel-connections"
payload := strings.NewReader("{\n \"platform\": \"whatsapp\",\n \"return_url\": \"https://app.example.com/integrations/callback\",\n \"state\": \"cust_8841\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://dash.dmly.io/api/agency/v1/workspaces/{workspace}/channel-connections")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"platform\": \"whatsapp\",\n \"return_url\": \"https://app.example.com/integrations/callback\",\n \"state\": \"cust_8841\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dash.dmly.io/api/agency/v1/workspaces/{workspace}/channel-connections")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"platform\": \"whatsapp\",\n \"return_url\": \"https://app.example.com/integrations/callback\",\n \"state\": \"cust_8841\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "6f0e2c1a-8b7d-4c3e-9a1f-0d2b3c4e5f60",
"workspace_id": "11111111-1111-1111-1111-111111111111",
"platform": "whatsapp",
"status": "pending",
"channel_id": null,
"error_code": null,
"state": "cust_8841",
"expires_at": "2026-10-06T12:30:00+00:00",
"connect_url": "https://dash.dmly.io/agency-connect/6f0e2c1a-8b7d-4c3e-9a1f-0d2b3c4e5f60?token=..."
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>"
}{
"message": "<string>"
}Start a channel connection.
Creates a 30-minute session that lets your customer connect a WhatsApp number, Facebook Page (Messenger) or Instagram account to this sub-account without signing in to DMLY. Send your customer to connect_url as a top-level navigation; they authorize with Meta, choose the account, and are returned to your return_url with connection_id and state. return_url must be one you registered with PUT /channel-connect/settings. To reconnect an existing channel, pass its id as channel_id; the account the customer picks must be the same one. An optional Idempotency-Key header (1 to 200 characters) makes retries safe: the same key with the same body returns the existing session with 200, with a different body or workspace returns 409. Returns 403 when Channel Connect is not enabled for your agency or the sub-account is suspended, and 422 when the return URL is not registered or the plan does not allow the platform.
curl --request POST \
--url https://dash.dmly.io/api/agency/v1/workspaces/{workspace}/channel-connections \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"platform": "whatsapp",
"return_url": "https://app.example.com/integrations/callback",
"state": "cust_8841"
}
'import requests
url = "https://dash.dmly.io/api/agency/v1/workspaces/{workspace}/channel-connections"
payload = {
"platform": "whatsapp",
"return_url": "https://app.example.com/integrations/callback",
"state": "cust_8841"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
platform: 'whatsapp',
return_url: 'https://app.example.com/integrations/callback',
state: 'cust_8841'
})
};
fetch('https://dash.dmly.io/api/agency/v1/workspaces/{workspace}/channel-connections', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://dash.dmly.io/api/agency/v1/workspaces/{workspace}/channel-connections",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'platform' => 'whatsapp',
'return_url' => 'https://app.example.com/integrations/callback',
'state' => 'cust_8841'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://dash.dmly.io/api/agency/v1/workspaces/{workspace}/channel-connections"
payload := strings.NewReader("{\n \"platform\": \"whatsapp\",\n \"return_url\": \"https://app.example.com/integrations/callback\",\n \"state\": \"cust_8841\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://dash.dmly.io/api/agency/v1/workspaces/{workspace}/channel-connections")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"platform\": \"whatsapp\",\n \"return_url\": \"https://app.example.com/integrations/callback\",\n \"state\": \"cust_8841\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dash.dmly.io/api/agency/v1/workspaces/{workspace}/channel-connections")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"platform\": \"whatsapp\",\n \"return_url\": \"https://app.example.com/integrations/callback\",\n \"state\": \"cust_8841\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "6f0e2c1a-8b7d-4c3e-9a1f-0d2b3c4e5f60",
"workspace_id": "11111111-1111-1111-1111-111111111111",
"platform": "whatsapp",
"status": "pending",
"channel_id": null,
"error_code": null,
"state": "cust_8841",
"expires_at": "2026-10-06T12:30:00+00:00",
"connect_url": "https://dash.dmly.io/agency-connect/6f0e2c1a-8b7d-4c3e-9a1f-0d2b3c4e5f60?token=..."
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>"
}{
"message": "<string>"
}Authorizations
Your agency API key (dmly_ag_…). It authenticates the acting agency and scopes every request to that agency's own sub-accounts and plans.
Headers
Makes a retry return the same session.
200Path Parameters
Workspace id.
Body
Response
An Idempotency-Key replay: the existing session.
Was this page helpful?

