> ## 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.

# Upload maintenance document

> Attach one file, such as a repair invoice, to a maintenance record in Alvys. The file lists on the record's Documents tab with files added in the app.

The Upload Maintenance Document endpoint attaches one file to a **maintenance record**, for example the repair invoice. The file is stored with the files users attach in Alvys and lists on the record's **Documents** tab. For more information on how versioning works and how to include it in your requests, please refer to the [Versioning](https://docs.alvys.com/en/api/guides/versioning.md) page.

> [!NOTE]
>
> This endpoint requires the `maintenance:update` scope. See [Authentication](https://docs.alvys.com/en/api/guides/authentication-1.md).

* **Content type:** `multipart/form-data`. Each request must contain exactly one file.
* **Max file size:** 25 MB
* **Allowed MIME types:** `application/pdf`, `image/jpeg`, `image/png`, `image/gif`

Maintenance files carry no document type, so this form has no `DocumentType` field.

***

### Request parameters

The following parameters are required in the URL path:

| Parameter | Type | Required | Description |
| - | - | - | - |
| version | String | Yes | The version of the API. |
| id | String | Yes | The unique identifier of the maintenance record. |

***

### Request body

`multipart/form-data`

| Field | Type | Required | Description |
| - | - | - | - |
| `File` | binary | Yes | The file to upload (PDF, JPEG, PNG, or GIF). Max size 25 MB. |
| `FileName` | string | No | The name to store the file under. If you omit it, the name of the uploaded file is used. If the name does not end in an extension of the file's MIME type, that extension is added. |

***

### Example cURL request

```bash theme={null}
curl -X POST 'https://integrations.alvys.com/api/p/v1/maintenance/{id}/document' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -F 'File=@repair-invoice.pdf;type=application/pdf' \
  -F 'FileName=repair-invoice.pdf'
```

Replace `{id}` with the maintenance record ID and `YOUR_ACCESS_TOKEN` with your actual Bearer token.

***

### Response fields

| Field | Type | Description |
| - | - | - |
| `id` | String | The id of the file on the maintenance record. |
| `FileName` | String | The file name with its extension, as the record's **Documents** tab shows it. |
| `AttachmentSize` | Integer | The file size in bytes. |
| `UploadedAt` | String (Date-Time) | The date and time the file was uploaded. |
| `ParentId` | String | The id of the maintenance record the file is attached to. |

***

### Example response

**200 OK**

```json theme={null}
{
  "id": "f91c0b66-0000-0000-0000-000000000417",
  "FileName": "repair-invoice.pdf",
  "AttachmentSize": 1048576,
  "UploadedAt": "2026-11-13T15:04:05.000Z",
  "ParentId": "4b0e6a52-0000-0000-0000-000000000417"
}
```

***

### Status codes

| Status | Meaning |
| - | - |
| 200 | The file was attached to the maintenance record. |
| 400 | The form failed validation: the file is missing, it has no file name, or its MIME type is not allowed. |
| 401 | The request was not authenticated. |
| 403 | The caller lacks the `maintenance:update` scope. |
| 404 | No maintenance record with the given `id` exists, or the record's truck or trailer is outside the subsidiaries your credential can access. |
| 413 | The file is larger than 25 MB. |
| 415 | The request is not `multipart/form-data`. |
| 429 | The rate limit was exceeded. |

***

### Rate limits

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

This page is interactive, allowing you to try a request by specifying the **API version** and the maintenance record **id** in the URL path. As you fill out the parameters, the cURL command on the right side of the page will be automatically updated.


## OpenAPI

````yaml POST /api/p/v{version}/maintenance/{id}/document
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, and search loads; manage load documents, notes, and custom
      references.
  - name: Locations
    description: Read and search company location details.
  - name: Maintenance
    description: Read and search maintenance records.
  - name: References
    description: >-
      List tenant custom reference definitions and create or update values on
      existing loads, stops, and trips.
  - 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 and search trips; manage trip documents, stop appointments, arrivals,
      departures, and stop and trip custom references.
  - 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}/maintenance/{id}/document:
    post:
      tags:
        - Maintenance
      summary: Upload maintenance document
      description: |-
        Upload multipart/form-data. One file per request. Max file size 25 MB.
        Allowed MIME types: application/pdf, image/jpeg, image/png, image/gif.
      parameters:
        - name: id
          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:
          multipart/form-data:
            schema:
              $ref: >-
                #/components/schemas/Alvys.Models.Maintenance.MaintenanceDocumentUploadRequest
            encoding:
              File:
                allowReserved: true
              FileName:
                allowReserved: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Alvys.Models.Maintenance.MaintenanceDocumentResponse
        '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'
        '413':
          description: Content Too Large
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
        '415':
          description: Unsupported Media Type
          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.Maintenance.MaintenanceDocumentUploadRequest:
      required:
        - File
      type: object
      properties:
        File:
          type: string
          format: binary
        FileName:
          type: string
          nullable: true
      additionalProperties: false
    Alvys.Models.Maintenance.MaintenanceDocumentResponse:
      required:
        - AttachmentSize
        - FileName
        - id
        - ParentId
        - UploadedAt
      type: object
      properties:
        id:
          type: string
          description: The file's id on the maintenance record.
        FileName:
          type: string
          description: File name with extension, as the record's Documents tab shows it.
        AttachmentSize:
          type: integer
          description: File size in bytes.
          format: int64
        UploadedAt:
          type: string
          format: date-time
        ParentId:
          type: string
          description: The maintenance record the file is attached to.
      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>`.

````