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

# Charges a catalog item to a ticket or to a project task.

> <b>Required:</b> exactly one of `TicketId` and `TaskId`, `ItemId` (a product or
            bundle from `GET /v1/items`) and `Quantity`.
            
<b>Optional:</b>`UnitPrice`, `UnitCost` and `Description` fall back to the
            item's own; `BillableStatusId` defaults to 1 (Billable). The product is billed to the
            ticket's client, or the task's project's client, and appears on the ticket's or task's timeline.
            

            Refused with 409, as the app disables Add Product: on a ticket that is closed, has no client or
            whose client is on credit hold; on a task whose project is closed or has no client. Clear the
            condition and the same request succeeds. A ticket or task that does not exist, or belongs to
            another service provider, is a 404. An item that is not an active product or bundle of the
            service provider, catalog-wide or scoped to the charge's client, is a 400 on `ItemId`.
            
The response is just the new charge's `Id`, the shape Create Time Entry returns.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/product-charges
openapi: 3.0.4
info:
  title: Public API
  description: Gorelo Public API documentation.
  version: 1.0.0
servers:
  - url: https://api.usw.gorelo.io
    description: US
  - url: https://api.aue.gorelo.io
    description: Australia
security:
  - ApiKeyAuth: []
tags:
  - name: Attachments
    description: "Uploading a file, for anything that can carry one. One endpoint rather than one per record\r\ntype, because the upload itself is identical - only the record it is checked against differs."
  - name: Alerts
    description: Alerts management operations
  - name: Assets
    description: Assets management operations
  - name: Billing
    description: Billing management operations
  - name: Tickets
    description: Tickets management operations
  - name: Clients
    description: Clients management operations
  - name: Contacts
    description: Contacts management operations
  - name: Deletions
    description: Deletions management operations
  - name: Documents
    description: Documents management operations
  - name: Forms
    description: Forms management operations
  - name: Organization
    description: Organization management operations
  - name: Projects
    description: Projects management operations
