# Create task dependency

`POST /api/task/{taskId}/depends-on/{predecessorTaskId}`

URL: https://repsona.com/api/post-task-taskid-depends-on-predecessortaskid

Creates a predecessor dependency between two tasks.

## Parameters

| name | in | type | required | description |
| --- | --- | --- | --- | --- |
| `taskId` | path | integer | required | ID of the task. |
| `predecessorTaskId` | path | integer | required | ID of the task that must be finished first (the predecessor). |

## Request

```sh
curl -X POST "https://<space>.repsona.com/api/task/{taskId}/depends-on/{predecessorTaskId}" \
  -H "Authorization: Bearer $REPSONA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

## Responses

- 200: Dependency created or already existed
- 400: Invalid identifiers or self dependency
- 401: Authentication is required
- 404: Task not found

## Example response

```json
{
  "id": 27,
  "taskId": 100448,
  "predecessorTaskId": 100449,
  "updatedAt": 1793662651314
}
```
