Call Consent
Create call opt out
Required scope: sessions:manage
Adds a phone number or BSUID. Calls to it are refused with 403 call_recipient_opted_out from then on. Adding an entry that already exists returns it with 200.
POST
/
platform
/
call-opt-outs
Create call opt out
curl --request POST \
--url https://api.polymorfa.com/platform/call-opt-outs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phoneNumber": "<string>",
"bsuid": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({phoneNumber: '<string>', bsuid: '<string>'})
};
fetch('https://api.polymorfa.com/platform/call-opt-outs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.polymorfa.com/platform/call-opt-outs"
payload = {
"phoneNumber": "<string>",
"bsuid": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.polymorfa.com/platform/call-opt-outs"
payload := strings.NewReader("{\n \"phoneNumber\": \"<string>\",\n \"bsuid\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}false{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"phoneNumber": "<string>",
"bsuid": "<string>",
"note": "<string>",
"source": "api",
"createdAt": "2023-11-07T05:31:56Z"
}
}{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"phoneNumber": "<string>",
"bsuid": "<string>",
"note": "<string>",
"source": "api",
"createdAt": "2023-11-07T05:31:56Z"
}
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_parameter",
"message": "Correct the invalid request field.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#invalid-parameter"
}{
"error": {
"type": "authentication_error",
"code": "invalid_credential",
"message": "Supply a valid credential.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#invalid-credential"
}{
"error": {
"type": "permission_error",
"code": "permission_denied",
"message": "The credential does not have access to this resource.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#permission-denied"
}{
"error": {
"type": "invalid_request_error",
"code": "resource_not_found",
"message": "The resource is unavailable to this caller.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#resource-not-found"
}{
"error": {
"type": "conflict_error",
"code": "call_opt_out_limit",
"message": "The team's do-not-call list is full.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#call-opt-out-limit"
}{
"error": {
"type": "api_error",
"code": "internal_error",
"message": "An unexpected service failure occurred. Keep the request ID for support.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#internal-error"
}Authorizations
Send your team API key or project token as Authorization: Bearer <token>. The credential must have the required permissions. Project tokens can access only their own project.
Body
application/json
- Option 1
- Option 2
Phone number in E.164 format, for example +14155550123.
Value constraints
| Constraint | Accepted input |
|---|---|
| Pattern | ^\+[1-9]\d{1,14}$ |
Pattern:
^\+[1-9]\d{1,14}$WhatsApp business-scoped user ID, for example US.13491208655302741918.
Value constraints
| Constraint | Accepted input |
|---|---|
| Pattern | ^[A-Z]{2}\.[A-Za-z0-9]{1,128}$ |
Pattern:
^[A-Z]{2}\.[A-Za-z0-9]{1,128}$Optional note, 1 to 500 Unicode characters.
Value constraints
| Constraint | Accepted input |
|---|---|
| String length | 1 through 500 characters |
Required string length:
1 - 500Was this page helpful?
⌘I
Create call opt out
curl --request POST \
--url https://api.polymorfa.com/platform/call-opt-outs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phoneNumber": "<string>",
"bsuid": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({phoneNumber: '<string>', bsuid: '<string>'})
};
fetch('https://api.polymorfa.com/platform/call-opt-outs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.polymorfa.com/platform/call-opt-outs"
payload = {
"phoneNumber": "<string>",
"bsuid": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.polymorfa.com/platform/call-opt-outs"
payload := strings.NewReader("{\n \"phoneNumber\": \"<string>\",\n \"bsuid\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}false{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"phoneNumber": "<string>",
"bsuid": "<string>",
"note": "<string>",
"source": "api",
"createdAt": "2023-11-07T05:31:56Z"
}
}{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"phoneNumber": "<string>",
"bsuid": "<string>",
"note": "<string>",
"source": "api",
"createdAt": "2023-11-07T05:31:56Z"
}
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_parameter",
"message": "Correct the invalid request field.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#invalid-parameter"
}{
"error": {
"type": "authentication_error",
"code": "invalid_credential",
"message": "Supply a valid credential.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#invalid-credential"
}{
"error": {
"type": "permission_error",
"code": "permission_denied",
"message": "The credential does not have access to this resource.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#permission-denied"
}{
"error": {
"type": "invalid_request_error",
"code": "resource_not_found",
"message": "The resource is unavailable to this caller.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#resource-not-found"
}{
"error": {
"type": "conflict_error",
"code": "call_opt_out_limit",
"message": "The team's do-not-call list is full.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#call-opt-out-limit"
}{
"error": {
"type": "api_error",
"code": "internal_error",
"message": "An unexpected service failure occurred. Keep the request ID for support.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#internal-error"
}