ar.io Logoar.io Documentation

Fetch Data (via REST API)

The simplest way to access data on Arweave is through HTTP requests to gateways. This method works in any web browser and requires no additional setup.

Fetching Data from Gateways

Gateways are the most performant way to fetch data from Arweave, providing significant advantages over accessing Arweave nodes directly.

Why Gateways Are Faster:

  • Content Caching - Pre-cached data for instant retrieval
  • Data Indexing - Fast search and query capabilities
  • Network Optimization - Distributed infrastructure for better performance
  • Content Delivery - Optimized serving with compression and CDN features

REST APIs for Fetching Data

Gateways support multiple API endpoints for accessing data:

Standard Endpoint

Access any transaction using this URL structure:

https://<gateway>/<transaction-id>

Examples:

  • https://turbo-gateway.com/bVLEkL1SOPFCzIYi8T_QNnh17VlDp4RylU6YTwCMVRw
  • https://turbo-gateway.com/FguFk5eSth0wO8SKfziYshkSxeIYe7oK9zoPN2PhSc0

Raw Data Endpoint

For raw data access that bypasses manifest path resolution:

https://<gateway>/raw/<transaction-id>

This endpoint returns the raw data bytes without resolving manifest paths, useful when you need the exact stored data.

Providing Bundle Location Hints

An ANS-104 data item is stored inside a bundle whose root transaction is written to Arweave. A gateway normally resolves the data item ID to that root transaction and the item's byte range automatically. If you already know this location, you can include it as request headers to avoid the lookup step:

Request headerValue
X-AR-IO-Root-Transaction-IdID of the root Arweave transaction containing the data item
X-AR-IO-Data-Item-OffsetByte offset of the complete data item within the root bundle
X-AR-IO-Data-Item-SizeSize of the complete data item in bytes

For example, when all three values are known:

curl --fail --location \
  --header "X-AR-IO-Root-Transaction-Id: <root-transaction-id>" \
  --header "X-AR-IO-Data-Item-Offset: <data-item-offset>" \
  --header "X-AR-IO-Data-Item-Size: <data-item-size>" \
  --output <output-file> \
  "https://<gateway>/<data-item-id>"

If only the root transaction ID is known, it can be supplied on its own. The gateway will use it to locate the bundle and determine the data item's offset and size:

curl --fail --location \
  --header "X-AR-IO-Root-Transaction-Id: <root-transaction-id>" \
  --output <output-file> \
  "https://<gateway>/<data-item-id>"

Location hints are an optional retrieval optimization, not a different data address. Keep requesting the data item ID in the URL. The gateway validates the resolved data item against that ID and returns an error if the hints do not identify the requested item.

You can inspect a successful HEAD or GET response for the same X-AR-IO-Root-Transaction-Id, X-AR-IO-Data-Item-Offset, and X-AR-IO-Data-Item-Size headers. Save those values when you need to make later requests without repeating root-transaction discovery.

Learn More: For complete API documentation and testing, see the ar.io Node Data APIs.

Sandboxing

Ar.io gateways implement security measures by redirecting requests to sandbox subdomains for enhanced browser security.

Why Redirects Happen:

  • Security Isolation - Content is served from isolated sandbox environments
  • CSP Protection - Prevents cross-site scripting attacks
  • Resource Isolation - Limits potential security vulnerabilities
  • Browser Sandboxing - Leverages same-origin policy for enhanced security

What to Expect:

  • Initial request: https://turbo-gateway.com/transaction-id
  • Redirects to: https://sandbox.turbo-gateway.com/transaction-id (or similar)
  • Final content served from sandbox subdomain

Important: Always follow redirects in your applications - the final sandbox URL contains the actual content.

Learn More: For detailed information about how browser sandboxing works and why it's important for security, see our Browser Sandboxing documentation.

Using in Applications

JavaScript Example with Fetch:

// Fetch data from Arweave (follows redirects automatically)
const response = await fetch("https://turbo-gateway.com/your-transaction-id", {
  redirect: "follow", // Follow redirects automatically
});

if (!response.ok) {
  throw new Error(`HTTP error! status: ${response.status}`);
}

const data = await response.text();
console.log(data);

HTML Example:

<!-- Direct image access (browsers handle redirects automatically) -->
<img src="https://turbo-gateway.com/your-image-id" alt="My Image" />

Manifests

For organized file collections, use manifests to create friendly path-based URLs:

https://turbo-gateway.com/<manifest-id>/path/to/file

Example:

  • https://turbo-gateway.com/X8Qm…AOhA/index.html
  • https://turbo-gateway.com/X8Qm…AOhA/styles.css
  • https://turbo-gateway.com/X8Qm…AOhA/assets/logo.png

Learn more about manifests

Next Steps

How is this guide?