> ## Documentation Index
> Fetch the complete documentation index at: https://docs.revoengine.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Stream HTTP to Storage

> Persist an HTTP response without buffering the entire file.

## Stream HTTP responses into Storage

Use `responseType: 'storage'` with a flat `target` to keep a large response without buffering it in the Component.

```js theme={null}
const folder = await storage.ensureFolderPath('finance/statements');

const response = await api.httpCall(
  {
    url: `https://bank.example.com/v2/statements/${api.input(
      'statementId',
    )}`,
    method: 'GET',
    headers: {
      'X-API-Key': (await vault.get('BANK_API_KEY')).revision.value,
    },
  },
  {
    responseType: 'storage',
    target: {
      parentStorageEntryId: folder.storageEntryId,
      name: `${api.input('statementId')}.csv`,
      contentTypeHint: 'text/csv',
      computeStats: 'sync',
      metadata: { source: 'bank-statements' },
    },
  },
);

if (!response.storage)
  api.throw(502, { upstreamStatus: response.status });
return response.storage.entry;
```

Only successful `2xx` bodies are stored. The runtime creates a direct upload session, streams the response, and finalizes it before returning `response.storage.entry`; `response.data` is then `undefined`. Failed writes abort the new session, while a failed replacement keeps the existing entry.

The inverse direction uses `requestType: 'storage'` and `source`:

```js theme={null}
await api.httpCall(
  {
    url: 'https://signature.example.com/v1/documents',
    method: 'POST',
    headers: {
      Authorization: `Bearer ${
        (await vault.get('SIGNATURE_TOKEN')).revision.value
      }`,
    },
  },
  {
    requestType: 'storage',
    responseType: 'json',
    source: { storageEntryId: api.input('documentStorageEntryId') },
  },
);
```

`source` and `target` can be combined for an external conversion API. A target may also fill and finalize an existing active, empty, direct upload session. For caller-controlled parts, incremental generation, repair, schema policy, or resumable upload behavior, use [Storage upload sessions](https://docs.revoengine.com/operate/storage-uploads.md) instead.

Continue with [http](https://docs.revoengine.com/low-code/http.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.