Skip to main content
POST
/
disk
/
{disk_id}
/
artifact
Python
from acontext import AcontextClient

client = AcontextClient(api_key='sk_project_token')

# Upload a file to disk
with open('report.pdf', 'rb') as f:
    artifact = client.disks.upload_artifact(
        disk_id='disk-uuid',
        file=f,
        file_path='/documents/',
        meta={'category': 'reports', 'year': 2024}
    )
print(f"Uploaded artifact: {artifact.id}")
{
  "code": 123,
  "error": "<string>",
  "msg": "<string>",
  "data": {
    "created_at": "<string>",
    "disk_id": "<string>",
    "filename": "<string>",
    "meta": {},
    "path": "<string>",
    "updated_at": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Project Bearer token (e.g., "Bearer sk-ac-xxxx")

Path Parameters

disk_id
string<uuid>
required

Disk ID

Body

multipart/form-data
file
file
required

File to upload

file_path
string

File path in the disk storage (optional, defaults to '/')

meta
string

Custom metadata as JSON string (optional, system metadata will be stored under 'artifact_info' key)

Response

201 - application/json

Created

code
integer
error
string
msg
string
data
object