The API Playground: trying a real request from your browser, step by step

WhatsApp & APIs·· 26 views· 3 min read

The short answer: the Playground makes real API requests from your browser, with nothing to install. You pick the operation, fill in the request, send it and see the answer. At the same time it shows the request code in curl, PHP, Python and JavaScript, which follows what you type.

Two ways to open it

Where How it works
On the Playground page Lists every operation, with a "Search operations" box. Pick one and the panel opens on that same page.
Inside each operation On the area pages, every operation has a Playground button that opens the same panel without leaving the page.

Step by step

1 Start with an operation that needs no key: GET /v1/ping confirms the API is answering. It is the best first test.
2 Type your key, when the operation asks for one, in the "API key" field. To practise, use a sandbox_ key. The Show button lets you see what you typed.
3 Fill in the parameters. The required ones are marked.
4 Choose the headers. Accept-Language sets the language of the messages; "Add a header" adds others.
5 Write the body in JSON, on operations that have one. The page tells you whether the JSON is valid before you send it.
6 Click Send request, or press Ctrl+Enter.
7 Read the answer: status, time, remaining requests, body and headers. See how to read the answer.
From a browser, the API only accepts four headers: Authorization, Content-Type, Idempotency-Key and Accept-Language. Any others you add go only into the generated code, for use in your own program.

Why it works here and not on your website

Browsers can only call the API from the documentation. The pages of your own website cannot use the key directly, and that is a good thing: the key would be visible to anyone who opened the page. In your project, the call is made on the server. The reason is explained in CORS errors.

The Playground needs JavaScript. Without it, each operation opens its explanation on the area page. Taking care of your key: your key in the Playground.

Make your first request now: the ping needs no key.

Open the Playground

SEE ALSO

Your key in the API Playground: where it stays, why sandbox_ first, and the prod_ warning

Reading the API Playground answer: status, time, remaining requests, headers and history

Code examples in our API docs: curl, PHP, Python and JavaScript, ready to copy and adapt

A reading path through our API docs: from the first request to a finished integration

CORS error between your front end and your API: how to fix it

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from R118.80/mo (3-year plan, with coupon)

See plans
Was this answer helpful? Your answer helps us improve this article.