Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Este documento lo ayudará a familiarizarse con la API de Custom Search JSON y su uso.
Antes de comenzar
Crea un Motor de Búsqueda Programable
Cuando llama al usuario de la API, emite solicitudes contra una instancia existente de Programmable Search Engine.
Por lo tanto, antes de usar la API, debes crear una en el Panel de control. Sigue el instructivo para obtener más información sobre las diferentes opciones de configuración.
Una vez creado, puedes encontrar el ID del motor de búsqueda en la sección Básico de la página Descripción general. Este es el parámetro cx que usa la API.
Identifica tu aplicación ante Google con la clave de API
La API de Custom Search JSON requiere el uso de una clave de API. Una clave de API es una forma de identificar a tu cliente para Google.
Una vez que tienes una clave de API, tu aplicación puede agregar el parámetro de consulta key=yourAPIKey a todas las URLs de solicitud. La clave de API se incorpora de manera segura en URLs, por lo que no necesita codificación.
Descripción general de la API
Operaciones de API
Solo hay un método para invocar en la API de Custom Search JSON:
Muestra los resultados de la búsqueda solicitados de un Motor de Búsqueda Programable.
GET
Modelo de datos de la API
El resultado de una búsqueda a la API de Custom Search JSON es un objeto JSON que incluye tres tipos de datos:
Metadatos que describen la búsqueda solicitada (y, posiblemente, las solicitudes de búsquedas relacionadas)
Metadatos que describen el Motor de Búsqueda Programable
Resultados de la búsqueda
Consulta la sección Datos de respuesta de Cómo usar REST para obtener más detalles.
El modelo de datos se basa en la especificación de OpenSearch 1.1. Además de las propiedades estándares de OpenSearch, la API de Custom Search JSON define dos propiedades personalizadas y dos roles de consulta personalizados:
Propiedades personalizadas
cx: Es el identificador del Motor de Búsqueda Programable.
safe: Es una descripción del nivel de búsqueda segura para filtrar los resultados que se muestran.
Roles de consulta personalizados
nextPage: Es una función que indica que la consulta se puede usar para acceder a la siguiente página lógica de resultados, si corresponde.
previousPage: Es una función que indica que la consulta se puede usar para acceder a la página lógica anterior de resultados, si corresponde.
Probar
Para explorar y ver lo que puede hacer la API sin escribir ningún código, visita la herramienta"Prueba esta API".
Para obtener una descripción completa de los parámetros, visita la referencia de cse.list.
Para obtener información sobre cómo usar la API a través de solicitudes HTTP, consulta Cómo usar REST.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-08-31 (UTC)"],[[["\u003cp\u003eThis guide introduces the Custom Search JSON API and provides instructions for its use.\u003c/p\u003e\n"],["\u003cp\u003eBefore using the API, you need to create a Programmable Search Engine and obtain an API key.\u003c/p\u003e\n"],["\u003cp\u003eThe API allows you to retrieve search results from your Programmable Search Engine using a single \u003ccode\u003elist\u003c/code\u003e operation.\u003c/p\u003e\n"],["\u003cp\u003eThe API returns results in JSON format containing search metadata, engine details, and the search results themselves.\u003c/p\u003e\n"],["\u003cp\u003eYou can experiment with the API using the provided "Try this API" tool or learn more through detailed documentation and examples.\u003c/p\u003e\n"]]],[],null,["# Custom Search JSON API: Introduction\n\nThis document will help you to get familiar with Custom Search JSON API and its usage.\n\nBefore you start\n----------------\n\n### Create Programmable Search Engine\n\nBy calling the API user issues requests against an existing instance of\nProgrammable Search Engine.\nTherefore, before using the API, you need to create one in the\n[Control Panel](https://programmablesearchengine.google.com/controlpanel/create)\n. Follow the [tutorial](/custom-search/docs/tutorial/creatingcse)\nto learn more about different configuration options.\nOnce it is created, you can find the **Search Engine ID** in the **Overview**\npage's **Basic** section. This is the `cx` parameter used by the API.\n\n### Identify your application to Google with API key\n\nCustom Search JSON API requires the use of an API key. An API key is a way to identify your client to Google.\n\n- [Programmable Search Engine](https://cse.google.com/) (free edition) users: Get a Key\n\nAfter you have an API key, your application can append the query parameter\n`key=yourAPIKey` to all request URLs. The API key is safe for embedding in URLs,\nit doesn't need any encoding.\n\nAPI overview\n------------\n\n### API operations\n\nThere is only one method to invoke in the Custom Search JSON API:\n\n| Operation | Description | REST HTTP mapping |\n|------------------------------------------------------|-------------------------------------------------------------------------|-------------------|\n| [list](/custom-search/v1/reference/rest/v1/cse/list) | Returns the requested search results from a Programmable Search Engine. | `GET` |\n\n### API data model\n\nThe result of a search query to the Custom Search JSON API is a JSON object that includes three types of data:\n\n- Metadata describing the requested search (and, possibly, related search requests)\n- Metadata describing the Programmable Search Engine\n- Search results\n\nSee the Response data section of [Using REST](/custom-search/v1/using_rest#response_data) for more details.\n\nThe data model is based on the OpenSearch 1.1 Specification. In addition to the standard OpenSearch properties, the Custom Search JSON API defines two custom properties and two custom query roles:\n\n- Custom properties\n - `cx`: The identifier of the Programmable Search Engine.\n - `safe`: A description of the safe search level for filtering the returned results.\n- Custom query roles\n - `nextPage`: A role that indicates the query can be used to access the next logical page of results, if any.\n - `previousPage`: A role that indicates the query can be used to access the previous logical page of results, if any.\n\nTry it\n------\n\nTo play around and see what the API can do, without writing any code, visit the\n[\"Try this API\" tool](/custom-search/v1/reference/rest/v1/cse/list?apix=true).\n\nFor a full description of parameters visit the\n[cse.list reference](/custom-search/v1/reference/rest/v1/cse/list).\n\nTo learn how to use the API via HTTP requests, continue to\n[Using REST](/custom-search/v1/using_rest)."]]