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

# Create one-time deduction

> Create a one-time driver deduction that applies to a single upcoming settlement, specifying the driver, amount, deduction type, and effective date.

This endpoint creates a new deduction record for a driver or a truck.
Deductions are asset-specific financial adjustments and can be associated with either a driver or a truck, but not both simultaneously.
The deduction itself is always tied to a specific asset (Driver or Truck) and can optionally reference an owner operator for ownership context.

#### Key Rules:

* A deduction must include **either `DriverId` or `TruckId`** — one of them is mandatory.
* **`OwnerOperatorId`** is optional and used only to override the current owner of the asset. It is never the primary subject of the deduction.
* The deduction is always created for a specific **DriverId** or **TruckId**, not directly for an owner operator.
* If **DriverId** is provided → the deduction appears in that driver’s deductions table.
* If **TruckId** is provided → the deduction appears in that truck’s deductions table.
* If **OwnerOperatorId** is provided → it overrides the current owner of the asset to that specific owner operator (only within this deduction record). If omitted → the system automatically links the deduction to the current owner operator, if one exists.
* If the truck or driver has no owner operator → the deduction is created without one.

### Permissions Required

Only users or client credentials with **Create access** to the **Deductions** resource can perform creation.
If the API client lacks sufficient privileges, a `403 Forbidden` response will be returned.

***

### Request Body Parameters

| Parameter       | Type          | Required      | Description                                                                              |
| --------------- | ------------- | ------------- | ---------------------------------------------------------------------------------------- |
| Date            | String (Date) | Yes           | The effective date of the deduction. Time values are accepted but truncated on save.     |
| Amount          | Number        | Yes           | The deduction amount. Must be **negative** and have a value of less than  **- 1.00**.    |
| Category        | String        | Yes           | Deduction category (any string value).                                                   |
| Description     | String        | Yes           | Description or reason for the deduction.                                                 |
| DriverId        | String        | Conditionally | Required when creating a deduction for a driver. Must not be used together with TruckId. |
| TruckId         | String        | Conditionally | Required when creating a deduction for a truck. Must not be used together with DriverId. |
| OwnerOperatorId | String        | No            | Optional — used only to override the current owner of the asset (Driver or Truck).       |

### Example CURL Request

```bash theme={null}
curl --location 'https://integrations.alvys.com/api/p/v1/deductions/once' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
  "Date": "2025-10-07",
  "Amount": -55,
  "Category": "Drug Test",
  "Description": "DOT Drug Test Fee",
  "DriverId": "DR2517534557938191",
  "OwnerOperatorId": "DR25165000003445290"
}'
```

### Response Body Parameters

| Parameter       | Type               | Required      | Description                                                      |
| --------------- | ------------------ | ------------- | ---------------------------------------------------------------- |
| Id              | String             | Yes           | The unique identifier of the created deduction.                  |
| Type            | String             | Yes           | Type of record (`"Deduction"`).                                  |
| GroupId         | String             | No            | Group ID if part of a recurring rule or batch.                   |
| Description     | String             | Yes           | Description of the deduction.                                    |
| Category        | String             | Yes           | Deduction category (e.g., Fuel, Advance, Drug Test).             |
| Amount.Amount   | Number             | Yes           | Deduction amount (negative value).                               |
| Amount.Currency | Integer            | Yes           | ISO numeric currency code (e.g., 840 for USD).                   |
| DriverId        | String             | Conditionally | The Driver ID if the deduction was created for a driver.         |
| TruckId         | String             | Conditionally | The Truck ID if the deduction was created for a truck.           |
| OwnerOperatorId | String             | No            | The Owner Operator ID of the truck or driver (if applicable).    |
| Date            | String (Date)      | Yes           | The effective date of the deduction (date only, without time).   |
| IsPaid          | Boolean            | No            | Indicates whether the deduction has been paid. Default: `false`. |
| CreatedAt       | String (Date-Time) | Yes           | Timestamp when the deduction was created (UTC).                  |
| CreatedBy       | String             | No            | Client ID or User ID of the person who created the deduction.    |

