# Complete a journey

> Mark a journey as completed once the traveller has been dropped off.

Section: Transfer companies · Last updated: 2026-11-15

You will mark a journey as completed after the drop-off, which closes it and makes it count towards
your payout. You need an API key and a journey assigned to your company whose pickup time has passed.

## Step 1: Complete the journey

When the traveller has been dropped off at the hotel, send the drop-off position:

**Request:** [`PUT /journeys/488213/complete`](https://developers.test.transferz.com/reference/transfer-companies/complete-journey)

```bash title="cURL"
curl --request PUT \
  --url 'https://warpdrive.staging.transferz.com/transfercompanies/journeys/488213/complete' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: YOUR_STAGING_API_KEY' \
  --data '{
  "latitude": 52.3738,
  "longitude": 4.8862,
  "recordedAt": "2026-12-01T14:28:00"
}'
```

```javascript title="JavaScript"
const response = await fetch("https://warpdrive.staging.transferz.com/transfercompanies/journeys/488213/complete", {
  method: "PUT",
  headers: {
    Accept: "application/json",
    "Content-Type": "application/json",
    "X-API-Key": "YOUR_STAGING_API_KEY",
  },
  body: JSON.stringify({
    "latitude": 52.3738,
    "longitude": 4.8862,
    "recordedAt": "2026-12-01T14:28:00"
  }),
});

const data = await response.json();
console.log(response.status, data);
```

```java title="Java"
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Example {
  public static void main(String[] args) throws Exception {
    String body = """
        {
          "latitude": 52.3738,
          "longitude": 4.8862,
          "recordedAt": "2026-12-01T14:28:00"
        }
        """;

    HttpRequest request = HttpRequest.newBuilder()
        .uri(URI.create("https://warpdrive.staging.transferz.com/transfercompanies/journeys/488213/complete"))
        .header("Accept", "application/json")
        .header("Content-Type", "application/json")
        .header("X-API-Key", "YOUR_STAGING_API_KEY")
        .method("PUT", HttpRequest.BodyPublishers.ofString(body))
        .build();

    HttpResponse<String> response = HttpClient.newHttpClient()
        .send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(response.statusCode());
    System.out.println(response.body());
  }
}
```

```csharp title="C#"
using System.Net.Http;
using System.Text;

using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Put, "https://warpdrive.staging.transferz.com/transfercompanies/journeys/488213/complete");
request.Headers.TryAddWithoutValidation("Accept", "application/json");
request.Headers.TryAddWithoutValidation("X-API-Key", "YOUR_STAGING_API_KEY");

var json = """
    {
      "latitude": 52.3738,
      "longitude": 4.8862,
      "recordedAt": "2026-12-01T14:28:00"
    }
    """;
request.Content = new StringContent(json, Encoding.UTF8, "application/json");

using var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
```

```php title="PHP"
<?php

$body = <<<'JSON'
{
  "latitude": 52.3738,
  "longitude": 4.8862,
  "recordedAt": "2026-12-01T14:28:00"
}
JSON;

$ch = curl_init('https://warpdrive.staging.transferz.com/transfercompanies/journeys/488213/complete');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Accept: application/json',
        'Content-Type: application/json',
        'X-API-Key: YOUR_STAGING_API_KEY',
    ],
    CURLOPT_POSTFIELDS => $body,
]);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);

echo $status, PHP_EOL, $response, PHP_EOL;
```

**Response (204):**

```http
HTTP/1.1 204 No Content
```

`recordedAt` is the moment of the drop-off, in UTC; leave it out to use the time of the request. The
body is optional, but send the position.

## Step 2: Check the result

You and the partner receive [`journeyStatusChangedEvent`](https://developers.test.transferz.com/reference/webhooks/journey-status-changed):

```json
{
  "journeyStatusChangedEvent": {
    "created": "2026-12-01T14:28:03.114",
    "journeyId": 488213,
    "previousStatus": "JOURNEY_IN_PROGRESS",
    "newStatus": "COMPLETED"
  }
}
```

`COMPLETED` is final. Stop sending positions and status updates for this journey.

## Rules worth knowing

- **Not before the pickup time.** A journey cannot be completed while its pickup time is still in the
  future.
- **Completing twice is harmless.** If the journey is already `COMPLETED`, the call returns `204` and
  changes nothing. This also covers the case where Transferz completed the journey itself from the
  driver's position near the drop-off (see
  [Report journey progress](https://developers.test.transferz.com/guides/transfer-companies/report-journey-progress#rules-worth-knowing)).
- **A no-show still needs completing.** Reporting a traveller no-show through the API does not change
  the journey's status. Report it, then complete the journey; see
  [Report a no-show or a delay](https://developers.test.transferz.com/guides/transfer-companies/report-a-no-show-or-delay).
- **Cancelled journeys cannot be completed.**

## Errors

| Status | Code                                                                                                                                            | Cause                                                                  | What to do                                                                                                                                 |
| ------ | ----------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `400`  | [COMPLETE_JOURNEY_NOT_ALLOWED_BEFORE_PICKUP](https://developers.test.transferz.com/reference/errors/complete-journey-not-allowed-before-pickup) | The pickup time is still in the future.                                | Complete the journey after it has taken place.                                                                                             |
| `400`  | [STATUS_TRANSITION_NOT_ALLOWED](https://developers.test.transferz.com/reference/errors/status-transition-not-allowed)                           | The journey was cancelled.                                             | Do not complete it; check the status with [Get a journey](https://developers.test.transferz.com/reference/transfer-companies/get-journey). |
| `400`  | —                                                                                                                                               | `latitude` or `longitude` is missing from a body you sent.             | Send both, or no body.                                                                                                                     |
| `403`  | `INSUFFICIENT_PERMISSIONS`                                                                                                                      | The journey is not assigned to your company, or the id does not exist. | Check the id.                                                                                                                              |
| `401`  | —                                                                                                                                               | The API key is missing, wrong or expired.                              | See [Authentication](https://developers.test.transferz.com/guides/get-started/authentication).                                             |

The error format is described in [Errors](https://developers.test.transferz.com/guides/essentials/errors).

## Related

### Endpoints

- [PUT Complete journey](https://developers.test.transferz.com/reference/transfer-companies/complete-journey) (`PUT /journeys/{id}/complete`)

### Walk-through steps

- [Complete the journey](https://developers.test.transferz.com/walkthrough/transfer-company/complete-the-journey)