paths:
  /v1/product-charges:
    post:
      tags:
        - Billing
      summary: Charges a catalog item to a ticket or to a project task.
      description: "<b>Required:</b> exactly one of `TicketId` and `TaskId`, `ItemId` (a product or\r\n            bundle from `GET /v1/items`) and `Quantity`.\r\n            \n<b>Optional:</b>`UnitPrice`, `UnitCost` and `Description` fall back to the\r\n            item's own; `BillableStatusId` defaults to 1 (Billable). The product is billed to the\r\n            ticket's client, or the task's project's client, and appears on the ticket's or task's timeline.\r\n            \n\r\n            Refused with 409, as the app disables Add Product: on a ticket that is closed, has no client or\r\n            whose client is on credit hold; on a task whose project is closed or has no client. Clear the\r\n            condition and the same request succeeds. A ticket or task that does not exist, or belongs to\r\n            another service provider, is a 404. An item that is not an active product or bundle of the\r\n            service provider, catalog-wide or scoped to the charge's client, is a 400 on `ItemId`.\r\n            \nThe response is just the new charge's `Id`, the shape Create Time Entry returns."
      operationId: post_v1_product-charges
      requestBody:
        description: The product to charge.
        content:
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/CreateProductChargeCommand'
          application/json:
            schema:
              $ref: '#/components/schemas/CreateProductChargeCommand'
          text/json:
            schema:
              $ref: '#/components/schemas/CreateProductChargeCommand'
          application/*+json:
            schema:
              $ref: '#/components/schemas/CreateProductChargeCommand'
      responses:
        '200':
          description: OK
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/CreateProductChargeResultBaseResponse'
            application/json:
              schema:
                $ref: '#/components/schemas/CreateProductChargeResultBaseResponse'
            text/json:
              schema:
                $ref: '#/components/schemas/CreateProductChargeResultBaseResponse'
        '400':
          description: Bad Request
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ObjectBaseResponse'
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectBaseResponse'
            text/json:
              schema:
                $ref: '#/components/schemas/ObjectBaseResponse'
        '401':
          description: Unauthorized
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ObjectBaseResponse'
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectBaseResponse'
            text/json:
              schema:
                $ref: '#/components/schemas/ObjectBaseResponse'
        '404':
          description: Not Found
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ObjectBaseResponse'
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectBaseResponse'
            text/json:
              schema:
                $ref: '#/components/schemas/ObjectBaseResponse'
        '409':
          description: Conflict
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ObjectBaseResponse'
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectBaseResponse'
            text/json:
              schema:
                $ref: '#/components/schemas/ObjectBaseResponse'
        '500':
          description: Internal Server Error
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ObjectBaseResponse'
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectBaseResponse'
            text/json:
              schema:
                $ref: '#/components/schemas/ObjectBaseResponse'
components:
  schemas:
    CreateProductChargeCommand:
      type: object
      properties:
        TicketId:
          type: string
          description: >-
            The ticket to charge the product to. Send this or `TaskId`, not
            both.
          format: uuid
          nullable: true
          example: 08dd8170-f413-959c-82ae-152d5f340000
        TaskId:
          type: string
          description: >-
            The project task to charge the product to. Send this or `TicketId`,
            not both.
          format: uuid
          nullable: true
          example: 08dd8170-f413-959c-82ae-152d5f340001
        ItemId:
          type: string
          description: "The catalog item to add - an active product or bundle from `GET /v1/items` that is\r\ncatalog-wide or scoped to the charge's client. Required."
          format: uuid
          example: 3fa85f64-5717-4562-b3fc-2c963f66afa6
        Quantity:
          type: number
          description: >-
            Quantity to charge. Required; greater than 0 and at most 99,999,999,
            with up to 4 decimal places.
          format: double
          nullable: true
          example: 2
        UnitPrice:
          type: number
          description: >-
            Price of one unit, -99,999,999 to 99,999,999. Defaults to the item's
            price.
          format: double
          nullable: true
          example: 189
        UnitCost:
          type: number
          description: >-
            Cost of one unit to the service provider, 0 to 99,999,999. Defaults
            to the item's current cost.
          format: double
          nullable: true
          example: 142.5
        Description:
          type: string
          description: >-
            Description shown for the product on the ticket or task and the
            invoice. Defaults to the item's description.
          nullable: true
        BillableStatusId:
          type: integer
          description: 1 Billable (default), 2 No charge, 3 Non-billable or 5 Void.
          format: int32
          nullable: true
          example: 1
      additionalProperties: false
      description: A catalog item to charge to a ticket or to a project task.
    CreateProductChargeResultBaseResponse:
      type: object
      properties:
        StatusCode:
          $ref: '#/components/schemas/HttpStatusCode'
        IsSuccess:
          type: boolean
        Data:
          $ref: '#/components/schemas/CreateProductChargeResult'
        DataContext:
          type: object
          additionalProperties: false
          nullable: true
          example: null
        Notifications:
          type: array
          items:
            $ref: '#/components/schemas/Error'
      additionalProperties: false
    ObjectBaseResponse:
      type: object
      properties:
        StatusCode:
          $ref: '#/components/schemas/HttpStatusCode'
        IsSuccess:
          type: boolean
        Data:
          nullable: true
        DataContext:
          $ref: '#/components/schemas/ErrorDataContext'
        Notifications:
          type: array
          items:
            $ref: '#/components/schemas/Error'
      additionalProperties: false
    HttpStatusCode:
      enum:
        - 100
        - 101
        - 102
        - 103
        - 200
        - 201
        - 202
        - 203
        - 204
        - 205
        - 206
        - 207
        - 208
        - 226
        - 300
        - 301
        - 302
        - 303
        - 304
        - 305
        - 306
        - 307
        - 308
        - 400
        - 401
        - 402
        - 403
        - 404
        - 405
        - 406
        - 407
        - 408
        - 409
        - 410
        - 411
        - 412
        - 413
        - 414
        - 415
        - 416
        - 417
        - 421
        - 422
        - 423
        - 424
        - 426
        - 428
        - 429
        - 431
        - 451
        - 500
        - 501
        - 502
        - 503
        - 504
        - 505
        - 506
        - 507
        - 508
        - 510
        - 511
      type: integer
      format: int32
    CreateProductChargeResult:
      type: object
      properties:
        Id:
          type: integer
          description: Identifier of the new product charge.
          format: int64
      additionalProperties: false
    Error:
      type: object
      properties:
        Code:
          pattern: ^[0-9]{6}$
          type: string
          description: 6-digit MMTTNN error code. See the Public API error-code registry.
          example: '070101'
        Message:
          type: string
        PropertyName:
          type: string
          nullable: true
        ActionHint:
          type: string
          nullable: true
        DocUrl:
          type: string
          nullable: true
      additionalProperties: false
    ErrorDataContext:
      type: object
      properties:
        TraceId:
          type: string
          description: Request correlation id. Quote this when reporting a problem.
          nullable: true
      additionalProperties: false
      description: "The `DataContext` of an error response: carries the correlation id for the failed\r\nrequest."
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      description: >-
        Your Gorelo API key. See [Generate API key](/generate-api-key). If your
        data is hosted in Australia, click the base URL at the top of this page
        and select `https://api.aue.gorelo.io`.
      name: X-API-Key
      in: header

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.