***

### Example Response

```json theme={null}
{
  "Id": "22d34b6d-7403-4003-b8ea-e028cd36e7d7",
  "Type": "Deduction",
  "GroupId": "344571de-57b4-4163-a0cc-d7981fa65994",
  "Description": "DOT Drug Test Fee",
  "Category": "Drug Test",
  "Amount": {
    "Amount": -55,
    "Currency": 840
  },
  "DriverId": "DR2517534557938191",
  "OwnerOperatorId": "DR25165000003445290",
  "Date": "2025-10-07",
  "IsPaid": false,
  "CreatedAt": "2025-10-09T08:30:54.873Z",
  "CreatedBy": "MhAeSgpRH6REdgfrthgfUdTdXOMgVSGyp"
}
```

### Versioning

The `version` parameter in the URL path specifies which version of the API you are using.
Including the version number ensures that your integration remains stable as the API evolves.
For more details, refer to the [Versioning](/docs/versioning) page.

***

### Rate Limits

All endpoints are subject to standard rate limits to ensure consistent API performance.
For details, see the [Rate Limits](/docs/rate-limits) section.


## OpenAPI

````yaml POST /api/p/v{version}/deductions/once
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: Tenders
    description: Create, accept, reject, cancel, update, and search inbound EDI tenders.
  - name: Tolls
    description: Read and search toll transactions.
  - 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.
paths:
  /api/p/v{version}/deductions/once:
    post:
      tags:
        - Deductions
      summary: Create one-time deduction
      parameters:
        - 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-patch+json:
            schema:
              allOf:
                - $ref: >-
                    #/components/schemas/Alvys.Models.Deductions.DeductionCreateOnceRequest
          application/json:
            schema:
              allOf:
                - $ref: >-
                    #/components/schemas/Alvys.Models.Deductions.DeductionCreateOnceRequest
          text/json:
            schema:
              allOf:
                - $ref: >-
                    #/components/schemas/Alvys.Models.Deductions.DeductionCreateOnceRequest
          application/*+json:
            schema:
              allOf:
                - $ref: >-
                    #/components/schemas/Alvys.Models.Deductions.DeductionCreateOnceRequest
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Alvys.Models.Deductions.DeductionResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Microsoft.AspNetCore.Mvc.ValidationProblemDetails
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
        '429':
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
      security:
        - Public: []
components:
  schemas:
    Alvys.Models.Deductions.DeductionCreateOnceRequest:
      required:
        - Amount
        - Category
        - Date
        - Description
      type: object
      properties:
        Date:
          type: string
          format: date-time
        Amount:
          type: number
          format: double
        Category:
          type: string
        Description:
          type: string
        DriverId:
          type: string
          nullable: true
        TruckId:
          type: string
          nullable: true
        OwnerOperatorId:
          type: string
          nullable: true
      additionalProperties: false
    Alvys.Models.Deductions.DeductionResponse:
      required:
        - Amount
        - Category
        - CreatedAt
        - Date
        - Description
        - GroupId
        - Id
        - IsPaid
        - Type
      type: object
      properties:
        Id:
          type: string
        Type:
          type: string
        GroupId:
          type: string
        Description:
          type: string
        Category:
          type: string
        Amount:
          allOf:
            - $ref: '#/components/schemas/Alvys.Money'
        DriverId:
          type: string
          nullable: true
        TruckId:
          type: string
          nullable: true
        OwnerOperatorId:
          type: string
          nullable: true
        Date:
          type: string
          format: date-time
        IsPaid:
          type: boolean
        CreatedAt:
          type: string
          format: date-time
        CreatedBy:
          type: string
          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: {}
    Alvys.Money:
      required:
        - Amount
      type: object
      properties:
        Amount:
          type: number
          format: double
        Currency:
          type: integer
          format: int32
          nullable: true
      additionalProperties: false
  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>`.

````