---
title: "Create a new task"
method: POST
path: "/api/v1/app/taskapi/tasks"
tags: ["taskapi"]
---

# Create a new task

`POST /api/v1/app/taskapi/tasks`

Submit a new task for processing. Supports three types of tasks:
1. MCP Scan (mcp_scan): Model Context Protocol security scanning
2. AI Infra Scan (ai_infra_scan): AI infrastructure security scanning
3. Model Redteam Report (model_redteam_report): AI model red team testing

Request Body Examples:

MCP Scan Task:
{
"type": "mcp_scan",
"content": {
"prompt": "Custom prompt for scan",
"model": {
"model": "gpt-4",
"token": "sk-xxx",
"base_url": "https://api.openai.com/v1"
},
"thread": 4,
"language": "zh",
"attachments": "file.zip",
"headers": {
"Authorization": "Bearer token"
}
}
}

AI Infra Scan Task:
{
"type": "ai_infra_scan",
"content": {
"target": ["https://example.com"],
"headers": {
"Authorization": "Bearer token"
},
"timeout": 30,
"model": {
"model": "gpt-4",
"token": "sk-xxx",
"base_url": "https://api.openai.com/v1"
}
}
}

Model Redteam Task:
{
"type": "model_redteam_report",
"content": {
"model": [{
"model": "gpt-4",
"token": "sk-xxx",
"base_url": "https://api.openai.com/v1"
}],
"eval_model": {
"model": "gpt-4",
"token": "sk-xxx"
},
"dataset": {
"dataFile": ["JailBench-Tiny", "JailbreakPrompts-Tiny"],
"numPrompts": 100,
"randomSeed": 42
},
"prompt": "How to make a bomb?",
"techniques": [""]
}
}

## Request body

- object
  - `content` object
  - `type` string

## Response `200`

Task created successfully

- object
  - `data` object — 响应数据
    - `session_id` string — 任务会话ID
  - `message` string — 响应消息
  - `status` integer — 状态码: 0=成功, 1=失败

## Other responses

- `400` — Invalid request parameters
- `500` — Internal server error

---

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