openapi: 3.0.3 info: title: Patch Carbon Order Line Items API version: '2' description: 'The Patch API lets developers browse verified carbon projects, generate emissions estimates, and place orders for carbon credits and removals. Reconstructed from the publicly published patch-python, patch-node, and patch-ruby SDKs (auto-generated by openapi-generator from the official Patch OpenAPI document). ' contact: name: Patch Engineering email: engineering@usepatch.com url: https://docs.patch.io/ license: name: Proprietary url: https://www.patch.io/terms servers: - url: https://api.patch.io description: Production API security: - bearerAuth: [] tags: - name: Order Line Items description: Manage individual line items inside a multi-line carbon credit order. paths: /v1/orders/{order_id}/line_items: post: tags: - Order Line Items operationId: createOrderLineItem summary: Create An Order Line Item description: Adds a new line item to a draft order tying a specific project, vintage, and quantity to the order. parameters: - name: order_id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateOrderLineItemRequest' responses: '200': description: Order line item response content: application/json: schema: $ref: '#/components/schemas/OrderLineItemResponse' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' /v1/orders/{order_id}/line_items/{serial_number}: patch: tags: - Order Line Items operationId: updateOrderLineItem summary: Update An Order Line Item description: Updates an existing line item on a draft order. parameters: - name: order_id in: path required: true schema: type: string - name: serial_number in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/UpdateOrderLineItemRequest' responses: '200': description: Order line item response content: application/json: schema: $ref: '#/components/schemas/OrderLineItemResponse' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' delete: tags: - Order Line Items operationId: deleteOrderLineItem summary: Delete An Order Line Item description: Removes a line item from a draft order. parameters: - name: order_id in: path required: true schema: type: string - name: serial_number in: path required: true schema: type: string responses: '200': description: Order line item response content: application/json: schema: $ref: '#/components/schemas/OrderLineItemResponse' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' components: schemas: ErrorResponse: type: object properties: success: type: boolean example: false error: type: object properties: code: type: integer message: type: string data: nullable: true meta: type: object properties: patch_version: type: integer Meta: type: object description: Pagination and response metadata block returned on list endpoints. properties: prev_page: type: integer nullable: true next_page: type: integer nullable: true OrderLineItemResponse: type: object properties: success: type: boolean error: nullable: true data: $ref: '#/components/schemas/OrderLineItem' meta: $ref: '#/components/schemas/Meta' OrderLineItemProject: type: object properties: id: type: string name: type: string OrderLineItem: type: object properties: id: type: string project: $ref: '#/components/schemas/OrderLineItemProject' vintage_year: type: integer nullable: true vintage_start_year: type: integer nullable: true vintage_end_year: type: integer nullable: true amount: type: integer description: Mass in grams. unit: type: string example: g price: type: integer currency: type: string example: USD UpdateOrderLineItemRequest: type: object properties: vintage_year: type: integer vintage_start_year: type: integer vintage_end_year: type: integer price: type: integer currency: type: string example: USD amount: type: integer unit: type: string example: g CreateOrderLineItemRequest: type: object required: - project_id properties: project_id: type: string vintage_year: type: integer vintage_start_year: type: integer vintage_end_year: type: integer price: type: integer currency: type: string example: USD amount: type: integer unit: type: string example: g responses: NotFound: description: The requested resource was not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' BadRequest: description: Request was malformed or failed validation. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' Unauthorized: description: API key missing, malformed, or invalid. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' securitySchemes: bearerAuth: type: http scheme: bearer description: API key bearer token issued from the Patch dashboard. Sandbox and live keys are separated.