YQL Web Service URLs

The YQL Web Service has two URLs. The following URL allows access to public data, which does not require authorization:


The next URL requires authorization by OAuth and allows access to both public and private data:


The following URLs are for accessing data from Open Data Tables configured to use YQL streaming. The first URL is used to get public data, and the second requires authorization by OAuth and allows access to both public and private data.




The public URL has a lower rate limit than the OAuth-protected URL. Therefore, if you plan to use YQL heavily, you should access the OAuth-protected URL.

YQL Query Parameters

The following table lists the query parameters for the URLs of the YQL Web Service.

Query Parameter Required? Default Description
q Yes (none) The YQL statement to execute, such as SELECT.
format No xml The format of the results of the call to the YQL Web Service. Allowed values: xml or json.
callback No (none) The name of the JavaScript callback function for JSONP format. If callback is set and if format=json, then the response format is JSON. For more information on using XML instead of JSON, see JSONP-X.
crossProduct No (none) When given the value optimized, the projected fields in SELECT statements that may be returned in separate item elements in the response are optimized to be in a single item element instead. See Optimizing the Response for more information.
diagnostics No true Diagnostic information is returned with the response unless this parameter is set to false.
debug No (none)

Enables network-level logging of each network call within a YQL statement or API query.

For more information, see, Logging Network Calls in Open Data Tables.

env No (none) Allows you to use multiple Open Data Tables through a YQL environment file.
jsonCompat No (none) Enables lossless JSON processing. The only allowed value is new. See JSON-to-JSON Transformation.

YQL Query Aliases

To make YQL Web Service queries easier to remember and share, you can shorten them with query aliases. Take for example a normal YQL REST query:


The corresponding query alias can look like this:


Creating Queries Aliases

The easiest way to create query aliases is through the YQL console, though you can also use some of the more advanced functions through the yql.queries and yql.queries.query tables.

To create a short query alias based on a statement, follow these steps:

  1. Go the YQL console.
  2. Sign in with your Yahoo ID if you haven't already. Click on the Sign In link, which is located along the top of the page. Signing in is required for saving and accessing query aliases.
  3. Using the YQL console, create a YQL statement or Web Service query that you want to save as a query alias.
  4. Click on the Create Query Alias link, which is located in the upper-right corner of the YQL statement box.
  5. When first creating a query alias, type in a prefix that will be associated with all your query aliases. For example, if you choose "prefix," each query alias you create will start like this:



    If you decide later that you want to start over with a new prefix for your query aliases, you can run the following YQL statement to delete your existing prefix:

    delete from yql.queries

    Keep in mind that deleting your prefix also deletes all its associated query aliases.

  6. Click Next and then type the actual name of the query alias. This alias name is appended to the end of your query after the prefix. If you choose "alias", the resulting query will look like this:


  7. After reviewing the public URL and the Authenticated URL, click Close to return to the YQL console.

All of your saved query aliases appear along the right side the YQL console under the Query Aliases heading. There, you can click on a alias name to see it in the REST query box. You can also click on the red X next to a particular alias name to delete it.

Variable Substitution with Query Aliases

Query aliases support variable substitution using the @ symbol. For example, the following YQL statement searches for questions about poetry that contain the name Auden:

select * from answers.search where query="Auden" and category_id=2115500137 and type="resolved"

Using variable substitution, you can replace Auden with the variable poet. Here is an example:

select * from answers.search where query=@poet and category_id=2115500137 and type="resolved"

A corresponding query alias with the required parameter can look like this:


Table of Contents