Start Task #

Initiates a new task on the PDF tools website.

Endpoint #

GET https://trupdf.com/api/v1/start-task

Parameters #

  • task (required): Specifies the type of task to be performed. Example: merge-pdf

Response #

Upon successful initiation of the task, the server returns a JSON response with the following fields:

  • status: Indicates whether the task initiation was successful (true) or not (false).
  • processId: Unique identifier for the initiated task. This processId will be used in subsequent steps to reference the task.

Example using cURL: #

curl -X GET \
  'https://trupdf.com/api/v1/start-task?task=merge-pdf' \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H 'Content-Type: application/json'

Example using PHP: #

use GuzzleHttp\Client;

$client = new Client();
$token = 'YOUR_API_TOKEN';

$response = $client->get('https://trupdf.com/api/v1/start-task', [
    'headers' => [
        'Authorization' => 'Bearer ' . $token,
        'Content-Type' => 'application/json',
    ],
    'query' => [
        'task' => 'merge-pdf',
    ],
]);

$data = json_decode($response->getBody(), true);

Example Response: #

{
  "status": true,
  "processId": "xYNNUCkqVVWEDsxXOLGZxCbz9ggreeNAOMErSl8wRw1WDsiZbnvECaGV6AwdtUtaYLA2PrI9WuPCGOqdiJcfp2d6d0b9p0gnbePz"
}

Error Responses

  • If the task parameter is missing or invalid, the server responds with an appropriate error message.
  • If there is an internal server error or any other issue, the server responds with an error message indicating the failure.

Notes

  • The processId returned in the response will be used in subsequent steps of the PDF processing workflow.
  • Ensure that the processId is saved or stored appropriately for later use in the execution and download steps.

This step initializes the PDF processing task and provides a unique identifier for tracking the task throughout its lifecycle.