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

# fileLink

POST https://api.groundx.ai/api/v1/ingest/document/{documentId}/file-link
Content-Type: application/json

Create a storage-signed download link for a saved asset you own. Anyone with the link can use or forward it until expiresAt. Revoking an API key or changing policy does not cancel issued links. The URL contains no GroundX API key. Returns 404 if file access is disabled, or 503 with Retry-After for temporary file-access failures.

Reference: https://docs.eyelevel.ai/reference/api-reference/documents/file-link

## Authentication

- `X-API-Key` header (required) — API Key authentication via header

## Request

### Path parameters

- `documentId` (string, required)

### Body (application/json)

This endpoint expects a FileLinkRequest.

- `asset` (AssetSelector, required)
- `expiresInSeconds` (integer, optional)

## Response

### 200

Private, no-store response

- `url` (string, required)
- `expiresAt` (string, required)

## Errors

### 400 Bad Request Error

Invalid body, revision, selector or expiry

- `any`

### 401 Unauthorized Error

Authentication required

- `any`

### 403 Forbidden Error

Forbidden

- `any`

### 404 Not Found Error

File access is disabled, or the owned resource or saved asset was not found

- `any`

### 409 Conflict Error

Revision or ownership conflict

- `any`

### 503 Service Unavailable Error

File access is enabled but temporarily unavailable. Retry after the delay in Retry-After.

- `any`

## Types

### AssetSelector

### AssetSelector0

- `kind` (enum, required)
  - Allowed values: `source`, `xray`, `extract`

### AssetSelector1

- `kind` (enum, required)
  - Allowed values: `page`
- `pageNumber` (integer, required)
- `corrected` (boolean, optional, default: false)

### AssetSelector2

- `kind` (enum, required)
  - Allowed values: `crop`
- `chunkId` (string, required)

### AssetSelector3

- `kind` (enum, required)
  - Allowed values: `crop`
- `pageNumber` (integer, required)
- `chunkIndex` (integer, required)

## Examples

**Request**

```json
{
  "asset": {
    "kind": "page",
    "pageNumber": 1,
    "corrected": false
  },
  "expiresInSeconds": 120
}
```

**Response**

```json
{
  "url": "https://storage.example/page/1.png?signature=example",
  "expiresAt": "2026-10-16T12:02:00Z"
}
```

**SDK Code**

```python
import requests

url = "https://api.groundx.ai/api/v1/ingest/document/11111111-1111-4111-8111-111111111111/file-link"

payload = {
    "asset": {
        "kind": "page",
        "pageNumber": 1,
        "corrected": False
    },
    "expiresInSeconds": 120
}
headers = {
    "X-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.groundx.ai/api/v1/ingest/document/11111111-1111-4111-8111-111111111111/file-link';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"asset":{"kind":"page","pageNumber":1,"corrected":false},"expiresInSeconds":120}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.groundx.ai/api/v1/ingest/document/11111111-1111-4111-8111-111111111111/file-link"

	payload := strings.NewReader("{\n  \"asset\": {\n    \"kind\": \"page\",\n    \"pageNumber\": 1,\n    \"corrected\": false\n  },\n  \"expiresInSeconds\": 120\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	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://api.groundx.ai/api/v1/ingest/document/11111111-1111-4111-8111-111111111111/file-link")

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

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"asset\": {\n    \"kind\": \"page\",\n    \"pageNumber\": 1,\n    \"corrected\": false\n  },\n  \"expiresInSeconds\": 120\n}"

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.post("https://api.groundx.ai/api/v1/ingest/document/11111111-1111-4111-8111-111111111111/file-link")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"asset\": {\n    \"kind\": \"page\",\n    \"pageNumber\": 1,\n    \"corrected\": false\n  },\n  \"expiresInSeconds\": 120\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.groundx.ai/api/v1/ingest/document/11111111-1111-4111-8111-111111111111/file-link', [
  'body' => '{
  "asset": {
    "kind": "page",
    "pageNumber": 1,
    "corrected": false
  },
  "expiresInSeconds": 120
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.groundx.ai/api/v1/ingest/document/11111111-1111-4111-8111-111111111111/file-link");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"asset\": {\n    \"kind\": \"page\",\n    \"pageNumber\": 1,\n    \"corrected\": false\n  },\n  \"expiresInSeconds\": 120\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "asset": [
    "kind": "page",
    "pageNumber": 1,
    "corrected": false
  ],
  "expiresInSeconds": 120
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.groundx.ai/api/v1/ingest/document/11111111-1111-4111-8111-111111111111/file-link")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```