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"
}

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,
eval-sample,
eval-output,
eval-summary,
batch-generated,
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,
eval-sample,
eval-output,
eval-summary,
batch-generated,
batch-api
Example:

"fine-tune"

Processed
boolean
required

Whether the file has been parsed and analyzed for correctness for fine-tuning.

FileType
enum<string>
default:jsonl
required

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

Available options:
csv,
jsonl,
parquet
Example:

"jsonl"