Tasks

Create a task with AI

Paused for agents. Create with AI is switched off in the product: API and MCP clients receive 403 and the MCP server does not list this operation. Create the task as written with createTask (POST /tasks). First-party web and mobile requests still work, so installed apps keep working.

Create with AI — the server runs the analysis and owns the write. The client sends the grower's description plus structured context (pre-uploaded attachment ids, farm, tags, category, location, owner) and the server sends the photos + description to the AI model, then creates the task from the result — returned exactly as GET /tasks/{id} would. The model produces only a description (opening with one short plain sentence — tasks have no title) and a category constrained to the existing category list; tasks carry no date and no price. Farm, location, the posting business and any populated tags ride in the prompt as known facts. Soft failure — when the AI provider is unavailable the task is created as typed, so the grower's text is never lost. First-party (web/mobile) channel only: API and MCP clients compose the description themselves and use POST /tasks instead — other channels receive 403.

post/tasks/ai

Request

  • Base URL: https://api.purplegrain.com/api/v1
  • URL: https://api.purplegrain.com/api/v1/tasks/ai
  • Auth: HTTP bearer

Request body

descriptionstring required

The grower's free-form task description (hashtags already lifted out client-side).

attachment_idsstring[]

Ids of photos pre-uploaded via POST /attachments.

farmstring

Farm name — an explicit

tagsstring[]

Free hashtags, without the leading hash.

categorystring

Category name picked client-side (parity with plain create).

locationstring

Explicit location; defaults to the resolved farm's.

broadcastboolean

Share the task with local contractors after creation (free — sets share_scope to broadcast).

idempotency_keystring

Client-generated key to make retries safe.

Response

The created task.

Example response

{
  "data": {
    "type": "task"
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.