> For the complete documentation index, see [llms.txt](https://docs.seda.xyz/home/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.seda.xyz/home/for-agents/agent-modules/http-fetch-timeouts.md).

# HTTP Fetch Timeouts

## HTTP fetch timeouts

**Canonical page:** <https://docs.seda.xyz/home/for-agents/modules/12-http-fetch-timeouts>

Authoritative reference:

* <https://docs.seda.xyz/home/for-developers/define-your-data-source/accessing-a-public-api/http-fetch-timeouts>

This page exists to prevent flaky Oracle Programs caused by slow upstream APIs.

***

### Default values (do not assume otherwise)

* Per-request timeout: **2,000ms**
* Global timeout budget across all HTTP requests: **20,000ms**

**Meaning:**

* Each individual HTTP request defaults to failing after \~2 seconds.
* Across the entire Oracle Program execution, all HTTP requests share a combined maximum budget of \~20 seconds.

***

### Why this matters

If your upstream frequently takes longer than 2 seconds, requests will fail unless you explicitly set a per-request timeout.

However, increasing timeouts too much can cause you to hit the global 20s budget if you make multiple requests.

***

### How to set a per-request timeout (Rust)

Copy/paste example:

```rust
use seda_sdk_rs::{http::http_fetch, HttpFetchOptions};

let response = http_fetch(
    "https://httpbin.org/get",
    Some(HttpFetchOptions {
        timeout_ms: Some(3_000), // 3 seconds timeout
        ..Default::default()
    })
);
```

### When to increase timeout

Increase `timeout_ms` when the upstream is expected to be slower, for example:

* AI/ML services (often 3–5 seconds)
* heavy data processing APIs
* slow but reliable providers

***

### Agent action (do this every time you add an HTTP call)

**Action checklist:**

1. Estimate upstream p95 latency (rough guess is fine).
2. Set `timeout_ms` slightly above that p95 (e.g., p95=2.4s → timeout=3.0s).
3. Count how many HTTP calls the Oracle Program makes in one execution.
4. Ensure the total worst-case time across calls stays within the 20,000ms global budget.

**Checkpoint:**

* You can state the chosen `timeout_ms` and why.
* You can justify that the number of HTTP calls will not exceed the global 20s budget.

#### Authoritative references:

**- Operating and Running a Data Proxy:** <https://docs.seda.xyz/home/for-data-providers/operating-a-data-proxy/operating-and-running-a-data-proxy>

**- Data Proxy overview:** <https://docs.seda.xyz/home/for-data-providers/operating-a-data-proxy/introduction-to-data-proxy>

**- Enabling SEDA Fast on a Data Proxy:** <https://docs.seda.xyz/home/for-data-providers/operating-a-data-proxy/enabling-seda-fast-on-a-data-proxy>

**- Advanced:** API-key Gated Data (proxyHttpFetch): <https://docs.seda.xyz/home/for-data-providers/operating-a-data-proxy/advanced-api-key-gated-data>

**- System requirements:** <https://docs.seda.xyz/home/for-data-providers/operating-a-data-proxy/system-requirements>

**- Scaling up:** <https://docs.seda.xyz/home/for-data-providers/operating-a-data-proxy/scaling-up>

**- Debugging:** <https://docs.seda.xyz/home/for-data-providers/operating-a-data-proxy/debugging>

<br>


---

# 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://docs.seda.xyz/home/for-agents/agent-modules/http-fetch-timeouts.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.
