# Jtheta API documentation

## 📘 JTheta.ai REST API Documentation

Welcome to the **JTheta.ai API** — your gateway to building end-to-end workflows for dataset creation, annotation task management, and AI-assisted labeling.

You need a API key to use  REST API.Refer to the following documentation on how to create API key:

{% content-ref url="../authentication/create-jtheta-api-key" %}
[create-jtheta-api-key](https://jtheta-ai.gitbook.io/docs.jtheta.ai/authentication/create-jtheta-api-key)
{% endcontent-ref %}

**Base URL:**

```
https://api.jtheta.ai
```

***

### 🚀 Quickstart: Validating Your API Key

#### ✅ `GET /validate_key/`

Use this endpoint to test if your API key is valid.

**Curl Example:**

```bash
curl -X GET https://api.jtheta.ai/validate_key/ \
  -H "Authorization: Bearer <your_api_key>"
```

**Responses:**

* `200 OK`: Valid API key
* `401 Unauthorized`: Missing or invalid key

***

### 📁 Projects & Datasets

#### 🆕 `POST /create_project/`

Create a new project to group datasets and tasks.

**Required JSON body:**

```json
{
  "project_title": "Retinal Dataset",
  "project_category": "Medical Imaging"
}
```

**Responses:**

* `201 Created`: Project created
* `400 Bad Request`: Missing or invalid fields
* `401 Unauthorized`: Invalid API key

***

#### 📦 `POST /create_dataset/`

Upload images into a new dataset under an existing project.

**Required fields (multipart/form-data):**

* `dataset_name`: name of the dataset
* `project_name`: project to associate
* `license`: optional license info
* `images`: multiple image files

**Curl Example:**

```bash
curl -X POST https://api.jtheta.ai/create_dataset/ \
  -F dataset_name=TumorSlides \
  -F project_name=RetinalResearch \
  -F images=@slide1.png \
  -F images=@slide2.png
```

**Response:**

* `201 Created`: Dataset and images uploaded

***

#### 📥 `POST /upload_images_to_dataset/`

Add more images to an existing dataset.

**Required fields (multipart/form-data):**

* `dataset_id`: numeric ID
* `project_name`
* `images`: additional image files

***

### 👩‍🏫 Annotation Workflow

#### ✍️ `POST /request_annotation/`

Assign annotators and reviewers to a dataset and define label types.

**Required JSON:**

```json
{
  "dataset_id": 1,
  "project_name": "Tumor Study",
  "assigned_annotator": "alice@domain.com",
  "assigned_reviewer": "bob@domain.com",
  "labels": [
    { "label": "Tumor", "type": "polygon" },
    { "label": "Blood Vessel", "type": "bounding_box" }
  ]
}
```

**Response:**

* `200 OK`: Task assigned

***

#### 📊 `GET /get_annotation_status/{project_title}/`

Check the progress of annotation for a given project.

**Path parameter:**

* `project_title`: name of the project

***

#### 🗑️ `POST /delete_project/`

Delete a project and all associated datasets, images, and annotations.

**JSON Body:**

```json
{
  "project_title": "Old Medical Study"
}
```

***

### 📤 Export and Download

#### 📥 `GET /api/export/download`

Get the dataset’s metadata and download URL.

**Query parameter:**

* `key`: your API access key

**Example:**

```bash
curl "https://api.jtheta.ai/api/export/download?key=<your_api_key>"
```

**Response:**

* `302 Found`: Redirects to download URL

###


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jtheta-ai.gitbook.io/docs.jtheta.ai/jtheta-rest-api/jtheta-api-documentation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
