Skip to main content
POST
/
files
/
upload
# Docs for v1 can be found by changing the above selector ^
from together import Together
import os

client = Together(
    api_key=os.environ.get("TOGETHER_API_KEY"),
)

current_dir = os.path.dirname(os.path.abspath(__file__))
file_path = os.path.join(current_dir, "data.jsonl")
file = client.files.upload(file=file_path)

print(file.id)
{
  "id": "<string>",
  "object": "<unknown>",
  "created_at": 123,
  "filename": "my_file.jsonl",
  "bytes": 123,
  "purpose": "fine-tune",
  "Processed": true,
  "FileType": "jsonl",
  "validation_report": {
    "valid": true,
    "dataset_format": "<string>",
    "dataset_has_sample_weights": true,
    "dataset_has_message_weights": true,
    "dataset_is_multimodal": true,
    "dataset_has_tools": true,
    "dataset_has_parallel_tool_calls": true,
    "dataset_has_reasoning": true,
    "nlines": 123,
    "file_id": "<string>",
    "error_type": "INVALID_FORMAT",
    "error": "<string>"
  }
}

Authorizations

Authorization
string
header
default:default
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

multipart/form-data
purpose
enum<string>
required

The purpose of the file

Available options:
fine-tune,
eval,
batch-api
Example:

"fine-tune"

file_name
string
required

The name of the file being uploaded

Example:

"dataset.csv"

file
file
required

The content of the file being uploaded

file_type
enum<string>
default:jsonl

The type of the file

Available options:
csv,
jsonl,
parquet
Example:

"jsonl"

Response

File uploaded successfully

Structured information describing a file uploaded to Together.

id
string
required

ID of the file.

object
any
required

The object type, which is always file.

created_at
integer
required

The timestamp when the file was created.

filename
string
required

The name of the file as it was uploaded.

Example:

"my_file.jsonl"

bytes
integer
required

The number of bytes in the file.

purpose
enum<string>
required

The purpose of the file as it was uploaded.

Available options:
fine-tune,
eval,
batch-api
Example:

"fine-tune"

Processed
boolean
required
deprecated

Deprecated. Whether file has been fully uploaded.

FileType
enum<string>
default:jsonl
required

The type of the file such as jsonl, csv, or parquet.

Available options:
csv,
jsonl,
parquet
Example:

"jsonl"

processing_status
enum<string>

Lifecycle state of the file validation pipeline. Files for non-fine-tune purposes skip validation.

Available options:
PENDING,
QUEUED,
RUNNING,
COMPLETED,
FAILED,
INVALID_FORMAT
validation_report
object

Report produced by the file validation pipeline. Present once validation has run; absent on files that bypassed validation (non-fine-tune purposes) or have not yet been validated.