---
title: "Get a task"
url: "https://developer-staging.agentsync.io/apis/platform-api/versions/8177e94d-86f2-48a5-8ed6-d5fbcb69f38a/operations/getTask"
---

> Full API specification: https://developer-staging.agentsync.io/apis/platform-api/versions/8177e94d-86f2-48a5-8ed6-d5fbcb69f38a.md

# Get a task

`GET` `/v1/tasks/{id}`

Operation ID: `getTask`

Returns one task your organization reaches, with its slots and the latest answer at each. A sensitive position's answer is always masked. A task your organization does not reach is answered as one that does not exist.

## Path parameters

- `id` (string, required) - The task's TypeID.

## Responses

- `200` - The task.
- `401` - The request has no bearer token, or the token is malformed, expired or wrongly signed (code token_invalid). Every /v1 path answers this without a valid token, including paths no route serves. The response carries WWW-Authenticate: Bearer.
- `403` - The token is valid but the API will not serve it. The code says why: caller_not_service_account (the token identifies a person; only service account tokens are accepted), caller_claims_missing (the token lacks a usable org_id or service_account_id claim), scope_missing (the token lacks the route's product scope, named in the details entry whose param is "scope"), or role_missing (the service account no longer holds a role at its organization that may call the route).
- `404` - No task with this id is one your organization reaches (code task_not_found). An id that does not exist gets the same answer.
- `503` - A platform service this API depends on is unavailable (code service_unavailable).

## OpenAPI definition

```yaml
openapi: 3.1.1
info:
  title: AgentSync Platform API
  version: 0.0.1
servers:
  - url: https://api.{environment}.agentsync.io/platform
    description: AgentSync API gateway
    variables:
      environment:
        default: sandbox
        enum:
          - sandbox
paths:
  /v1/tasks/{id}:
    get:
      operationId: getTask
      summary: Get a task
      description: Returns one task your organization reaches, with its slots and the
        latest answer at each. A sensitive position's answer is always masked. A
        task your organization does not reach is answered as one that does not
        exist.
      security:
        - oauth2:
            - platform.tasks.read
      parameters:
        - name: id
          in: path
          description: The task's TypeID.
          required: true
          schema:
            $ref: "#/components/schemas/TaskId"
          example: task_01h455vb4pex5vsknk084sn02q
      responses:
        "200":
          description: The task.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Task"
              example:
                id: task_01h455vb4pex5vsknk084sn02q
                taskType: work
                state: in_progress
                subjectPersonId: person_01h455vb4pex5vsknk084sn02q
                required: true
                locked: false
                owner:
                  kind: person
                  personId: person_01h455vb4pex5vsknk084sn02q
                requirementSet:
                  id: requirementset_01h455vb4pex5vsknk084sn02q
                  revision: 3
                contractAssignmentId: contractassignment_01h455vb4pex5vsknk084sn02q
                contractAssignmentRelation: created
                dependsOn: []
                slots:
                  - key: residentState
                    kind: single
                    required: true
                    locked: false
                    sensitive: false
                  - key: ssn
                    kind: single
                    required: true
                    locked: false
                    sensitive: true
                submissions:
                  - slotKey: residentState
                    performer:
                      kind: person
                      personId: person_01h455vb4pex5vsknk084sn02q
                    value:
                      kind: inline
                      inline: CO
                  - slotKey: ssn
                    performer:
                      kind: person
                      personId: person_01h455vb4pex5vsknk084sn02q
                    value:
                      kind: masked
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/TaskNotFound"
        "503":
          $ref: "#/components/responses/ServiceUnavailable"
security:
  - oauth2:
      - platform.tasks.read
components:
  schemas:
    TaskId:
      type: string
      description: A task's ID, a TypeID with the prefix task.
      pattern: ^task_[0-7][0-9a-hjkmnp-tv-z]{25}$
      example: task_01h455vb4pex5vsknk084sn02q
    Task:
      type: object
      description: "One task: the list's fields except the name and timestamps, the
        requirement set and contract assignment behind it, and its slots and
        answers."
      required:
        - id
        - taskType
        - state
        - required
        - locked
        - requirementSet
        - contractAssignmentId
        - contractAssignmentRelation
        - dependsOn
        - slots
        - submissions
      properties:
        id:
          $ref: "#/components/schemas/TaskId"
        taskType:
          type: string
          description: The kind of task, as on the list.
          enum:
            - work
            - approval
            - review_submit
            - forms_signature
          example: work
        state:
          type: string
          description: Where the task sits in its lifecycle.
          enum:
            - not_started
            - in_progress
            - returned
            - completed
            - approved
            - rejected
            - skipped
            - closed
          example: in_progress
        subjectPersonId:
          $ref: "#/components/schemas/PersonId"
        subjectOrganizationId:
          $ref: "#/components/schemas/OrganizationId"
        required:
          type: boolean
          description: Whether the task is a required member of its requirement set.
          example: true
        locked:
          type: boolean
          description: Whether the task waits on others before it can be completed.
          example: false
        owner:
          $ref: "#/components/schemas/TaskOwner"
        requirementSet:
          type:
            - object
            - "null"
          description: The requirement set, at the revision, that raised the task. Null on
            a task raised on its own rather than by a set, and on one raised by
            a set another organization imposed.
          required:
            - id
            - revision
          properties:
            id:
              $ref: "#/components/schemas/RequirementSetId"
            revision:
              type: integer
              description: The revision of the set that raised the task.
              example: 3
          example:
            id: requirementset_01h455vb4pex5vsknk084sn02q
            revision: 3
        contractAssignmentId:
          type:
            - string
            - "null"
          description: The contract assignment the change request that raised the task
            created, modified, or terminated; contractAssignmentRelation says
            which. It is the same link GET /v1/tasks?contract_assignment_id=
            follows, so a task naming an assignment here is one that filter
            returns. Null on a task raised on its own, one raised without a
            change request, one raised by a change request that terminates a
            whole contract, one raised by a set another organization imposed,
            and one whose change request has not been applied yet.
          pattern: ^contractassignment_[0-7][0-9a-hjkmnp-tv-z]{25}$
          example: contractassignment_01h455vb4pex5vsknk084sn02q
        contractAssignmentRelation:
          type:
            - string
            - "null"
          description: "How the change request that raised the task touched
            contractAssignmentId: created (it added the assignment), modified
            (it changed the assignment's upline, commission level,
            annualization, states or writing number) or terminated (it ended the
            assignment). Null exactly when contractAssignmentId is. More values
            may be added; treat an unknown value as another relation to the same
            assignment."
          example: created
        dependsOn:
          type: array
          description: The tasks this one waits on, empty when none.
          items:
            $ref: "#/components/schemas/TaskId"
        slots:
          type: array
          description: The positions the task asks to be answered, empty when it asks
            nothing.
          items:
            $ref: "#/components/schemas/TaskSlot"
        submissions:
          type: array
          description: The latest answer at each slot that has one.
          items:
            $ref: "#/components/schemas/TaskSubmission"
      example:
        id: task_01h455vb4pex5vsknk084sn02q
        taskType: work
        state: in_progress
        subjectPersonId: person_01h455vb4pex5vsknk084sn02q
        required: true
        locked: false
        requirementSet:
          id: requirementset_01h455vb4pex5vsknk084sn02q
          revision: 3
        contractAssignmentId: contractassignment_01h455vb4pex5vsknk084sn02q
        contractAssignmentRelation: created
        dependsOn: []
        slots:
          - key: residentState
            kind: single
            required: true
            locked: false
            sensitive: false
        submissions:
          - slotKey: residentState
            performer:
              kind: person
              personId: person_01h455vb4pex5vsknk084sn02q
            value:
              kind: inline
              inline: CO
    PersonId:
      type: string
      description: A person's ID, a TypeID with the prefix person.
      pattern: ^person_[0-7][0-9a-hjkmnp-tv-z]{25}$
      example: person_01h455vb4pex5vsknk084sn02q
    OrganizationId:
      type: string
      description: "An organization's ID: a TypeID with the prefix org. It never
        changes, and is the same ID for the organization across the AgentSync
        API."
      pattern: ^org_[0-7][0-9a-hjkmnp-tv-z]{25}$
      example: org_01h455vb4pex5vsknk084sn02q
    TaskOwner:
      type: object
      description: "Who owns a task: a named person, or a queue that a role at an
        organization works from. A person whom the requirement set's rules hide
        from your organization is shown as the queue the task was written for
        instead; any other named owner is shown by personId. Absent when the
        task has no owner."
      required:
        - kind
      properties:
        kind:
          type: string
          description: person when personId names the owner; queue when queue does.
          enum:
            - person
            - queue
          example: person
        personId:
          $ref: "#/components/schemas/PersonId"
        queue:
          type: object
          description: The queue that owns the task. Absent unless kind is queue.
          required:
            - organizationId
            - persona
          properties:
            organizationId:
              $ref: "#/components/schemas/OrganizationId"
            persona:
              type: string
              description: The role whose holders work the queue.
              example: compliance_reviewer
      example:
        kind: queue
        queue:
          organizationId: org_01h455vb4pex5vsknk084sn02q
          persona: compliance_reviewer
    RequirementSetId:
      type: string
      description: A requirement set's ID, a TypeID with the prefix requirementset.
      pattern: ^requirementset_[0-7][0-9a-hjkmnp-tv-z]{25}$
      example: requirementset_01h455vb4pex5vsknk084sn02q
    TaskSlot:
      type: object
      description: One position a task asks to be answered. A single slot is answered
        as a whole; a section slot is answered per member field, listed in
        fields.
      required:
        - key
        - kind
        - required
        - locked
        - sensitive
      properties:
        key:
          type: string
          description: The slot's key, which submissions name as slotKey.
          example: residentState
        kind:
          type: string
          description: single or section.
          enum:
            - single
            - section
          example: single
        required:
          type: boolean
          description: Whether the slot must be answered.
          example: true
        locked:
          type: boolean
          description: Whether the slot was locked after it was filled in from the
            producer's record.
          example: false
        sensitive:
          type: boolean
          description: Whether the slot's answers are sensitive. A sensitive answer is
            always masked.
          example: false
        jurisdiction:
          type: string
          description: The two-letter code of the state asking the question, or ADJUSTER.
            Absent unless the task asks state-specific questions.
          example: CO
        fields:
          type: array
          description: A section slot's member fields. Absent on a single slot.
          items:
            type: object
            description: One member field of a section slot.
            required:
              - fieldKey
              - required
              - sensitive
            properties:
              fieldKey:
                type: string
                description: The field's key, which submissions name as fieldKey.
                example: addressLine1
              required:
                type: boolean
                description: Whether the field must be answered.
                example: true
              sensitive:
                type: boolean
                description: Whether the field's answers are sensitive. A sensitive answer is
                  always masked.
                example: false
        entries:
          type: array
          description: A repeatable section's entries, in the order they were added, which
            submissions name as entryId. Absent on any other slot.
          items:
            $ref: "#/components/schemas/SectionEntryId"
      example:
        key: residentState
        kind: single
        required: true
        locked: false
        sensitive: false
    TaskSubmission:
      type: object
      description: "The latest answer at one position: slotKey, with fieldKey for a
        section slot's field and entryId for a repeatable section's entry."
      required:
        - slotKey
        - performer
        - value
      properties:
        slotKey:
          type: string
          description: The key of the slot answered.
          example: residentState
        fieldKey:
          type: string
          description: The member field answered. Absent unless the slot is a section.
          example: addressLine1
        entryId:
          $ref: "#/components/schemas/SectionEntryId"
        performer:
          type: object
          description: Who gave the answer. personId names the person who answered; it is
            absent for system, and for a person the requirement set's rules hide
            from your organization.
          required:
            - kind
          properties:
            kind:
              type: string
              description: person for an answer a person gave; system for one filled in from
                the producer's record.
              enum:
                - person
                - system
              example: person
            personId:
              $ref: "#/components/schemas/PersonId"
        value:
          type: object
          description: "The answer. kind says which field carries it: inline the answer
            itself, file a description of an uploaded file. prefilled and masked
            carry neither: a prefilled answer stays in the producer's record,
            and a sensitive answer is never returned."
          required:
            - kind
          properties:
            kind:
              type: string
              description: inline, file, prefilled or masked.
              enum:
                - inline
                - file
                - prefilled
                - masked
              example: inline
            inline:
              description: The answer as given, any JSON value. Present only for inline.
              example: CO
            file:
              $ref: "#/components/schemas/TaskFile"
              description: The uploaded file. Present only for file; the bytes are not
                returned. GET /v1/tasks/{id}/files/{slot} returns a link to
                them.
      example:
        slotKey: ssn
        performer:
          kind: person
          personId: person_01h455vb4pex5vsknk084sn02q
        value:
          kind: masked
    Error:
      type: object
      description: "The canonical error envelope. Every error the API writes carries a
        machine-readable code as the first details entry, the one whose param is
        \"code\"; branch on that, not on the message. There are two exceptions,
        both 500s the service could not build a normal error for: the platform's
        panic recovery writes an empty body, and a failure to encode a response
        writes {\"message\": \"internal server error\"} with no details. Treat a
        500 without a code as internal_error. A 429 from the API gateway, in
        front of the API, carries a message only; treat any 429 as a signal to
        slow down."
      required:
        - message
      properties:
        message:
          type: string
          description: Human-readable summary of why the request failed.
          example: invalid page_size
        details:
          type: array
          description: 'The code entry {"param": "code", "message": "<code>"} first, then
            entries that name the offending request parameter. Present on every
            error the service writes except the two code-less 500s described
            above, so it is not marked required.'
          items:
            $ref: "#/components/schemas/ErrorDetail"
      example:
        message: invalid page_size
        details:
          - param: code
            message: parameter_invalid
          - param: page_size
            message: must be a positive integer
    SectionEntryId:
      type: string
      description: The ID of one entry of a task's repeatable section, a TypeID with
        the prefix sectionentry.
      pattern: ^sectionentry_[0-7][0-9a-hjkmnp-tv-z]{25}$
      example: sectionentry_01h455vb4pex5vsknk084sn02q
    TaskFile:
      type: object
      description: A file uploaded to answer a slot of a task. The bytes are not part of it.
      required:
        - name
        - contentType
        - sizeBytes
        - sha256
      properties:
        name:
          type: string
          description: The file's name as uploaded.
          example: license.pdf
        contentType:
          type: string
          description: The file's media type.
          example: application/pdf
        sizeBytes:
          type: integer
          format: int64
          description: The file's size in bytes.
          example: 48213
        sha256:
          type: string
          description: The hex SHA-256 of the file's bytes.
          example: 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
      example:
        name: license.pdf
        contentType: application/pdf
        sizeBytes: 48213
        sha256: 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
    ErrorDetail:
      type: object
      description: "One entry of an error's details: the error code, or a request
        parameter and what is wrong with it."
      required:
        - param
        - message
      properties:
        param:
          type: string
          description: The parameter the entry is about, or "code" for the error code.
          example: code
        message:
          type: string
          description: For param "code", the error code; otherwise what is wrong with the
            parameter.
          example: parameter_invalid
      example:
        param: code
        message: parameter_invalid
  responses:
    Unauthorized:
      description: "The request has no bearer token, or the token is malformed,
        expired or wrongly signed (code token_invalid). Every /v1 path answers
        this without a valid token, including paths no route serves. The
        response carries WWW-Authenticate: Bearer."
      headers:
        WWW-Authenticate:
          description: The authentication scheme the API expects.
          schema:
            type: string
          example: Bearer
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
          example:
            message: invalid or missing bearer token
            details:
              - param: code
                message: token_invalid
    Forbidden:
      description: "The token is valid but the API will not serve it. The code says
        why: caller_not_service_account (the token identifies a person; only
        service account tokens are accepted), caller_claims_missing (the token
        lacks a usable org_id or service_account_id claim), scope_missing (the
        token lacks the route's product scope, named in the details entry whose
        param is \"scope\"), or role_missing (the service account no longer
        holds a role at its organization that may call the route)."
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
          example:
            message: token lacks the required scope
            details:
              - param: code
                message: scope_missing
              - param: scope
                message: platform.contracts.read
    TaskNotFound:
      description: No task with this id is one your organization reaches (code
        task_not_found). An id that does not exist gets the same answer.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
          example:
            message: task not found
            details:
              - param: code
                message: task_not_found
    ServiceUnavailable:
      description: A platform service this API depends on is unavailable (code
        service_unavailable).
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
          example:
            message: service unavailable
            details:
              - param: code
                message: service_unavailable
  securitySchemes:
    oauth2:
      type: oauth2
      description: "How to get the access token: the client-credentials flow, with the
        client ID and secret AgentSync issued for your organization. The token
        host follows the environment, auth.<environment>.agentsync.io. Request
        only the scopes your integration needs."
      flows:
        clientCredentials:
          tokenUrl: https://auth.sandbox.agentsync.io/oauth2/token
          scopes:
            platform.organizations.read: Read organizations.
            platform.contracts.read: Read contracts.
            platform.contract-assignments.read: Read contract assignments.
            platform.producers.read: Read producers.
            platform.tasks.read: Read tasks.
            platform.requirement-sets.read: Read requirement sets.
```
