PJT AI
应用场景博客定价文档
应用场景博客定价文档
登录注册
  • 简介
  • 认证
    • API 密钥
    • JWT 令牌
    • docs.sections.rateLimiting
  • docs.sections.apiUsage
    • docs.sections.usageStats
    • docs.sections.usageHistory
    • docs.sections.accountUsage
  • docs.sections.workspaces
    • docs.sections.workspacesList
    • docs.sections.workspacesGet
  • 项目
    • 项目列表
    • 获取项目
    • 创建项目
    • 更新项目
    • 删除项目
  • 任务
    • 任务列表
    • docs.sections.tasksPaged
    • docs.sections.tasksGet
    • 创建任务
    • docs.sections.tasksUpdate
    • docs.sections.tasksDelete
    • docs.sections.tasksAssigned
  • 文档
    • 文档列表
    • docs.sections.documentsPaged
    • docs.sections.documentsGet
    • 创建文档
    • docs.sections.documentsUpdate
    • docs.sections.documentsDelete
  • 外部集成
    • n8n 配置
    • 工作流示例
  • 错误处理

API 文档

使用 PJT AI API 从外部系统、代理和内部系统管理项目和任务。

基础 URLhttps://api.pjt.ai

认证

PJT AI API 支持两种认证方式:API 密钥和 JWT 令牌。

API 密钥

API 密钥是外部系统集成的推荐认证方式。从账户设置中生成 API 密钥。

1

进入账户设置中的 API 密钥部分。

2

点击「创建新 API 密钥」按钮并输入名称。

3

安全保存生成的密钥。完整密钥仅在创建时显示。

请求头格式

http
X-API-Key: pk_live_xxxxxxxxxxxx

cURL 示例

bash
curl -X GET "https://api.pjt.ai/api/external/v1/workspaces" \
  -H "X-API-Key: pk_live_xxxxxxxxxxxx"

JavaScript 示例

typescript
const response = await fetch('https://api.pjt.ai/api/external/v1/workspaces', {
  method: 'GET',
  headers: {
    'X-API-Key': 'pk_live_xxxxxxxxxxxx',
    'Content-Type': 'application/json',
  },
});

const workspaces = await response.json();

JWT 令牌

JWT 令牌用于基于用户会话的认证。将登录后颁发的令牌包含在 Authorization 请求头中。

http
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

docs.sections.rateLimiting

docs.auth.rateLimitDescription

docs.auth.rateLimitTypedocs.auth.rateLimitValue
docs.auth.rateLimitPerMinute60

docs.auth.rateLimitExceeded

json
{
  "error": "RATE_LIMIT_EXCEEDED",
  "message": "Too many requests. Please try again later."
}

docs.sections.apiUsage

docs.apiUsage.description

docs.apiUsage.stats.description

参数

名称类型必填描述
idpath是docs.apiUsage.params.apiKeyId

响应

json
{
  "apiKeyId": 1,
  "todayUsage": 150,
  "monthlyUsage": 3420,
  "totalUsage": 12500,
  "today": "2026-01-20",
  "month": "2026-01"
}

docs.apiUsage.history.description

参数

名称类型必填描述
idpath是docs.apiUsage.params.apiKeyId
daysquery否docs.apiUsage.params.days

响应

json
{
  "apiKeyId": 1,
  "history": [
    { "date": "2026-01-20", "count": 150 },
    { "date": "2026-01-19", "count": 230 },
    { "date": "2026-01-18", "count": 180 }
  ]
}

docs.apiUsage.account.description

响应

json
{
  "accountId": 1,
  "monthlyUsage": [
    { "month": "2026-01", "count": 3420 },
    { "month": "2025-12", "count": 4500 },
    { "month": "2025-11", "count": 3200 }
  ]
}

docs.sections.workspaces

docs.workspaces.description

docs.workspaces.list.description

响应

