> ## Documentation Index
> Fetch the complete documentation index at: https://docs.leadstaker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get a task by id

> Answers 404 when the id does not exist or belongs to another project.



## OpenAPI

````yaml /api-reference/openapi.json get /v1/tasks/{id}
openapi: 3.0.3
info:
  title: Leadstaker API
  version: 1.0.0
  description: Public REST API for Leadstaker projects.
servers:
  - url: https://n-api.leadstaker.com
    description: Production
security: []
tags:
  - name: Leads
    description: >-
      Chatbot conversations captured in a project, with the answers given and
      where the visitor came from.
  - name: Fields
    description: >-
      Custom field definitions, both the built-in ones and the ones a project
      creates.
  - name: Field groups
    description: Sections that organize custom fields in the interface.
  - name: Deals
    description: Opportunities moving through a pipeline, each tied to a contact.
  - name: Contacts
    description: >-
      People inside a project, holding the custom field values collected about
      them.
  - name: Messages
    description: Individual messages inside a chat, inbound and outbound.
  - name: Chats
    description: Conversations with a contact over a connected channel.
  - name: Loss reasons
    description: The catalog of reasons a deal can be marked as lost.
  - name: Pipelines
    description: Ordered sets of stages a deal travels through.
  - name: Stages
    description: Steps inside a pipeline, including the built-in open and closed ones.
  - name: Tags
    description: Free-form labels attached to deals.
  - name: Notes
    description: >-
      Free text attached to a contact or a deal, written by a user, an agent, or
      the system.
  - name: Tasks
    description: >-
      Follow-up activities with a due date, attached to a deal and assigned to a
      user.
paths:
  /v1/tasks/{id}:
    get:
      tags:
        - Tasks
      summary: Get a task by id
      description: Answers 404 when the id does not exist or belongs to another project.
      operationId: getTasksById
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            minLength: 1
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  createdAt:
                    type: string
                    format: date-time
                  updatedAt:
                    type: string
                    format: date-time
                  projectId:
                    type: string
                    minLength: 1
                  dealId:
                    type: string
                    minLength: 1
                  title:
                    type: string
                    minLength: 1
                  dueAt:
                    type: string
                    format: date-time
                  responsibleId:
                    type: string
                    minLength: 1
                  result:
                    type: string
                  completedAt:
                    type: string
                    format: date-time
                  completedBy:
                    type: string
                    minLength: 1
                  createdBy:
                    type: string
                    minLength: 1
                  deal:
                    type: object
                    properties:
                      id:
                        type: string
                      createdAt:
                        type: string
                        format: date-time
                      updatedAt:
                        type: string
                        format: date-time
                      projectId:
                        type: string
                        minLength: 1
                      contactId:
                        type: string
                        minLength: 1
                      fields:
                        type: array
                        items:
                          type: object
                          properties:
                            fieldId:
                              type: string
                              minLength: 1
                            value: {}
                          required:
                            - fieldId
                          additionalProperties: false
                          description: Custom field value for this entity
                      agentId:
                        type: string
                        minLength: 1
                      tagIds:
                        type: array
                        items:
                          type: string
                      isTest:
                        type: boolean
                      responsibleId:
                        type: string
                        minLength: 1
                      pipelineId:
                        type: string
                        minLength: 1
                      stageId:
                        type: string
                        minLength: 1
                      lossReasonId:
                        type: string
                        minLength: 1
                      stageEnteredAt:
                        type: string
                        format: date-time
                      closedAt:
                        type: string
                        format: date-time
                      lastLeadMessageAt:
                        type: string
                        format: date-time
                      contact:
                        type: object
                        properties:
                          id:
                            type: string
                          archivedAt:
                            type: string
                            format: date-time
                          createdAt:
                            type: string
                            format: date-time
                          updatedAt:
                            type: string
                            format: date-time
                          avatar:
                            type: string
                            minLength: 1
                          projectId:
                            type: string
                            minLength: 1
                          fields:
                            type: array
                            items:
                              type: object
                              properties:
                                fieldId:
                                  type: string
                                  minLength: 1
                                value: {}
                              required:
                                - fieldId
                              additionalProperties: false
                          isTest:
                            type: boolean
                        required:
                          - id
                          - createdAt
                          - updatedAt
                          - projectId
                        additionalProperties: false
                      chat:
                        type: object
                        properties:
                          unreadMessagesCount:
                            type: number
                          lastMessage:
                            type: object
                            additionalProperties: {}
                          lastLeadMessageTimestamp:
                            type: string
                            format: date-time
                          unreadByChatId:
                            type: object
                            additionalProperties:
                              type: number
                        required:
                          - unreadMessagesCount
                          - unreadByChatId
                        additionalProperties: false
                      nextTask:
                        type: object
                        properties:
                          id:
                            type: string
                            minLength: 1
                          title:
                            type: string
                            minLength: 1
                          dueAt:
                            type: string
                            format: date-time
                        required:
                          - id
                          - title
                          - dueAt
                        additionalProperties: false
                    required:
                      - id
                      - createdAt
                      - updatedAt
                      - projectId
                      - responsibleId
                    additionalProperties: false
                    nullable: true
                required:
                  - id
                  - createdAt
                  - updatedAt
                  - projectId
                  - dealId
                  - title
                  - dueAt
                  - responsibleId
                additionalProperties: false
              example:
                id: 68b8f1c2a4d3e50017b2c9a1
                projectId: 665f1c2e8a94b70012d4e9a1
                dealId: 6715be3a9c40aa0013d8e5c2
                title: Ligar para confirmar a proposta
                dueAt: '2026-09-04T14:00:00.000Z'
                responsibleId: 664d9e0b7c83aa0010f1c2d3
                createdBy: 664d9e0b7c83aa0010f1c2d3
                createdAt: '2026-09-03T12:00:00.000Z'
                updatedAt: '2026-09-03T12:00:00.000Z'
        '401':
          description: Missing or invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - apiKey: []
components:
  schemas:
    Error:
      type: object
      required:
        - errorCode
        - message
        - status
      properties:
        errorCode:
          type: string
        message:
          type: string
        status:
          type: integer
        errors:
          type: array
          items:
            type: object
            required:
              - field
              - code
              - message
            properties:
              field:
                type: string
              code:
                type: string
              message:
                type: string
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key

````