---
agentTools:
  projectIndex: https://uspacy.readme.io/llms.txt
---

# Get task by id

Get task by id

# OpenAPI definition

````json
{
  "openapi": "3.1.0",
  "info": {
    "description": "This is [Uspacy](https://uspacy.com)  API documentation. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\nor on [irc.freenode.net, #swagger](http://swagger.io/irc/).\n\n# Introduction\nTo use this API you need to get Bearer token. To get Bearer token you have two options:\n  - sign in on user's Uspacy using email and password\n  - create Marketplace application and get token in callback after your application was installed by user\n\n# SDKs and boilerplates\nWe provide SDKs for different languages to simplify integration with Uspacy API. You can find them on [Uspacy GitHub](https://github.com/Uspacy/)\nWe have also prepared a few boilerplates to help you start developing your application\n  - [Uspacy Marketplace application boilerplate](https://github.com/Uspacy/app-laravel-template) - Laravel application with Uspacy authentication and token refreshment\n  - [Uspacy Golang SDK](https://github.com/Uspacy/uspacy-go-sdk) – Golang SDK for Uspacy API, in active development\n  - [Uspacy TypeScript SDK](https://github.com/Uspacy/uspacy-sdk) – TypeScript SDK for Uspacy API, deprecated\n\n# Marketplace applications development\nTo develop Marketplace application you need to create an application in Uspacy Marketplace. You can do it via request to [Uspacy support](mailto:support@uspacy.com).\nYou will receive ```client_id``` and ```client_secret``` for your application. You will also need to provide ```callback_url``` for your application.\nAfter that, the install/uninstall endpoints for your applications should be implemented. Please note that the path for these endpoints should follow this format:\n```{{callback_url}}/portals/install``` and ```{{callback_url}}/portals/uninstall```, respectively.\nFor example, if your ```callback_url``` is ```https://google.com/handler/v1```, we will send webhook to ```https://google.com/handler/v1/portals/install``` on install and ```https://google.com/handler/v1/portals/uninstall``` on uninstall.\nAfter a user installs your application, you will receive a POST request with JSON in the callback.\nThis will contain the ```token```, ```refresh_token```, and ```expiry_date``` fields.\nAdditionally, the ```integration_token``` will be provided as a Bearer token in the Authorization header.\nIt is signed using the ```client_secret``` and the SHA-256 algorithm. All future requests from your application's frontend to its backend should be secured with the ```integration_token```.\nThe ```integration_token``` is accessible through using the [appService](#tag/appService) for users with administrative rights.\nExample of request:\n```json\n{\n  \"expiry_date\": 1683649235,\n  \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjEyMzEyMzEyMyIsImZpcnN0TmFtZSI6IlN0YXMiLCJsYXN0TmFtZSI6IlJhcmFuZXRza3lpIiwiZW1haWwiOiJyYXIuc3Rhc0BnbWFpbC5jb20iLCJyb2xlcyI6WyJVU0VSIiwiQURNSU4iLCJPV05FUiJdfQ.au16u5LHJqdvhiPrpXDhN4NZn8Cae09I6BEmed7mt8w\",\n  \"refresh_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjEyMzEyMzEyMyIsImZpcnN0TmFtZSI6IlN0YXMiLCJsYXN0TmFtZSI6IlJhcmFuZXRza3lpIiwiZW1haWwiOiJyYXIuc3Rhc0BnbWFpbC5jb20iLCJyb2xlcyI6WyJVU0VSIiwiQURNSU4iLCJPV05FUiJdfQ.au16u5LHJqdvhiPrpXDhN4NZn8Cae09I6BEmed7mt8w\"\n}\n```\nYou need to save ```token```, ```refresh_token``` and ```expiry_date```  in your database. You will need to use ```token``` to make requests to Uspacy API. ```refresh_token``` is used to refresh ```token``` when it expires.\nYou should refresh the ```token``` before it expires. To do this, make a POST request to ```https://{domain}/auth/v1/auth/refresh_token/``` with the ```refresh_token``` in the body. The ```domain``` refers to the portal's domain that you received from the user's token headers upon application installation.\nYou will receive new ```jwt```, ```refreshToken``` and ```expireInSeconds``` in response. You need to save new ```token```, ```refresh_token``` and update ```expiry_date``` in your database.\n",
    "title": "Uspacy api",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://{domain}.uspacy.ua",
      "description": "Ukrainian server"
    },
    {
      "url": "https://{domain}.uspacy.eu",
      "description": "EU server"
    },
    {
      "url": "https://{domain}.uspacy.com.br",
      "description": "Brazilian server"
    },
    {
      "url": "https://{domain}.uspacy.com",
      "description": "International server"
    }
  ],
  "tags": [
    {
      "name": "tasksService"
    }
  ],
  "paths": {
    "/tasks/v1/tasks/{taskId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/taskId"
        }
      ],
      "get": {
        "summary": "Get task by id",
        "description": "Get task by id",
        "tags": [
          "tasksService"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    },
    "responses": {
      "UnauthorizedError": {
        "description": "Access token is missing or invalid"
      }
    },
    "parameters": {
      "taskId": {
        "name": "taskId",
        "in": "path",
        "description": "Task id",
        "required": true,
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "Date": {
        "type": "number",
        "description": "timestamp in seconds",
        "default": 0,
        "example": 1654180120
      },
      "Task": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "5"
          },
          "parentId": {
            "type": "string",
            "example": "2"
          },
          "title": {
            "type": "string",
            "example": "Describe swagger api for tasksService"
          },
          "deadline": {
            "$ref": "#/components/schemas/Date"
          },
          "closedDate": {
            "$ref": "#/components/schemas/Date"
          },
          "createdBy": {
            "type": "string",
            "example": "1"
          },
          "closedBy": {
            "type": "string",
            "example": "1"
          },
          "createdDate": {
            "$ref": "#/components/schemas/Date"
          },
          "responsibleId": {
            "description": "ID of responsible person",
            "type": "string",
            "example": "1"
          },
          "body": {
            "type": "string",
            "example": "<b>need use swagger-ui@4.x</b>"
          },
          "status": {
            "$ref": "#/components/schemas/TaskStatus"
          },
          "kanbanStageId": {
            "type": "string",
            "example": "2"
          },
          "priority": {
            "$ref": "#/components/schemas/TaskPriority"
          },
          "acceptResult": {
            "type": "boolean",
            "default": false,
            "example": true
          },
          "requiredResult": {
            "type": "boolean",
            "default": false,
            "example": true
          },
          "resultCommentId": {
            "type": "string",
            "example": "1"
          },
          "departmentId": {
            "description": "Department ID",
            "type": "string",
            "example": "1"
          },
          "groupId": {
            "description": "Group ID",
            "type": "string",
            "example": "1"
          },
          "setterId": {
            "type": "string",
            "example": "1"
          },
          "timeTracking": {
            "type": "boolean"
          },
          "timeEstimate": {
            "$ref": "#/components/schemas/Date"
          },
          "template": {
            "type": "boolean"
          },
          "templateId": {
            "type": "string",
            "example": "2"
          },
          "delegation": {
            "type": "integer"
          },
          "taskType": {
            "type": "string",
            "example": "task"
          },
          "basicTask": {
            "type": "boolean"
          },
          "files": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FileInfoDto"
            }
          }
        }
      },
      "TaskStatus": {
        "type": "string",
        "enum": [
          "notScheduled",
          "scheduled",
          "inWork",
          "stopped",
          "inControl",
          "ready"
        ]
      },
      "TaskPriority": {
        "type": "string",
        "enum": [
          "low",
          "notHigh",
          "neutral",
          "high",
          "veryHigh"
        ]
      },
      "EntityTypes": {
        "type": "string",
        "enum": [
          "comment",
          "post",
          "task"
        ]
      },
      "FileInfoDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "example": 1
          },
          "entityType": {
            "allOf": [
              {
                "$ref": "#/components/schemas/EntityTypes"
              },
              {
                "example": "post"
              }
            ]
          },
          "entityId": {
            "type": "integer",
            "format": "int64",
            "example": 1
          },
          "uploadId": {
            "type": "string",
            "format": "uuid",
            "example": "369c4620-adee-4526-a0d8-a1db20bcf5b2"
          },
          "originalFilename": {
            "type": "string",
            "example": "sample.jpg"
          },
          "lastModified": {
            "type": "integer",
            "format": "int64",
            "example": 1664629542
          },
          "size": {
            "type": "integer",
            "format": "int64",
            "example": 123456
          },
          "url": {
            "type": "string",
            "example": "https://aws.s3.amazonaws.com/my-bucket/61/dd/61ddc0045c05ba7537b63e63184b9203.jpg"
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 101,
      "1": 36,
      "2": 32,
      "3": 193,
      "4": 231,
      "5": 38,
      "6": 198,
      "7": 0,
      "8": 19,
      "9": 99,
      "10": 232,
      "11": 3
    }
  }
}
````