json
{
  "content": [
    {
      "id": 1,
      "name": "My Workspace",
      "description": "Main workspace",
      "createdAt": "2024-01-10T09:00:00Z"
    }
  ],
  "totalElements": 1,
  "totalPages": 1,
  "page": 0,
  "size": 20
}

docs.workspaces.get.description

参数

名称类型必填描述
idpath是docs.workspaces.params.id

响应

json
{
  "id": 1,
  "name": "My Workspace",
  "description": "Main workspace",
  "members": [...],
  "createdAt": "2024-01-10T09:00:00Z"
}

项目

创建、读取、更新和删除项目。

获取工作区中的项目列表。

参数

名称类型必填描述
workspaceIdpath是工作区 ID
pagequery否页码(从 0 开始)
sizequery否页面大小(默认:20)

响应

json
{
  "content": [
    {
      "id": 1,
      "name": "Website Redesign",
      "description": "Complete website overhaul",
      "status": "IN_PROGRESS",
      "startDate": "2024-01-15",
      "endDate": "2024-03-30",
      "createdAt": "2024-01-10T09:00:00Z"
    }
  ],
  "totalElements": 1,
  "totalPages": 1,
  "page": 0,
  "size": 20
}

获取项目详情。

参数

名称类型必填描述
idpath是项目 ID

响应

json
{
  "id": 1,
  "name": "Website Redesign",
  "description": "Complete website overhaul",
  "status": "IN_PROGRESS",
  "startDate": "2024-01-15",
  "endDate": "2024-03-30",
  "tasks": [...],
  "createdAt": "2024-01-10T09:00:00Z"
}

创建新项目。

请求体

json
{
  "workspaceId": 1,
  "name": "New Project",
  "description": "Project description",
  "startDate": "2024-01-15",
  "endDate": "2024-03-30"
}

响应

json
{
  "id": 1,
  "name": "New Project",
  "description": "Project description",
  "status": "PLANNING",
  "startDate": "2024-01-15",
  "endDate": "2024-03-30",
  "createdAt": "2024-01-10T09:00:00Z"
}

更新项目信息。

参数

名称类型必填描述
idpath是项目 ID

请求体

json
{
  "name": "Updated Project Name",
  "status": "IN_PROGRESS"
}

响应

json
{
  "id": 1,
  "name": "Updated Project Name",
  "status": "IN_PROGRESS",
  ...
}

删除项目。

参数

名称类型必填描述
idpath是项目 ID

响应

json
204 No Content

任务

管理项目中的任务。

获取项目中的任务列表。

参数

名称类型必填描述
projectIdpath是项目 ID

响应

json
[
  {
    "id": 1,
    "title": "Design mockups",
    "description": "Create initial design mockups",
    "status": "IN_PROGRESS",
    "priority": "HIGH",
    "dueDate": "2024-01-20",
    "assignee": { "id": 1, "name": "John Doe" }
  }
]

docs.tasks.paged.description

参数

名称类型必填描述
projectIdpath是项目 ID
pagequery否页码(从 0 开始)
sizequery否页面大小(默认:20)

响应

json
{
  "content": [
    {
      "id": 1,
      "title": "Design mockups",
      "description": "Create initial design mockups",
      "status": "IN_PROGRESS",
      "priority": "HIGH",
      "dueDate": "2024-01-20"
    }
  ],
  "totalElements": 1,
  "totalPages": 1,
  "page": 0,
  "size": 20
}

docs.tasks.get.description

参数

名称类型必填描述
idpath是docs.tasks.params.taskId

响应

json
{
  "id": 1,
  "title": "Design mockups",
  "description": "Create initial design mockups",
  "status": "IN_PROGRESS",
  "priority": "HIGH",
  "dueDate": "2024-01-20",
  "assignee": { "id": 1, "name": "John Doe" },
  "project": { "id": 1, "name": "Website Redesign" }
}

创建新任务。

请求体

