Wolfram|Alpha Short Answers API Reference
Get short textual answers quickly with the Short Answers API.
The Short Answers API returns a single plain text result directly from Wolfram|Alpha. In general, this text is taken directly from the Result pod of Wolfram|Alpha output. This API type is designed to deliver brief answers in the most basic format possible. It is implemented in a standard REST protocol using HTTP GET requests.
Signup and Login
To get started, you must register a Wolfram ID and sign in to the Wolfram|Alpha Developer Portal. Upon logging in, go to the My Apps tab to start creating your first app.
Obtaining an AppID
Click the Sign up to get your first AppID button to start the app creation process. After a one-time survey about intended usage, the AppID creation dialog will appear. Give your application a name and a simple description to register an AppID. Each application must have its own unique AppID.
Using the Short Answers API
Now that you have an AppID, you can make your first query. The base URL for queries is:
Every query requires two pieces of information—an AppID and an input value—in order to be processed correctly. The appid parameter tells your query which AppID to use:
Next, use the i parameter to specify the URL-encoded input for your query. For instance, here is a query for "How far is Los Angeles from New York?":
When executed with a valid AppID, this URL will return a short line of text with a computed response to your query:
URL Parameters and Options
You can add URL-encoded parameters to customize output. Since the output for this API is plain text, only basic parameters are available.
Use this parameter to manually select what system of units to use for measurements and quantities (either "metric" or "imperial"). By default, the system will use your location to determine this setting. Adding "units=metric" to our sample query displays the resulting distance in kilometers instead of miles:
The result is now given in kilometers instead of miles:
This parameter specifies the maximum amount of time (in seconds) allowed to process a query, with a default value of "5". Although it is primarily used to optimize response times in applications, the timeout parameter may occasionally affect what value is returned by the Short Answers API.
HTTP Status 501
This status is returned if a given input value cannot be interpreted by this API. This is commonly caused by input that is misspelled, poorly formatted or otherwise unintelligible. Because this API is designed to return a single result, this message may appear if no sufficiently short result can be found. You may occasionally receive this status when requesting information on topics that are restricted or not covered.
HTTP Status 400
This status indicates that the API did not find an input parameter while parsing. In most cases, this can be fixed by checking that you have used the correct syntax for including the i parameter.
Invalid appid (Error 1)
This error is returned when a request contains an invalid option for the appid parameter. Double-check that your AppID is typed correctly and that your appid parameter is using the correct syntax.
Appid missing (Error 2)
This error is returned when a request does not contain any option for the appid parameter. Double-check that your AppID is typed correctly and that your appid parameter is using the correct syntax.