Get call permission
Protocols: Meta Cloud API
Required scope: sessions:read
Returns whether the person has allowed this number to call them. On Cloud API numbers WhatsApp is asked on every request and the answer includes its limits on permission requests and calls. Linked-device numbers return 409 unsupported_for_connection.
curl --request GET \
--url https://api.polymorfa.com/messaging/{session}/call-permissions/{to} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.polymorfa.com/messaging/{session}/call-permissions/{to}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.polymorfa.com/messaging/{session}/call-permissions/{to}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.polymorfa.com/messaging/{session}/call-permissions/{to}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}false{
"success": true,
"data": {
"conversation": {
"id": "739182640518203",
"phoneNumber": "<string>",
"bsuid": "<string>",
"username": "<string>"
},
"status": "none",
"expiresAt": "2023-11-07T05:31:56Z",
"source": "user_action",
"updatedAt": "2023-11-07T05:31:56Z",
"checkedAt": "2023-11-07T05:31:56Z",
"fresh": true,
"actions": {
"requestPermission": {
"allowed": true,
"limits": [
{
"period": "<string>",
"maxAllowed": 1,
"used": 1,
"resetsAt": "2023-11-07T05:31:56Z"
}
]
},
"startCall": {
"allowed": true,
"limits": [
{
"period": "<string>",
"maxAllowed": 1,
"used": 1,
"resetsAt": "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": "unsupported_for_connection",
"message": "The session's connection does not support this call operation.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#unsupported-for-connection"
}{
"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
Polymorfa organization key (pmfa_ prefix), project token (pmfa_pt_ prefix) where supported, or short-lived client token (pmfa_ct_ prefix). Organization and project keys may be personal or service-account owned and enforce selected action scopes. Organization keys cover the team and its projects; project tokens stay inside one project. Client tokens stay inside their live project and session and enforce their client rules.
Path Parameters
Identifier of the connected Polymorfa session.
Specifies to for this path parameter.
User ID or phone number in E.164 format (URL-encode + as %2B).
Was this page helpful?
curl --request GET \
--url https://api.polymorfa.com/messaging/{session}/call-permissions/{to} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.polymorfa.com/messaging/{session}/call-permissions/{to}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.polymorfa.com/messaging/{session}/call-permissions/{to}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.polymorfa.com/messaging/{session}/call-permissions/{to}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}false{
"success": true,
"data": {
"conversation": {
"id": "739182640518203",
"phoneNumber": "<string>",
"bsuid": "<string>",
"username": "<string>"
},
"status": "none",
"expiresAt": "2023-11-07T05:31:56Z",
"source": "user_action",
"updatedAt": "2023-11-07T05:31:56Z",
"checkedAt": "2023-11-07T05:31:56Z",
"fresh": true,
"actions": {
"requestPermission": {
"allowed": true,
"limits": [
{
"period": "<string>",
"maxAllowed": 1,
"used": 1,
"resetsAt": "2023-11-07T05:31:56Z"
}
]
},
"startCall": {
"allowed": true,
"limits": [
{
"period": "<string>",
"maxAllowed": 1,
"used": 1,
"resetsAt": "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": "unsupported_for_connection",
"message": "The session's connection does not support this call operation.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#unsupported-for-connection"
}{
"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"
}