json
{
  "projectId": 1,
  "title": "New Task",
  "description": "Task description",
  "priority": "MEDIUM",
  "dueDate": "2024-01-25",
  "assigneeId": 1
}

响应

json
{
  "id": 2,
  "title": "New Task",
  "description": "Task description",
  "status": "TODO",
  "priority": "MEDIUM",
  "dueDate": "2024-01-25"
}

docs.tasks.update.description

参数

名称类型必填描述
idpath是docs.tasks.params.taskId

请求体

json
{
  "title": "Updated Task",
  "status": "IN_PROGRESS",
  "priority": "HIGH"
}

响应

json
{
  "id": 1,
  "title": "Updated Task",
  "status": "IN_PROGRESS",
  "priority": "HIGH",
  ...
}

docs.tasks.delete.description

参数

名称类型必填描述
idpath是docs.tasks.params.taskId

响应

json
204 No Content

docs.tasks.assigned.description

响应

json
[
  {
    "id": 1,
    "title": "Design mockups",
    "description": "Create initial design mockups",
    "status": "IN_PROGRESS",
    "priority": "HIGH",
    "dueDate": "2024-01-20",
    "project": { "id": 1, "name": "Website Redesign" }
  }
]

文档

管理项目文档。

获取项目中的文档列表。

参数

名称类型必填描述
projectIdpath是项目 ID

响应

json
[
  {
    "id": 1,
    "title": "Project Requirements",
    "type": "SPECIFICATION",
    "createdAt": "2024-01-10T09:00:00Z",
    "updatedAt": "2024-01-15T14:30:00Z"
  }
]

docs.documents.paged.description

参数

名称类型必填描述
projectIdpath是项目 ID
pagequery否页码(从 0 开始)
sizequery否页面大小(默认:20)

响应

json
{
  "content": [
    {
      "id": 1,
      "title": "Project Requirements",
      "type": "SPECIFICATION",
      "createdAt": "2024-01-10T09:00:00Z",
      "updatedAt": "2024-01-15T14:30:00Z"
    }
  ],
  "totalElements": 1,
  "totalPages": 1,
  "page": 0,
  "size": 20
}

docs.documents.get.description

参数

名称类型必填描述
idpath是docs.documents.params.documentId

响应

json
{
  "id": 1,
  "title": "Project Requirements",
  "type": "SPECIFICATION",
  "content": "Document content here...",
  "project": { "id": 1, "name": "Website Redesign" },
  "createdAt": "2024-01-10T09:00:00Z",
  "updatedAt": "2024-01-15T14:30:00Z"
}

创建新文档。

请求体

json
{
  "projectId": 1,
  "title": "API Specification",
  "type": "SPECIFICATION",
  "content": "Document content here..."
}

响应

json
{
  "id": 2,
  "title": "API Specification",
  "type": "SPECIFICATION",
  "createdAt": "2024-01-20T10:00:00Z"
}

docs.documents.update.description

参数

名称类型必填描述
idpath是docs.documents.params.documentId

请求体

json
{
  "title": "Updated Title",
  "content": "Updated content..."
}

响应

json
{
  "id": 1,
  "title": "Updated Title",
  "content": "Updated content...",
  "updatedAt": "2024-01-20T10:00:00Z"
}

docs.documents.delete.description

参数

名称类型必填描述
idpath是docs.documents.params.documentId

响应

json
204 No Content

外部集成

将 PJT AI API 与外部自动化工具集成,以自动化您的工作流程。

n8nn8n

n8n 配置

要在 n8n 中使用 PJT AI API,请在 HTTP Request 节点中配置认证。

1

将 HTTP Request 节点添加到您的 n8n 工作流程中。

2

将认证设置为「Generic Credential Type」。

3

创建「Header Auth」凭据,并输入 X-API-Key 和您的 API 密钥。

4

设置基础 URL 并调用 API 端点。

凭据配置

