> For the complete documentation index, see [llms.txt](https://developers.oxylabs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.oxylabs.io/products/es/web-scraper-api/features/http-context-and-job-management/headers-cookies-method.md). Agents can also search and read this documentation through its [MCP server](https://developers.oxylabs.io/~gitbook/mcp).

# Encabezados, cookies y método

Descubre cómo personalizar encabezados, cookies o el método HTTP al extraer datos con Web Scraper API.

Web Scraper API maximiza la eficiencia de acceso al sitio web usando encabezados y cookies predefinidos por nuestro equipo. Si es necesario, puede definir sus propios encabezados, cookies y el método HTTP.

## Encabezados personalizados

Si necesita sus propios encabezados, puede usarlos agregando el `context:force_headers` parámetro y estableciéndolo en `true` al enviar un trabajo de scraping. Web Scraper API enviará sus encabezados personalizados junto con el conjunto de encabezados predefinidos y luego los usará para acceder al sitio web.

#### Ejemplo de código

```json
{
    "context": [
        {
            "key": "force_headers",
            "value": true
        },
        {
            "key": "headers",
            "value": {
                "Accept-Language": "en-US,en;q=0.5"
            }
        }
    ],
    "source": "universal",
    "url": "https://example.com"
}
```

## Cookies personalizadas

Si necesita sus propias cookies, puede usarlas agregando el `context:force_cookies` parámetro y estableciéndolo en `true` al enviar un trabajo de scraping. Web Scraper API enviará sus cookies personalizadas junto con el conjunto de cookies predefinidas y luego las usará para acceder al sitio web. Si también desea reutilizar la misma dirección IP de proxy, consulte la [sesiones de proxy](https://developers.oxylabs.io/products/es/web-scraper-api/features/localization/proxy-location.md#sessions) documentación.

#### Ejemplo de código

```json
{
    "context": [
        {
            "key": "force_cookies",
            "value": true
        },
        {
            "key": "cookies",
            "value": [
                {
                    "key": "NID",
                    "value": "1234567890"
                }
            ]
        }
    ],
    "source": "universal",
    "url": "https://example.com"
}
```

## Método HTTP

`universal` la fuente usa el `GET` método HTTP por defecto.

Si necesita enviar datos al sitio web de destino, debe establecer el método HTTP en `POST` y proporcionar un Base64 codificado `POST` cuerpo de la solicitud en `context:content`. El siguiente ejemplo envía `hello=world` (Base64: `aGVsbG89d29ybGQ=`) a una página que devuelve la solicitud, para que pueda ver el cuerpo en el `data` campo del contenido devuelto.

#### Ejemplo de código

```json
{
    "source": "universal",
    "url": "https://httpbin.org/post",
    "context": [
        {
            "key": "http_method",
            "value": "post"
        },
        {
            "key": "content",
            "value": "aGVsbG89d29ybGQ="
        }
    ]
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.oxylabs.io/products/es/web-scraper-api/features/http-context-and-job-management/headers-cookies-method.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
