---
search:
  tags:
    - drafts
    - POST
seo:
  description: >-
    Create draft. Reference for the POST /workspaces/{organizationId}/drafts
    endpoint in the Pile API.
sidebar:
  label: Create draft
  badge: POST
title: Create draft
type: openapi-operation
---
`POST /workspaces/{organizationId}/drafts`

**Request body** (`application/json`)

- `entityType` (string, required)
- `entityId` (string, required)
- `issueId` (string)
- `kind` (string, required)
- `payload` (object, required)
- `sessionId` (string)
- `agentSlug` (string)
- `promptVersion` (string)

Request body example:

```json
{
  "entityType": "issue",
  "entityId": "string",
  "issueId": "string",
  "kind": "comment",
  "payload": {
    "property1": null,
    "property2": null
  },
  "sessionId": "string",
  "agentSlug": "string",
  "promptVersion": "string"
}
```

**Responses**

- `201` — Draft created pending review — for artifact kinds, nothing reaches the merchant until a human publishes

Response example, 201:

```json
{
  "id": "string",
  "organizationId": "string",
  "entityType": "string",
  "entityId": "string",
  "issueId": "string",
  "kind": "comment",
  "payload": {
    "property1": null,
    "property2": null
  },
  "status": "pending",
  "createdById": "string",
  "sessionId": "string",
  "reviewedById": "string",
  "reviewedAt": "string",
  "reviewNote": "string",
  "publishedCommentId": "string",
  "agentSlug": "string",
  "promptVersion": "string",
  "originalPayload": {
    "property1": null,
    "property2": null
  },
  "slaBreached": true,
  "createdAt": "string",
  "updatedAt": "string"
}
```