n8n Credential
{
  "name": "PJT AI API",
  "type": "httpHeaderAuth",
  "data": {
    "name": "X-API-Key",
    "value": "pk_live_xxxxxxxxxxxx"
  }
}

工作流示例

使用 n8n 的工作流程自动化示例。

从 Slack 消息创建项目

当在 Slack 消息中检测到特定关键字时,自动创建新项目。

n8n Workflow
{
  "nodes": [
    {
      "name": "Slack Trigger",
      "type": "n8n-nodes-base.slackTrigger",
      "parameters": {
        "channel": "#project-requests"
      }
    },
    {
      "name": "Create Project",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "method": "POST",
        "url": "https://api.pjt.ai/api/external/v1/projects",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            { "name": "Content-Type", "value": "application/json" }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            { "name": "workspaceId", "value": "1" },
            { "name": "name", "value": "={{ $json.text }}" },
            { "name": "description", "value": "Created from Slack" }
          ]
        }
      }
    }
  ]
}

逾期任务通知

每天检查逾期任务,并向负责人发送 Slack 通知。

n8n Workflow
{
  "nodes": [
    {
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "parameters": {
        "rule": { "interval": [{ "field": "hours", "hoursInterval": 1 }] }
      }
    },
    {
      "name": "Get Tasks",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "method": "GET",
        "url": "https://api.pjt.ai/api/external/v1/projects/{{projectId}}/tasks",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "httpHeaderAuth",
        "qs": { "status": "IN_PROGRESS" }
      }
    },
    {
      "name": "Filter Overdue",
      "type": "n8n-nodes-base.filter",
      "parameters": {
        "conditions": {
          "dateTime": [{
            "value1": "={{ $json.dueDate }}",
            "operation": "before",
            "value2": "={{ $now }}"
          }]
        }
      }
    },
    {
      "name": "Send Notification",
      "type": "n8n-nodes-base.slack",
      "parameters": {
        "channel": "#alerts",
        "text": "Overdue task: {{ $json.title }}"
      }
    }
  ]
}

从 GitHub Issue 创建任务

当在 GitHub 中创建新 Issue 时,自动创建 PJT AI 任务。

n8n Workflow
{
  "nodes": [
    {
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "parameters": {
        "path": "github-issue",
        "httpMethod": "POST"
      }
    },
    {
      "name": "Create Task",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "method": "POST",
        "url": "https://api.pjt.ai/api/external/v1/projects/{{projectId}}/tasks",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "httpHeaderAuth",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            { "name": "title", "value": "={{ $json.issue.title }}" },
            { "name": "description", "value": "={{ $json.issue.body }}" },
            { "name": "priority", "value": "MEDIUM" }
          ]
        }
      }
    }
  ]
}

错误处理

API 使用标准 HTTP 状态码来指示请求成功或失败。

状态码含义API 使用标准 HTTP 状态码来指示请求成功或失败。
200OK请求成功。
201Created资源创建成功。
204No Content请求成功,无返回内容。
400Bad Request错误请求。请检查请求格式。
401Unauthorized需要认证或凭据无效。
403Forbidden无权访问该资源。
404Not Found请求的资源未找到。
429Too Many Requests超出速率限制。请稍后重试。
500Internal Server Error服务器内部错误。

错误响应格式

json
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "The request body contains invalid data",
    "details": [
      {
        "field": "name",
        "message": "Name is required"
      }
    ]
  }
}
PJT AI

与您的雄心一同扩展的智能。

Myelinsoft Inc.

31, Gangnam-daero 92-gil, Gangnam-gu, Seoul, Republic of Korea

6447, 6F

产品

  • 功能
  • 应用场景
  • 集成
  • API

公司

  • 关于我们
  • 博客
  • 联系我们

法律

  • 隐私政策
  • 服务条款
  • 安全
  • 合规

© 2026 PJT AI。保留所有权利。

hello@pjt.ai