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

# Change trip document type

> Change the document type of a file already attached to a trip, for example filing a driver upload that arrived as Unclassified.

Change the type Alvys files a **trip** document under. This is the endpoint to use when a driver uploads paperwork that arrives without a real type (it lands as `Unclassified`) and something downstream — a person or a workflow that classifies the file — needs to write the right type back.

The document keeps its id, its file and its download link. Only the type changes, and the change is recorded in the trip's document history.

### Request Parameters

| Parameter  | In   | Type   | Required | Description                                               |
| ---------- | ---- | ------ | -------- | --------------------------------------------------------- |
| version    | path | String | Yes      | API version to use.                                       |
| tripId     | path | String | Yes      | Unique identifier of the trip.                            |
| documentId | path | String | Yes      | `id` of the document, as returned by List trip documents. |

### Request Body

| Name         | Type   | Required | Description                                                                                                                |
| ------------ | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------- |
| DocumentType | string | Yes      | The type to set. Must be one of the allowed types below. Matched without case sensitivity and stored in Alvys' own casing. |

### Allowed document types

* Proof of Delivery
* Bill of Lading
* Carrier Rate Confirmation
* Load Manifest
* Trip Report
* Temp. Log
* Proof of Pickup
* Scale Ticket
* Notice of Assignment
* NOA
* Shipping Labels
* Receipt

Anything outside this list returns `400`. The list is the same one [Upload trip document](/en/api/reference/trips/upload-trip-document) accepts, so you cannot reach a type by changing a document that you could not have uploaded in the first place.

Driver photo types such as Seal, Trailer Photo, Load Securement and Temperature Settings are **not** on the list, so a document cannot be filed under those through the API.

### Documents that cannot be changed

A Carrier Invoice is refused with `422`. The carrier invoice number and payment terms are held on the document itself, and changing its type would discard them.

### Trips that share a load

A load can have several trips, and [List trip documents](/en/api/reference/trips/list-trip-documents) can return a document that belongs to one of the sibling trips. Changing one of those returns `409`, naming the trip that owns it — re-send the request against that trip.

A document on another load returns `404`.

### Example cURL Request

```bash theme={null}
curl --location --request PATCH 'https://integrations.alvys.com/api/p/v{version}/trips/{tripId}/documents/{documentId}' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
  "DocumentType": "Proof of Delivery"
}'
```

### Example Response (200 OK)

The updated document.

```json theme={null}
{
  "id": "8c1fbd2f-f37c-4701-bb20-3582d853e536",
  "AttachmentPath": "scan-1759237626.pdf",
  "AttachmentType": "Proof of Delivery",
  "AttachmentSize": 342115,
  "UploadedAt": "2025-09-30T14:02:07+00:00",
  "ParentId": "3022258",
  "ParentType": "Trip",
  "UploadedBy": "7190175eecc1101e11d1111f1e1e0e11"
}
```

### Errors

| Status | Meaning                                                                                       |
| ------ | --------------------------------------------------------------------------------------------- |
| `400`  | `DocumentType` is missing, unrecognised, or not allowed on a trip.                            |
| `404`  | The trip or the document does not exist, is deleted, or the document belongs to another load. |
| `409`  | The document belongs to a sibling trip on the same load. The response names that trip.        |
| `422`  | The document is a Carrier Invoice and cannot be changed.                                      |

### Repeat calls

Calling this endpoint again is **not** free. Each call re-runs the change, and setting a document to Proof of Delivery sends it to the customer's visibility integration every time. Call it once per classification, and only when the type is actually changing.

***

### Rate Limits

All endpoints are subject to rate limits to protect the API from traffic spikes.
For detailed information, see the [Rate Limits](/en/api/guides/rate-limits) section.

***

### Try It Out

This page is interactive, allowing you to try a request by specifying the **API version**, **tripId** and **documentId** in the URL path.

⚠️ Don't forget: make sure to **authorize yourself** before trying a request.


## OpenAPI

````yaml PATCH /api/p/v{version}/trips/{tripId}/documents/{documentId}
openapi: 3.0.1
info:
  title: Alvys
  description: >-
    Alvys provides a robust set of REST APIs to allow you to integrate Alvys
    into virtually any platform. These APIs cover most of Alvys' major product
    areas with additional endpoints being added regularly based on customer
    requests.
  contact:
    name: Alvys Support
    url: https://www.alvys.com/resources/contact/
  version: v1
servers:
  - url: https://integrations.alvys.com
    description: Public API Server
  - url: https://api.alvys.com/
    description: Public API Server
security:
  - Public: []
