> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://infonite.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://infonite.dev/_mcp/server.

# Download a document

GET https://clients.infonite.tech/api/executions/results/{execution_id}/attachments/v1/{attachment_id}

Download one document, as the source issued it.

The raw file, streamed with its own content type and its original filename in `Content-Disposition`. The `attachment_id` comes from [the document list](api:GET/executions/results/\{execution_id}/attachments/v1/all) or from the `attachments` of any result that carries documents.

**These are the originals** — signed and stamped by the administration or the institution that issued them. That is what makes them usable in a file that has to stand up to an audit, and what a re-typed figure can never be.

**A document lives exactly as long as its execution.** [Deleting the execution](api:DELETE/executions/handler/v1/\{execution_id}/delete) removes every file under it, permanently — store what you need to keep before you purge.

| Status | Meaning                                                                           |
| :----- | :-------------------------------------------------------------------------------- |
| `200`  | The file, streamed with its own content type.                                     |
| `202`  | `execution_still_processing` — documents are served once the execution is closed. |
| `404`  | No document with that id in this execution.                                       |

**Server to server only.** This call is authorised with your application secret: it belongs in your backend, never in a browser, a mobile app or anything your customer can read.

Reference: https://infonite.dev/api-reference/direct-executions/direct-executions-api/fetching-the-results/attachments/direct-executions-v-1-results-attachments-download

## Authentication

- `X-APP-SECRET` header (required) — Application Secret

## Servers

- `https://clients.infonite.tech/api` (Legacy Server, default)
- `https://clients.infonite.io/api` (Production Server)

## Request

### Path parameters

- `execution_id` (string, required) — The execution, as the acceptance response returned it.
- `attachment_id` (string, required) — The document, as the attachment list reports it.

## Response

### 200

**200 OK**The file itself, streamed with the content type the source issued it under. `Content-Disposition` carries the original filename.

- File download.

### 202

**202 Accepted**`execution_still_processing`: this one waits for the WHOLE execution, unlike the per-family endpoints — it is a single view assembled from all of them.

- `detail` (string, required) — Error message

## Errors

### 404 Not Found Error

**404 Not Found**No document with that id in this execution. Ids belong to one execution: a document is addressed through the execution it came from, never on its own.

- `detail` (string, required) — Error message

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of object, optional)
  - `loc` (list of string or integer, required)
  - `msg` (string, required)
  - `type` (string, required)
  - `input` (any, optional)
  - `ctx` (object, optional)

## Examples

**SDK Code**

```python
import requests

url = "https://clients.infonite.tech/api/executions/results/6aa3d8b418d1c5dc9a8e3d36/attachments/v1/6aa3d8c7f1b2a3d4e5f60718"

headers = {"X-APP-SECRET": "<apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://clients.infonite.tech/api/executions/results/6aa3d8b418d1c5dc9a8e3d36/attachments/v1/6aa3d8c7f1b2a3d4e5f60718';
const options = {method: 'GET', headers: {'X-APP-SECRET': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://clients.infonite.tech/api/executions/results/6aa3d8b418d1c5dc9a8e3d36/attachments/v1/6aa3d8c7f1b2a3d4e5f60718"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("X-APP-SECRET", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://clients.infonite.tech/api/executions/results/6aa3d8b418d1c5dc9a8e3d36/attachments/v1/6aa3d8c7f1b2a3d4e5f60718")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-APP-SECRET"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://clients.infonite.tech/api/executions/results/6aa3d8b418d1c5dc9a8e3d36/attachments/v1/6aa3d8c7f1b2a3d4e5f60718")
  .header("X-APP-SECRET", "<apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://clients.infonite.tech/api/executions/results/6aa3d8b418d1c5dc9a8e3d36/attachments/v1/6aa3d8c7f1b2a3d4e5f60718', [
  'headers' => [
    'X-APP-SECRET' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://clients.infonite.tech/api/executions/results/6aa3d8b418d1c5dc9a8e3d36/attachments/v1/6aa3d8c7f1b2a3d4e5f60718");
var request = new RestRequest(Method.GET);
request.AddHeader("X-APP-SECRET", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["X-APP-SECRET": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://clients.infonite.tech/api/executions/results/6aa3d8b418d1c5dc9a8e3d36/attachments/v1/6aa3d8c7f1b2a3d4e5f60718")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```