Cookie Auth API

concept brazil Updated Oct 14, 2026 5 min read cookieauth-api.md
Raw file servicenow.com

The Cookie Auth Scripted REST API provides an endpoint that creates a short-lived ticket that the WebRTC phone widget needs to start a voice call. Because this endpoint doesn’t require a login, it works for authenticated and unauthenticated users.

WebRTC voice calling is a core capability for Customer Service Management (CSM) portals and Engagement Messenger. The Cookie Auth API allows authenticated and unauthenticated users (like customers on public support portals, third parties embedding Engagement Messenger) start a voice call without logging in. The ticket expires after 60 seconds and works once, so a caller never gets a long-lived credential. The API imposes rate limits so the open endpoint can’t be hit without restriction (see the API rate limits section for more information).

Typically, customers won’t call this API directly because the phone widget calls it automatically when someone starts a call.

Access and authentication

This API is provided in the sn_webrtc scope and requires the com.sn_webrtc (WebRTC Voice) plugin. No role is required to access this API.

API rate limits

The application ships with two rate limit rules for the Cookie Auth POST endpoint. You can change the limits to suit your environment.

Rule name Applies to Limit
WebRTC cookie auth limit for all users All users 3,600 requests per hour
WebRTC cookie auth limit for un-authenticated users The Guest user 3,600 requests per hour

Important: All unauthenticated callers share the single Guest user identity, so the limit for the Guest rule is a shared limit for all unauthenticated callers, not a limit for each caller.

Conversely, authenticated users each get 3,600 requests per hour as it is not shared under one identity. For example, authenticated User 1 gets 3,600 requests per hour, User 2 gets 3,600 per hour, and so on.

Parent Topic:REST API reference

Cookie Auth - POST /api/sn_webrtc/webrtc_cookie_auth/cookie_auth

Returns a short-lived ticket that the WebRTC phone widget uses to connect to the voice service and start a call. The endpoint doesn’t require login, so guest users can place calls.

URL format

Default URL: /api/sn_webrtc/webrtc_cookie_auth/cookie_auth

Trusted orchestrator domains

The Cookie Auth POST endpoint creates a ticket only when the orchestrator_host value matches a domain in the following system property, or is a subdomain of one of those domains. If the property is empty, the endpoint uses the default domain, sncapps.service-now.com.

Property

Description

Default value

sn_webrtc.orchestrator.trusted_domains

Comma-separated list of trusted domains. A host is trusted when it equals one of the domains or is a subdomain of one of them. Only users with the maint role can change this property.Data type: String

sncapps.service-now.com

### Supported request parameters
Name Description
None
Name Description
None

Name

Required

Description

voice_service_id

Required

The sys_id of the voice service configuration. The value must pass the platform sys_id check and must also be exactly 32 lowercase hexadecimal characters.Data type: String

Format: 32 lowercase hexadecimal characters

Maximum length: 256

orchestrator_host

Required

The host name of the voice orchestrator, as a bare host name or an https:// URL. The endpoint rejects http:// URLs and values that include a port, path, query string, or credentials. The host must match a trusted domain exactly or be a subdomain of a trusted domain. For information about trusted domains, see the Trusted orchestrator domains section.

Data type: String

Maximum length: 256

instance_name

Required

ServiceNow instance identifier.Format: [a-z0-9][a-z0-9-]{0,62} (max 63 characters)

Data type: String

### Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Header

Description

Accept

Data format of the request body. Supported types: application/json or application/xml. Default: application/json

Content-Type

Required. Must be application/json. The endpoint rejects any other content type with a 400 status code.

X-UserToken

Required. The session CSRF token for the current session. The endpoint rejects requests with a missing or incorrect token.

|Header|Description| |------|-----------| |None| |

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Note: See the 'API rate limits' section Cookie Auth API for issues around rate limiting.

Status code

Description

200

Successful. The request was successfully processed.

400

Bad Request. The request wasn't valid. Possible causes include a missing or invalid parameter, a content type other than application/json, a request body larger than 2,048 bytes, or an orchestrator host that isn't trusted. The response doesn't identify which check failed due to a security constraint.

Response body: {"error": "Bad Request"}

502

Bad Gateway. The instance couldn't get a ticket from the voice orchestrator.

Response body: {"error": "Bad Gateway"}

### Response body parameters \(JSON\)

Name

Description

ws_ticket

Ticket that the client uses to open the WebSocket connection to the voice orchestrator. The ticket expires after 60 seconds and can be used only once.Data type: String

### cURL request

The following example demonstrates how to use the POST endpoint to request a ticket for a voice service. The request includes the session CSRF token header.

Shell
curl "https://instance.service-now.com/api/sn_webrtc/webrtc_cookie_auth/cookie_auth" \        --request POST \        --header "Accept: application/json" \        --header "Content-Type: application/json" \        --header "X-UserToken: session_csrf_token" \        --data "{\"voice_service_id\": \"0123456789abcdef0123456789abcdef\", \"orchestrator_host\": \"https://myservicenoworchestrator.sncapps.service-now.com\"}"

Response body. The response contains the ticket.

JSON
{        "ws_ticket": "ticket_value"        }
Keywords WebRTCdialpadDTMFphone widgettheme tokens
Search documentation
Search document titles and file paths on the brazil branch