PubNub REST API
Authentication
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 92 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 formatCompanyName-ProgrammingLanguageUsed/YourClientSDKVersion
, for exampleCompanyABC-JS/1.0
. support@pubnub.com 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 asgzip
.Content-Type
- Always useapplication/json; charset=UTF-8
when sending JSON, and use UTF-8.Accept-Encoding
- If your client supportsgzip
, set this value togzip
, if your client supportsdeflate
, set this value todeflate
, if it supports both, set this value togzip, deflate
and 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 anauth
URL parameter, or with a differentauth
value. -
414
– The REST call was unsuccessful, due to exceeding the allowed size of 32 KiB.