FlxpointAPI Help CenterBeta

Create Source Invoice

posthttps://api.flxpoint.com/source-invoices

Use this when you want to create source invoice data through the API.

🔑 X-API-TOKEN⏱ 2 req/sToken: Account · Source · Channel

This page explains the endpoint. To send a live test request, use the interactive tester in Stoplight or your own Postman / HTTP client.

This endpoint will allow you to create a Source Invoice. A source token or account token may be used.

See the `CreateSourceInvoice` model for details.

Request

Query parameters
  • applyInvoiceWorkflowqueryboolean

    If passed, Flxpoint will run through the source invoice workflow if there are rules enabled

Bodyapplication/json
purchaseOrderIdinteger
either `purchaseOrderId` OR `rmaId` should be provided
rmaIdinteger
either `purchaseOrderId` OR `rmaId` should be provided
invoiceNumberstring
A reference number for this invoice. If one is not provided, we will default to using the Purchase Order Number/Fulfillment Request Number for Purchase Order/Fulfillment Request invoices, or RMA Number for RMA invoices.
invoiceStatusstring
For Purchase Order/Fulfillment Request invoices, the default value is `paid`. For RMA invoices, the default value is `credited`.
allowedunpaidpaidcreditedrefunded
invoiceDatestring (date-time)
If invoice date is not provided, we will default to the current timestamp at submission.
invoiceItemsarray[CreateSourceInvoiceItem]
For Purchase Order/Fulfillment Request invoices, at least one item is required. Items will be ignored (will not be saved) for RMA invoices.
invoiceItemTypestringrequired
allowedproductshippingfeetaxother
titlestring
Line item description of this invoice item. i.e. `2-5 day shipping` or `6.5% Sales Tax` If no value is provided: - in case a matching inventory item is found, `title` will be copied over from it - else `title` will be set to the `sku` for a `product` type item
skustring
Required for `product` types (or valid `inventoryVariantId`). Optional for other types. If a matching Inventory Variant is found, we will populate any null fields. Required for `product` types (or valid `inventoryVariantId`). Optional for other types. If a matching Inventory Variant is found, we will populate any null fields.
inventoryVariantIdinteger (int64)
If passed, we will attempt to associate an Inventory Variant. If not passed or not match, we will divert to `sku` to attempt to find a match. If a matching Inventory Variant is found, we will populate any null fields. If passed, we will attempt to associate an Inventory Variant. If not passed or not match, we will divert to `sku` to attempt to find a match. If a matching Inventory Variant is found, we will populate any null fields.
quantityinteger
default 1
perUnitCostnumber
If passed, this value will be multiplied by `quantity` to derive the cost of this line item.
costnumber
If `perUnitCost` is passed, this will be overwritten by `quantity` * `perUnitCost`
customFieldsarray[CreateSourceInvoiceItemCustomField]
For Purchase Order/Fulfillment Request invoices, any Custom Field with an empty name or value will be ignored (won't be saved). Also, each Custom Field should have a unique name; duplicates will also be ignored. All Custom Fields will be ignored for RMA invoices.
namestring
valuestring
totalCreditCostnumber
Used for RMA invoices only.
customFieldsarray[CreateSourceInvoiceCustomField]
For Purchase Order/Fulfillment Request invoices, any Custom Field with an empty name or value will be ignored (won't be saved). Also, each Custom Field should have a unique name; duplicates will also be ignored. All Custom Fields will be ignored for RMA invoices.
namestring
valuestring
commissionRatenumberdeprecated
The percentage rate defined at the vendor setting level that was used to calculate the commission
shipmentIdinteger
For Invoice workflow, to apply shipment based conditions if applicable.

Example request

post/source-invoices
curl -X POST "https://api.flxpoint.com/source-invoices" \
  -H "Accept: application/json" \
  -H "X-API-TOKEN: YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
         "purchaseOrderId": 0,
         "rmaId": 0,
         "invoiceNumber": "string",
         "invoiceStatus": "unpaid",
         "invoiceDate": "2026-04-20T00:00:00Z",
         "invoiceItems": [
           {
             "invoiceItemType": "product",
             "title": "string",
             "sku": "string",
             "inventoryVariantId": 0,
             "quantity": 0,
             "perUnitCost": 0,
             "cost": 0,
             "customFields": [
               {
                 "name": null,
                 "value": null
               }
             ]
           }
         ],
         "totalCreditCost": 0,
         "customFields": [
           {
             "name": "string",
             "value": "string"
           }
         ],
         "commissionRate": 0,
         "shipmentId": 0
       }'
Example body · application/json
{
  "purchaseOrderId": 0,
  "rmaId": 0,
  "invoiceNumber": "string",
  "invoiceStatus": "unpaid",
  "invoiceDate": "2026-04-20T00:00:00Z",
  "invoiceItems": [
    {
      "invoiceItemType": "product",
      "title": "string",
      "sku": "string",
      "inventoryVariantId": 0,
      "quantity": 0,
      "perUnitCost": 0,
      "cost": 0,
      "customFields": [
        {
          "name": null,
          "value": null
        }
      ]
    }
  ],
  "totalCreditCost": 0,
  "customFields": [
    {
      "name": "string",
      "value": "string"
    }
  ],
  "commissionRate": 0,
  "shipmentId": 0
}

Responses

200OKapplication/json
idinteger
invoiceStatusobject
namestring
allowedUnpaidPaidCreditedRefunded
handlestring
allowedunpaidpaidcreditedrefunded
insertedAtstring (date-time)
updatedAtstring (date-time)
purchaseOrderIdinteger
this field is deprecated, please use `fulfillmentRequestId`. The two fields are same.
fulfillmentRequestIdinteger
rmaIdinteger
sourceIdinteger
purchaseOrderNumberstring
this field is deprecated, please start using `fulfillmentRequestNumber`. The two fields are essentially same.
fulfillmentRequestNumberstring
invoiceNumberstring
invoiceDatestring (date-time)
totalCostnumber
totalProductCostnumber
totalShippingCostnumber
totalFeeCostnumber
totalTaxCostnumber
totalOtherCostnumber
totalQuantityinteger
accountingSyncedboolean
accountingSyncErrorstring
externalAccountingIdstring
invoiceItemsarray[InvoiceItem]
idinteger
invoiceIdinteger
invoiceItemTypeobjectrequired
namestring
allowedProductShippingFeeTaxOther
handlestring
allowedproductshippingfeetaxother
sourceVariantIdinteger (int64)
costnumber
skustringrequired
titlestring
quantityinteger
perUnitCostnumber
externalAccountingItemIdstring
customFieldsarray[Source Invoice Custom Field]
idinteger
namestring
valuestring
totalCreditCostnumber
customFieldsarray[Source Invoice Custom Field]
idinteger
namestring
valuestring
commissionnumberdeprecated
vendorPayoutIdinteger
Example response
{
  "id": 0,
  "invoiceStatus": {
    "name": "Unpaid",
    "handle": "unpaid"
  },
  "insertedAt": "2026-04-20T00:00:00Z",
  "updatedAt": "2026-04-20T00:00:00Z",
  "purchaseOrderId": 0,
  "fulfillmentRequestId": 0,
  "rmaId": 0,
  "sourceId": 0,
  "purchaseOrderNumber": "string",
  "fulfillmentRequestNumber": "string",
  "invoiceNumber": "string",
  "invoiceDate": "2026-04-20T00:00:00Z",
  "totalCost": 0,
  "totalProductCost": 0,
  "totalShippingCost": 0,
  "totalFeeCost": 0,
  "totalTaxCost": 0,
  "totalOtherCost": 0,
  "totalQuantity": 0,
  "accountingSynced": true,
  "accountingSyncError": "string",
  "externalAccountingId": "string",
  "invoiceItems": [
    {
      "id": 0,
      "invoiceId": 0,
      "invoiceItemType": {
        "name": "Product",
        "handle": "product"
      },
      "sourceVariantId": 0,
      "cost": 0,
      "sku": "string",
      "title": "string",
      "quantity": 0,
      "perUnitCost": 0,
      "externalAccountingItemId": "string",
      "customFields": [
        {
          "id": null,
          "name": null,
          "value": null
        }
      ]
    }
  ],
  "totalCreditCost": 0,
  "customFields": [
    {
      "id": 0,
      "name": "string",
      "value": "string"
    }
  ],
  "commission": 0,
  "vendorPayoutId": 0
}
400Bad Request

No schema documented for this status.

401Unauthorized

No schema documented for this status.

OpenAPI fragment
{
  "post": {
    "summary": "Create Source Invoice",
    "description": "This endpoint will allow you to create a Source Invoice. A source token or account token may be used.\n\nSee the `CreateSourceInvoice` model for details. ",
    "parameters": [
      {
        "name": "applyInvoiceWorkflow",
        "in": "query",
        "required": false,
        "schema": {
          "type": "boolean",
          "default": true
        },
        "description": "If passed, Flxpoint will run through the source invoice workflow if there are rules enabled"
      }
    ],
    "requestBody": {
      "description": "",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CreateSourceInvoice"
          },
          "examples": {
            "example-1": {
              "value": {
                "purchaseOrderId": 0,
                "invoiceNumber": "string",
                "invoiceStatus": "paid",
                "invoiceDate": "2019-08-24T14:15:22Z",
                "invoiceItems": [
                  {
                    "invoiceItemType": "product",
                    "title": "{sku}",
                    "sku": "string",
                    "inventoryVariantId": 0,
                    "quantity": 1,
                    "perUnitCost": 0,
                    "cost": 0
                  }
                ]
              }
            }
          }
        }
      }
    },
    "responses": {
      "200": {
        "description": "OK",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Invoice"
            },
            "examples": {
              "example-1": {
                "value": {
                  "id": 0,
                  "invoiceStatus": {
                    "name": "Paid",
                    "handle": "paid"
                  },
                  "accountId": 0,
                  "insertedAt": "2019-08-24T14:15:22Z",
                  "updatedAt": "2019-08-24T14:15:22Z",
                  "purchaseOrderId": 0,
                  "sourceId": 0,
                  "purchaseOrderNumber": "string",
                  "invoiceNumber": "string",
                  "invoiceDate": "2019-08-24T14:15:22Z",
                  "totalCost": 0,
                  "totalProductCost": 0,
                  "totalShippingCost": 0,
                  "totalFeeCost": 0,
                  "totalTaxCost": 0,
                  "totalOtherCost": 0,
                  "totalQuantity": 0,
                  "accountingSynced": true,
                  "externalAccountingId": "string",
                  "invoiceItems": [
                    {
                      "id": 0,
                      "invoiceId": 0,
                      "invoiceItemType": {
                        "name": "Product",
                        "handle": "product"
                      },
                      "sourceVariantId": 0,
                      "cost": 0,
                      "sku": "string",
                      "title": "string",
                      "quantity": 0,
                      "perUnitCost": 0,
                      "externalAccountingItemId": "string"
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "400": {
        "description": "Bad Request"
      },
      "401": {
        "description": "Unauthorized"
      }
    }
  }
}
Ready to run it? Send the curl from your terminal or Postman, or use the interactive tester in Stoplight.Open in Stoplight