PubNub REST API
PubNub REST APIs don't require a username or password to be sent in the header. Authentication is based on the publish and subscribe keys from the Admin Portal.
If you're using Access Manager for access control, you must correctly set the value of the
auth query parameter.
Common Query Parameters
The following parameters should be used on all REST calls being made to PubNub.
uuid– required - A UTF-8 encoded string of up to 64 characters used to identify the client.
auth– optional - An Access Manager authentication key (PAM v2) or token (Access Manager), to be used on endpoints with access control.
signature– optional - Only to be used for Access Manager admin REST calls. For more information on how to compute the signature, refer to Signature generation.
pnsdk– optional - An identifier used to determine your client SDK. This should be of the format
CompanyName-ProgrammingLanguageUsed/YourClientSDKVersion, for example
CompanyABC-JS/1.0. firstname.lastname@example.org for further information.
Common Request Headers
The following HTTP headers should be used across all PubNub REST requests.
Content-Encoding- When sending compressed, gzipped data via POST requests, set value as
Content-Type- Always use
application/json; charset=UTF-8when sending JSON, and use UTF-8.
Accept-Encoding- If your client supports
gzip, set this value to
gzip, if your client supports
deflate, set this value to
deflate, if it supports both, set this value to
gzip, deflateand if it supports neither, omit this header.
Common HTTP Status Codes
The following HTTP Status codes should be treated the same across all PubNub REST responses.
200– The REST call was successful. Refer to the operation's detailed usage for more information on parsing the response.
403– The REST call was unsuccessful, due to an Access Manager (access control) issue. Try again, without an
authURL parameter, or with a different
414– The REST call was unsuccessful, due to exceeding the allowed size of 32 KiB.