Work

Request work from your paired worker

Create one pending EHQ worker request in a configured project through a personal platform-admin connection. Inspect existing work first and bind its Action with the current expectedUpdatedAt when continuing it. EHQ chooses the paired target and retains the Action, request and result independently of this assistant. This call does not execute work. A separate work:decide grant permits delegated decisions; otherwise present the EHQ review link. Requires opt-in work:request. Reuse the body idempotencyKey and Idempotency-Key header after interruption; changed instructions require a new key.

Method

POST

Path

/v1/work/request

Required scope

work:request

Request

curl -X POST "https://api.endurancehq.app/v1/work/request" \
  -H "Authorization: Bearer $EHQ_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"

JSON body schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "idempotencyKey": {
      "type": "string",
      "minLength": 8,
      "maxLength": 120,
      "description": "A stable key for this request. Reuse it after interruption; different work needs a new key."
    },
    "project": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120,
      "description": "An exact project key returned by work inspection."
    },
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "instructions": {
      "type": "string",
      "minLength": 20,
      "maxLength": 12000
    },
    "kind": {
      "type": "string",
      "enum": [
        "research",
        "draft",
        "code"
      ]
    },
    "priority": {
      "default": "normal",
      "type": "string",
      "enum": [
        "low",
        "normal",
        "high"
      ]
    },
    "sourceUrl": {
      "type": "string",
      "maxLength": 2000,
      "format": "uri"
    },
    "action": {
      "description": "Bind existing work using its current timestamp. Preparation preserves the parent Action.",
      "type": "object",
      "properties": {
        "taskId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "expectedUpdatedAt": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
        },
        "mode": {
          "default": "prepare",
          "type": "string",
          "enum": [
            "execute",
            "prepare"
          ]
        }
      },
      "required": [
        "taskId",
        "expectedUpdatedAt",
        "mode"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "idempotencyKey",
    "project",
    "title",
    "instructions",
    "kind",
    "priority"
  ],
  "additionalProperties": false
}

Response

