---
title: "Upload File"
method: POST
path: "/testsets/upload"
tags: ["Testsets"]
---

# Upload File

`POST /testsets/upload`

Uploads a CSV or JSON file and saves its data to Postgres.

Args:
upload_type : Either a json or csv file.
    file (UploadFile): The CSV or JSON file to upload.
    testset_name (Optional): the name of the testset if provided.

Returns:
    dict: The result of the upload process.

## Response `200`

Successful Response

- TestSetSimpleResponse
  - `id` string, required
  - `name` string, required
  - `created_at` string, required

## Other responses

- `422` — Validation Error

## Changes

- **2025-06-27** `e3e84db47198` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/agenta-ai/apis/agenta-api/changes/testsets/upload/post.md)

---

[API](https://skmtc.dev/agenta-ai/apis/agenta-api.md) · [All operations](https://skmtc.dev/agenta-ai/apis/agenta-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/agenta-ai/agenta-api/revisions/e3e84db47198/schema)
