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

# Upload a file through a one-time link

PUT https://api.athenaintel.com/api/v0/assets/upload-links/{link_id}
Content-Type: application/octet-stream

Send one file through a link from POST /api/v0/assets/upload-links: the body is the file's bytes and X-Athena-Upload-Token the link's credential; no API key is needed. Athena runs POST /api/v0/assets/create-from-file as the person who asked for the link, with every gate again (an agent run's tool policy included), and answers with the new asset. A link works once: the first upload spends it, whatever its answer.

Reference: https://docs.athenaintel.com/api-reference/assets/upload-through-link

## Authentication

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

## Request

### Path parameters

- `link_id` (string, required) — The link's id, the last segment of its upload_url

### Headers

- `X-Athena-Upload-Token` (string, optional, nullable) — The link's one-time credential, from its headers

### Body (application/octet-stream)

This endpoint expects binary data of type application/octet-stream.

- Binary request body.

## Response

### 200

The asset made from the file

- `asset_id` (string, required) — ID of the newly created asset
- `asset_type` (string, required) — Type of the created asset
- `created_at` (string, required) — Timestamp when the asset was created
- `title` (string, required) — Title of the created asset
- `parent_folder_id` (string, optional, nullable) — ID of the parent folder
- `workspace_id` (string, optional, nullable) — ID of the workspace that owns the created asset

## Errors

### 400 Bad Request Error

The file is empty

- `map from string to any`

### 401 Unauthorized Error

The link is not valid, has expired or was minted elsewhere

- `map from string to any`

### 403 Forbidden Error

The person who asked for the link may no longer create there, or the agent run that asked for it may no longer use the tool the asset's type takes

- `map from string to any`

### 404 Not Found Error

The link's folder no longer exists

- `map from string to any`

### 410 Gone Error

The link was already used

- `map from string to any`

### 413 Content Too Large Error

The file is larger than its type's limit

- `map from string to any`

### 422 Unprocessable Entity Error

The file could not be read or converted (detail says why)

- `map from string to any`

### 502 Bad Gateway Error

The studio or the conversion failed

- `map from string to any`

### 503 Service Unavailable Error

Athena could not check the link; retry shortly

- `map from string to any`

## Examples

**Response**

```json
{
  "asset_id": "asset_abc123-def456-ghi789",
  "asset_type": "spreadsheet",
  "created_at": "2024-01-15T10:30:00Z",
  "title": "My New Spreadsheet",
  "parent_folder_id": "asset_folder_12345",
  "workspace_id": "workspace_abc123"
}
```

**SDK Code**

```python
import requests

url = "https://api.athenaintel.com/api/v0/assets/upload-links/link_id"

headers = {
    "X-API-KEY": "<apiKey>",
    "Content-Type": "application/octet-stream"
}

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

print(response.json())
```

```javascript
const url = 'https://api.athenaintel.com/api/v0/assets/upload-links/link_id';
const options = {
  method: 'PUT',
  headers: {'X-API-KEY': '<apiKey>', 'Content-Type': 'application/octet-stream'}
};

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://api.athenaintel.com/api/v0/assets/upload-links/link_id"

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

	req.Header.Add("X-API-KEY", "<apiKey>")
	req.Header.Add("Content-Type", "application/octet-stream")

	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.athenaintel.com/api/v0/assets/upload-links/link_id")

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

request = Net::HTTP::Put.new(url)
request["X-API-KEY"] = '<apiKey>'
request["Content-Type"] = 'application/octet-stream'

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.put("https://api.athenaintel.com/api/v0/assets/upload-links/link_id")
  .header("X-API-KEY", "<apiKey>")
  .header("Content-Type", "application/octet-stream")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.athenaintel.com/api/v0/assets/upload-links/link_id', [
  'headers' => [
    'Content-Type' => 'application/octet-stream',
    'X-API-KEY' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.athenaintel.com/api/v0/assets/upload-links/link_id");
var request = new RestRequest(Method.PUT);
request.AddHeader("X-API-KEY", "<apiKey>");
request.AddHeader("Content-Type", "application/octet-stream");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-KEY": "<apiKey>",
  "Content-Type": "application/octet-stream"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.athenaintel.com/api/v0/assets/upload-links/link_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
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()
```