Success status: 201

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "revision": {
          "type": "string"
        },
        "followUp": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "requestId": {
                  "type": "string"
                },
                "attempt": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "actionId": {
                  "type": "string"
                }
              },
              "required": [
                "requestId",
                "attempt",
                "actionId"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "continuedByRequestId": {
          "type": [
            "string",
            "null"
          ]
        },
        "kind": {
          "type": "string",
          "enum": [
            "worker",
            "computer_use"
          ]
        },
        "requestStatus": {
          "type": "string",
          "enum": [
            "pending",
            "approved",
            "dispatching",
            "dispatched",
            "completed",
            "rejected",
            "failed",
            "expired"
          ]
        },
        "title": {
          "type": "string"
        },
        "summary": {
          "type": [
            "string",
            "null"
          ]
        },
        "project": {
          "type": "string"
        },
        "product": {
          "type": "string"
        },
        "instructions": {
          "type": "string"
        },
        "sourceUrl": {
          "type": [
            "string",
            "null"
          ]
        },
        "targetId": {
          "type": [
            "string",
            "null"
          ]
        },
        "payloadHash": {
          "type": "string"
        },
        "attempt": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
        },
        "expiresAt": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
        },
        "error": {
          "type": [
            "string",
            "null"
          ]
        },
        "action": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                },
                "mode": {
                  "type": "string",
                  "enum": [
                    "execute",
                    "prepare"
                  ]
                },
                "phase": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "changedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "resultHash": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "acceptedAt": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "url",
                "mode",
                "phase",
                "message",
                "changedAt",
                "resultHash",
                "acceptedAt"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "execution": {
          "type": "object",
          "properties": {
            "provider": {
              "type": [
                "string",
                "null"
              ]
            },
            "harness": {
              "type": [
                "string",
                "null"
              ]
            },
            "model": {
              "type": [
                "string",
                "null"
              ]
            },
            "reasoningEffort": {
              "type": [
                "string",
                "null"
              ]
            },
            "threadId": {
              "type": [
                "string",
                "null"
              ]
            },
            "url": {
              "type": [
                "string",
                "null"
              ]
            },
            "startedAt": {
              "type": [
                "string",
                "null"
              ]
            },
            "completedAt": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "provider",
            "harness",
            "model",
            "reasoningEffort",
            "threadId",
            "url",
            "startedAt",
            "completedAt"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "delegatedDecisions": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "credentialId": {
                    "type": "string"
                  },
                  "credentialType": {
                    "type": "string",
                    "enum": [
                      "api_key",
                      "oauth_token"
                    ]
                  },
                  "decision": {
                    "type": "string",
                    "enum": [
                      "approve",
                      "reject",
                      "retry",
                      "accept",
                      "request_changes"
                    ]
                  },
                  "payloadHash": {
                    "type": "string"
                  },
                  "inputHash": {
                    "type": "string"
                  },
                  "attempt": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "recordedAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  }
                },
                "required": [
                  "credentialId",
                  "credentialType",
                  "decision",
                  "payloadHash",
                  "inputHash",
                  "attempt",
                  "recordedAt"
                ],
                "additionalProperties": false
              }
            },
            "reportedOutcome": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "accepted",
                    "needs_review",
                    "blocked"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "criteria": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "criterion": {
                    "type": "string"
                  },
                  "passed": {
                    "type": "boolean"
                  },
                  "evidence": {
                    "type": "string"
                  }
                },
                "required": [
                  "criterion",
                  "passed",
                  "evidence"
                ],
                "additionalProperties": false
              }
            },
            "remaining": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "finalMessage": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "delegatedDecisions",
            "reportedOutcome",
            "criteria",
            "remaining",
            "finalMessage"
          ],
          "additionalProperties": false
        },
        "previousAttempts": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "attempt": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "requestStatus": {
                "type": "string",
                "enum": [
                  "pending",
                  "approved",
                  "dispatching",
                  "dispatched",
                  "completed",
                  "rejected",
                  "failed",
                  "expired"
                ]
              },
              "error": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "result": {
                "type": "object",
                "properties": {
                  "delegatedDecisions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "credentialId": {
                          "type": "string"
                        },
                        "credentialType": {
                          "type": "string",
                          "enum": [
                            "api_key",
                            "oauth_token"
                          ]
                        },
                        "decision": {
                          "type": "string",
                          "enum": [
                            "approve",
                            "reject",
                            "retry",
                            "accept",
                            "request_changes"
                          ]
                        },
                        "payloadHash": {
                          "type": "string"
                        },
                        "inputHash": {
                          "type": "string"
                        },
                        "attempt": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "recordedAt": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        }
                      },
                      "required": [
                        "credentialId",
                        "credentialType",
                        "decision",
                        "payloadHash",
                        "inputHash",
                        "attempt",
                        "recordedAt"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "reportedOutcome": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "accepted",
                          "needs_review",
                          "blocked"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "criteria": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "criterion": {
                          "type": "string"
                        },
                        "passed": {
                          "type": "boolean"
                        },
                        "evidence": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "criterion",
                        "passed",
                        "evidence"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "remaining": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "finalMessage": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "delegatedDecisions",
                  "reportedOutcome",
                  "criteria",
                  "remaining",
                  "finalMessage"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "attempt",
              "requestStatus",
              "error",
              "result"
            ],
            "additionalProperties": false
          }
        },
        "review": {
          "type": "object",
          "properties": {
            "url": {
              "type": "string",
              "format": "uri"
            },
            "required": {
              "type": "boolean"
            },
            "reason": {
              "type": "string"
            },
            "authority": {
              "type": "string",
              "enum": [
                "ehq_owner",
                "delegated_connection"
              ]
            }
          },
          "required": [
            "url",
            "required",
            "reason",
            "authority"
          ],
          "additionalProperties": false
        },
        "attention": {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "approval",
                "running",
                "blocked",
                "result",
                "closed"
              ]
            },
            "message": {
              "type": "string"
            },
            "url": {
              "type": "string",
              "format": "uri"
            },
            "canFollowUp": {
              "type": "boolean"
            }
          },
          "required": [
            "kind",
            "message",
            "url",
            "canFollowUp"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "id",
        "revision",
        "followUp",
        "continuedByRequestId",
        "kind",
        "requestStatus",
        "title",
        "summary",
        "project",
        "product",
        "instructions",
        "sourceUrl",
        "targetId",
        "payloadHash",
        "attempt",
        "createdAt",
        "expiresAt",
        "error",
        "action",
        "execution",
        "result",
        "previousAttempts",
        "review",
        "attention"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "data"
  ],
  "additionalProperties": false
}

Other surfaces

CLI: ehq work request --project <key> --title <title> --kind <research|draft|code> --instructions <text> --idempotency-key <key> [--action <task_id> --expected-updated-at <iso> --mode <prepare|execute>]

MCP tool: ehq_work_request