How to | Create an Instant API
An instant API lets you call Wolfram Language code in the Wolfram Cloud from a web URL. You create an instant API and deploy it on the web using the Wolfram Language functions APIFunction and CloudDeploy. Instant APIs can be private (so only you can use them) or public (so anyone can use them). Note: running an instant API uses Wolfram Cloud Credits from your account.
This sets up an API that finds the square of an integer and deploys it to the cloud:
An API requires three things: a specification of parameters and their types, a specification of the code the API should run, and a specification of how the result from the API should be returned.
The Wolfram Language supports many types of parameters, as listed here.
This creates an instant API that has a parameter called "name" representing a country and that returns a PNG:
One way to debug an API is to run it entirely within the Wolfram Language. An APIFunction works like a pure function that takes an association as its argument: