> 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.

# fileUpload

POST https://api.groundx.ai/api/v1/bucket/{bucketId}/file-upload
Content-Type: application/json

Return a storage-signed PUT link for a public or protected bucket, valid for at most 900 seconds. Complete PUT before it expires. A private upload reservation also requires ingest submission before that deadline; an unreserved public source remains ingestible after PUT expiry. Available even when file-access protection is disabled. Uses this deployment and its configured storage. Include the requested per-file fileAccess policy so it is checked before upload; non-null policies return 403 when protection is disabled. Returns 503 with Retry-After for temporary verification failures.

Reference: https://docs.eyelevel.ai/reference/api-reference/buckets/file-upload

## Authentication

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

## Request

### Path parameters

- `bucketId` (integer, required)

### Body (application/json)

This endpoint expects a FileUploadRequest.

- `fileName` (string, required)
- `fileType` (enum, required) — The type of document (one of the currently supported file types)
  - Allowed values: `bmp`, `csv`, `docx`, `gif`, `heif`, `hwp`, `ico`, `jpg`, `json`, `pdf`, `png`, `pptx`, `svg`, `tiff`, `tsv`, `txt`, `xlsx`, `webp`
- `fileAccess` (FileAccessPolicy, optional, nullable) — Requested initial file policy, also sent during ingest. Omit or send null to inherit. Validated before an upload URL is issued. Non-null policies return 403 when file protection is disabled, so a protected upload cannot be staged publicly.

## Response

### 201

Private, no-store response

- `uploadId` (string, required)
- `uploadUrl` (string, required)
- `hostedUrl` (string, required)
- `expiresAt` (string, required)
- `method` (enum, required)
  - Allowed values: `PUT`
- `headers` (map from string to string, required)
- `effectiveFileAccess` (EffectivePolicy, optional) — Policy used when issuing this upload. Only protected uploads have a private ingest deadline. Missing policy metadata should retain existing protected-upload checks.

## 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

The owned bucket was not found

- `any`

### 409 Conflict Error

Revision or ownership conflict

- `any`

### 503 Service Unavailable Error

Upload signing or ownership verification is temporarily unavailable. Retry after the delay in Retry-After.

- `any`

## Types

### FileAccessPolicy

Settings that override inherited values. Omitted fields inherit. A protected parent cannot be made public, and its sharing time limit cannot be exceeded. Stable public links never expire. urlTtlSeconds limits the lifetime of storage-signed sharing links.

- `mode` (enum, optional)
  - Allowed values: `public`, `protected`
- `urlTtlSeconds` (integer, optional)

### EffectivePolicy

Applied settings after inheritance. Sharing links expire after 300 seconds by default; storage credentials may shorten that time. Protected stable URLs require current authentication on every read.

- `mode` (enum, required)
  - Allowed values: `public`, `protected`
- `urlTtlSeconds` (integer, required)

## Examples

**Request**

```json
{
  "fileName": "invoice.pdf",
  "fileType": "pdf"
}
```

**Response**

```json
{
  "uploadId": "11111111-1111-4111-8111-111111111111",
  "uploadUrl": "https://storage.example/private/upload.pdf?signature=example",
  "hostedUrl": "https://files.example/file/owner/upload.pdf",
  "expiresAt": "2026-10-16T12:15:00Z",
  "method": "PUT",
  "headers": {
    "Content-Type": "application/pdf"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.groundx.ai/api/v1/bucket/1234/file-upload"

payload = {
    "fileName": "invoice.pdf",
    "fileType": "pdf"
}
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/bucket/1234/file-upload';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"fileName":"invoice.pdf","fileType":"pdf"}'
};

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/bucket/1234/file-upload"

	payload := strings.NewReader("{\n  \"fileName\": \"invoice.pdf\",\n  \"fileType\": \"pdf\"\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/bucket/1234/file-upload")

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  \"fileName\": \"invoice.pdf\",\n  \"fileType\": \"pdf\"\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/bucket/1234/file-upload")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"fileName\": \"invoice.pdf\",\n  \"fileType\": \"pdf\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.groundx.ai/api/v1/bucket/1234/file-upload', [
  'body' => '{
  "fileName": "invoice.pdf",
  "fileType": "pdf"
}',
  '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/bucket/1234/file-upload");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"fileName\": \"invoice.pdf\",\n  \"fileType\": \"pdf\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "fileName": "invoice.pdf",
  "fileType": "pdf"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.groundx.ai/api/v1/bucket/1234/file-upload")! 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()
```