tags:
  - name: Authentication
    description: Obtain an OAuth 2.0 access token for the Alvys Public API.
  - name: Carrier Settlement Statements
    description: >-
      Search carrier settlement statements and retrieve a single statement by
      number.
  - name: Carriers
    description: Read carrier records, search carriers, and manage carrier documents.
  - name: Customers
    description: Create, read, update, delete, and search customer records.
  - name: Deductions
    description: >-
      Create one-time deductions and search or delete existing deduction
      records.
  - name: DispatchPreferences
    description: Dispatch preferences endpoints for reading dispatch rules and preferences.
  - name: Driver Settlement Statements
    description: >-
      Search driver settlement statements and retrieve a single statement by
      number.
  - name: Drivers
    description: >-
      Read driver records, search drivers and driver events, and manage driver
      documents.
  - name: Fuel
    description: Read and search fuel transactions.
  - name: Invoices
    description: >-
      Read invoices, create carrier invoices, and record carrier and customer
      payments.
  - name: Loads
    description: Read, update, search loads, and manage load documents and notes.
  - name: Locations
    description: Read and search company location details.
  - name: Maintenance
    description: Read and search maintenance records.
  - name: Subsidiaries
    description: >-
      List your company's subsidiaries and read a single subsidiary, so an
      integration can resolve a subsidiary id to a recognizable name.
  - name: Tenders
    description: Create, accept, reject, cancel, update, and search inbound EDI tenders.
  - name: Tolls
    description: Read and search toll transactions.
  - name: Tracking
    description: >-
      Record an asset's current location or telemetry from a third-party source,
      such as an external ELD or a self-reporting vehicle.
  - name: Trailers
    description: Read trailers, search trailer events, and manage trailer documents.
  - name: Trips
    description: >-
      Read, search trips, manage trip documents, and record stop appointments,
      arrivals, and departures.
  - name: Trucks
    description: Read trucks, search truck events, and manage truck documents.
  - name: Users
    description: List and search users.
  - name: Visibility
    description: >-
      Read inbound and outbound visibility history and search outbound
      visibility errors.
  - name: Webhooks
    description: >-
      Create, read, update, delete, enable, disable, verify, test, and rotate
      secrets for webhook subscriptions; read event types, delivery logs, and
      health metrics.
  - name: Accessorials
  - name: Credits
paths:
  /api/p/v{version}/trips/{tripId}/documents/{documentId}:
    patch:
      tags:
        - Trips
      summary: Change trip document type
      description: >-
        Change the document type of a file already attached to a trip. Use it to
        file a document that was uploaded without a type, for example a driver
        upload that arrived as Unclassified.

        Allowed document types: Proof of Delivery, Bill of Lading, Carrier Rate
        Confirmation, Load Manifest, Trip Report, Temp. Log, Proof of Pickup,
        Scale Ticket, Notice of Assignment, NOA, Shipping Labels, Receipt.

        Carrier Invoice documents cannot be changed.
      parameters:
        - name: tripId
          in: path
          required: true
          schema:
            type: string
        - name: documentId
          in: path
          required: true
          schema:
            type: string
        - name: version
          in: path
          description: API version (e.g., 1.0)
          required: true
          schema:
            type: string
            default: '1.0'
            example: '1.0'
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/Alvys.Models.Documents.DocumentTypeChangeRequest
          text/json:
            schema:
              $ref: >-
                #/components/schemas/Alvys.Models.Documents.DocumentTypeChangeRequest
          application/*+json:
            schema:
              $ref: >-
                #/components/schemas/Alvys.Models.Documents.DocumentTypeChangeRequest
          application/json-patch+json:
            schema:
              $ref: >-
                #/components/schemas/Alvys.Models.Documents.DocumentTypeChangeRequest
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Alvys.Models.PublicAPI.AttachmentResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Microsoft.AspNetCore.Mvc.ValidationProblemDetails
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
        '422':
          description: Unprocessable Content
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
      security:
        - Public: []
components:
  schemas:
    Alvys.Models.Documents.DocumentTypeChangeRequest:
      required:
        - DocumentType
      type: object
      properties:
        DocumentType:
          minLength: 1
          type: string
          description: >-
            The document type to set. Must be one the endpoint's parent accepts,
            spelled exactly as listed in the endpoint description. Matched
            without case sensitivity and stored in Alvys' own casing.
      additionalProperties: false
    Alvys.Models.PublicAPI.AttachmentResponse:
      required:
        - AttachmentPath
        - AttachmentType
        - id
        - ParentId
        - ParentType
      type: object
      properties:
        id:
          type: string
        AttachmentPath:
          type: string
        AttachmentType:
          type: string
        AttachmentSize:
          type: integer
          format: int64
          nullable: true
        UploadedAt:
          type: string
          format: date-time
          nullable: true
        ParentId:
          type: string
        ParentType:
          type: string
        UploadedBy:
          type: string
          nullable: true
        DownloadUrl:
          type: string
          nullable: true
        ExpiresAt:
          type: string
          format: date-time
          nullable: true
      additionalProperties: false
    Microsoft.AspNetCore.Mvc.ValidationProblemDetails:
      required:
        - Errors
      type: object
      properties:
        Errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
        Type:
          type: string
          nullable: true
        Title:
          type: string
          nullable: true
        Status:
          type: integer
          format: int32
          nullable: true
        Detail:
          type: string
          nullable: true
        Instance:
          type: string
          nullable: true
      additionalProperties: {}
    Microsoft.AspNetCore.Mvc.ProblemDetails:
      type: object
      properties:
        Type:
          type: string
          nullable: true
        Title:
          type: string
          nullable: true
        Status:
          type: integer
          format: int32
          nullable: true
        Detail:
          type: string
          nullable: true
        Instance:
          type: string
          nullable: true
      additionalProperties: {}
  securitySchemes:
    Public:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        OAuth 2.0 client-credentials access token. Obtain one from
        https://auth.alvys.com/oauth/token (grant_type=client_credentials,
        audience=https://api.alvys.com/public/), then paste it here. The
        playground sends it as `Authorization: Bearer <token>`.

````