# Create bill POST https://api-sandbox.payabli.com/api/Bill/single/{entry} Content-Type: application/json Creates a bill in an entrypoint. Reference: https://docs.payabli.com/developers/api-reference/bill/add-bill ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Add bill version: endpoint_bill.AddBill paths: /Bill/single/{entry}: post: operationId: add-bill summary: Add bill description: Creates a bill in an entrypoint. tags: - - subpackage_bill parameters: - name: entry in: path description: >- The paypoint's entrypoint identifier. [Learn more](/developers/api-reference/api-overview#entrypoint-vs-entry) required: true schema: type: string - name: requestToken in: header required: true schema: type: string - name: idempotencyKey in: header required: false schema: $ref: '#/components/schemas/type_:IdempotencyKey' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/type_bill:BillResponse' '400': description: Bad request/ invalid data content: {} '401': description: Unauthorized request. content: {} '500': description: Internal API Error content: {} '503': description: Database connection error content: {} requestBody: content: application/json: schema: $ref: '#/components/schemas/type_bill:BillOutData' components: schemas: type_:IdempotencyKey: type: string type_:AccountingField: type: string type_:AdditionalDataString: type: string type_:FileContentFtype: type: string enum: - value: pdf - value: doc - value: docx - value: jpg - value: jpeg - value: png - value: gif - value: txt type_:FileContent: type: object properties: fContent: type: string description: >- Content of file, Base64-encoded. Ignored if furl is specified. Max upload size is 30 MB. filename: type: string description: The name of the attached file. ftype: $ref: '#/components/schemas/type_:FileContentFtype' description: The MIME type of the file (if content is provided) furl: type: string description: Optional URL provided to show or download the file remotely type_:Attachments: type: array items: $ref: '#/components/schemas/type_:FileContent' type_:Datenullable: type: string format: date type_:ItemCommodityCode: type: string type_:ItemDescription: type: string type_:ItemProductCode: type: string type_:ItemProductName: type: string type_:ItemUnitofMeasure: type: string type_:BillItem: type: object properties: itemCategories: type: array items: type: string description: Array of tags classifying item or product. itemCommodityCode: $ref: '#/components/schemas/type_:ItemCommodityCode' itemCost: type: number format: double description: Item or product price per unit. itemDescription: $ref: '#/components/schemas/type_:ItemDescription' itemMode: type: integer description: >- Internal class of item or product: value '0' is only for invoices , '1' for bills and, '2' common for both. itemProductCode: $ref: '#/components/schemas/type_:ItemProductCode' itemProductName: $ref: '#/components/schemas/type_:ItemProductName' itemQty: type: integer description: Quantity of item or product. itemTaxAmount: type: number format: double description: Tax amount applied to item or product. itemTaxRate: type: number format: double description: Tax rate applied to item or product. itemTotalAmount: type: number format: double description: Total amount in item or product. itemUnitOfMeasure: $ref: '#/components/schemas/type_:ItemUnitofMeasure' required: - itemCost type_:Billitems: type: array items: $ref: '#/components/schemas/type_:BillItem' type_:Comments: type: string type_:Frequency: type: string enum: - value: onetime - value: weekly - value: every2weeks - value: every6months - value: monthly - value: every3months - value: annually type_bill:BillOutDataScheduledOptions: type: object properties: storedMethodId: type: string description: The ID of the stored payment method to use for the bill. type_:Billstatus: type: integer type_:Terms: type: string type_:VendorNumber: type: string type_:AdditionalData: type: object additionalProperties: type: object additionalProperties: description: Any type type_:AddressNullable: type: string type_:AddressAddtlNullable: type: string type_:BankAccountHolderName: type: string type_:BankAccountHolderType: type: string enum: - value: Personal - value: Business type_:BankName: type: string type_:RoutingAccount: type: string type_:TypeAccount: type: string enum: - value: Checking - value: Savings type_:BillingData: type: object properties: accountNumber: type: string description: Account number for bank account. bankAccountFunction: type: integer description: >- Describes whether the bank account is used for deposits or withdrawals in Payabli: - `0`: Deposit - `1`: Withdrawal - `2`: Deposit and withdrawal bankAccountHolderName: $ref: '#/components/schemas/type_:BankAccountHolderName' bankAccountHolderType: $ref: '#/components/schemas/type_:BankAccountHolderType' bankName: $ref: '#/components/schemas/type_:BankName' id: type: integer description: The bank's ID in Payabli. routingAccount: $ref: '#/components/schemas/type_:RoutingAccount' typeAccount: $ref: '#/components/schemas/type_:TypeAccount' type_:Email: type: string format: email type_:Contacts: type: object properties: contactEmail: $ref: '#/components/schemas/type_:Email' description: Contact email address. contactName: type: string description: Contact name. contactPhone: type: string description: Contact phone number. contactTitle: type: string description: Contact title. additionalData: $ref: '#/components/schemas/type_:AdditionalDataString' type_:ContactsField: type: array items: $ref: '#/components/schemas/type_:Contacts' type_:VendorEin: type: string type_:LocationCode: type: string type_:Mcc: type: string type_:VendorName1: type: string type_:VendorName2: type: string type_:PayeeName: type: string type_:VendorPaymentMethodString: type: string type_:VendorPhone: type: string type_:Remitaddress1: type: string type_:Remitaddress2: type: string type_:Remitcity: type: string type_:Remitcountry: type: string type_:RemitEmail: type: string format: email type_:Remitstate: type: string type_:Remitzip: type: string type_:Vendorstatus: type: integer type_:VendorData: type: object properties: vendorNumber: $ref: '#/components/schemas/type_:VendorNumber' AdditionalData: $ref: '#/components/schemas/type_:AdditionalData' address1: $ref: '#/components/schemas/type_:AddressNullable' description: Vendor's address address2: $ref: '#/components/schemas/type_:AddressAddtlNullable' description: Additional line for vendor's address. billingData: $ref: '#/components/schemas/type_:BillingData' description: Object containing vendor's bank information. city: type: string description: Vendor's city. contacts: $ref: '#/components/schemas/type_:ContactsField' description: Array of objects describing the vendor's contacts. country: type: string description: Vendor's country. customField1: type: string description: Custom field 1 for vendor customField2: type: string description: Custom field 2 for vendor customerVendorAccount: type: string description: Account number of paypoint in the vendor side. ein: $ref: '#/components/schemas/type_:VendorEin' email: $ref: '#/components/schemas/type_:Email' description: Vendor's email address. Required for vCard. internalReferenceId: type: integer format: int64 description: Internal identifier for global vendor account. locationCode: $ref: '#/components/schemas/type_:LocationCode' mcc: $ref: '#/components/schemas/type_:Mcc' name1: $ref: '#/components/schemas/type_:VendorName1' name2: $ref: '#/components/schemas/type_:VendorName2' payeeName1: $ref: '#/components/schemas/type_:PayeeName' payeeName2: $ref: '#/components/schemas/type_:PayeeName' paymentMethod: $ref: '#/components/schemas/type_:VendorPaymentMethodString' phone: $ref: '#/components/schemas/type_:VendorPhone' remitAddress1: $ref: '#/components/schemas/type_:Remitaddress1' remitAddress2: $ref: '#/components/schemas/type_:Remitaddress2' remitCity: $ref: '#/components/schemas/type_:Remitcity' remitCountry: $ref: '#/components/schemas/type_:Remitcountry' remitEmail: $ref: '#/components/schemas/type_:RemitEmail' remitState: $ref: '#/components/schemas/type_:Remitstate' remitZip: $ref: '#/components/schemas/type_:Remitzip' state: type: string description: Vendor's state. Must be a 2 character state code. vendorStatus: $ref: '#/components/schemas/type_:Vendorstatus' zip: type: string description: Vendor's zip code. type_bill:BillOutData: type: object properties: accountingField1: $ref: '#/components/schemas/type_:AccountingField' accountingField2: $ref: '#/components/schemas/type_:AccountingField' additionalData: $ref: '#/components/schemas/type_:AdditionalDataString' attachments: $ref: '#/components/schemas/type_:Attachments' description: >- An array of bill images. Attachments aren't required, but we strongly recommend including them. Including a bill image can make payouts smoother and prevent delays. You can include either the Base64-encoded file content, or you can include an fURL to a public file. The maximum file size for image uploads is 30 MB. billDate: $ref: '#/components/schemas/type_:Datenullable' description: 'Date of bill. Accepted formats: YYYY-MM-DD, MM/DD/YYYY.' billItems: $ref: '#/components/schemas/type_:Billitems' billNumber: type: string description: Unique identifier for the bill. Required when adding a bill. comments: $ref: '#/components/schemas/type_:Comments' discount: type: number format: double description: Discount amount applied to the bill. dueDate: $ref: '#/components/schemas/type_:Datenullable' description: 'Due date of bill. Accepted formats: YYYY-MM-DD, MM/DD/YYYY.' endDate: $ref: '#/components/schemas/type_:Datenullable' description: >- End Date for scheduled bills. Applied only in `Mode` = 1. Accepted formats: YYYY-MM-DD, MM/DD/YYYY frequency: $ref: '#/components/schemas/type_:Frequency' description: Frequency for scheduled bills. Applied only in `Mode` = 1. lotNumber: type: string description: Lot number associated with the bill. mode: type: integer description: 'Bill mode: value `0` for one-time bills, `1` for scheduled bills.' netAmount: type: number format: double description: Net Amount owed in bill. Required when adding a bill. scheduledOptions: $ref: '#/components/schemas/type_bill:BillOutDataScheduledOptions' description: Options for scheduled bills. status: $ref: '#/components/schemas/type_:Billstatus' terms: $ref: '#/components/schemas/type_:Terms' totalAmount: type: number format: double description: Total amount of the bill. vendor: $ref: '#/components/schemas/type_:VendorData' description: >- The vendor associated with the bill. Although you can create a vendor in a create bill request, Payabli recommends creating a vendor separately and passing a valid `vendorNumber` here. At minimum, the `vendorNumber` is required. type_:Responsecode: type: integer type_:PageIdentifier: type: string type_:RoomIdNotInUse: type: integer format: int64 type_:IsSuccess: type: boolean type_:ResponseText: type: string type_:Responsedatanonobject: oneOf: - type: string - type: integer type_bill:BillResponse: type: object properties: responseCode: $ref: '#/components/schemas/type_:Responsecode' pageIdentifier: $ref: '#/components/schemas/type_:PageIdentifier' roomId: $ref: '#/components/schemas/type_:RoomIdNotInUse' isSuccess: $ref: '#/components/schemas/type_:IsSuccess' responseText: $ref: '#/components/schemas/type_:ResponseText' responseData: $ref: '#/components/schemas/type_:Responsedatanonobject' description: >- If `isSuccess` = true, this contains the bill identifier. If `isSuccess` = false, this contains the reason for the error. required: - responseText ``` ## SDK Code Examples ```python CreateBill import datetime from payabli import BillItem, FileContent, VendorData, payabli client = payabli( api_key="YOUR_API_KEY", ) client.bill.add_bill( entry="8cfec329267", bill_number="ABC-123", net_amount=3762.87, bill_date=datetime.date.fromisoformat( "2024-07-01", ), due_date=datetime.date.fromisoformat( "2024-07-01", ), comments="Deposit for materials", bill_items=[ BillItem( item_product_code="M-DEPOSIT", item_product_name="Materials deposit", item_description="Deposit for materials", item_commodity_code="010", item_unit_of_measure="SqFt", item_cost=5.0, item_qty=1, item_mode=0, item_categories=["deposits"], item_total_amount=123.0, item_tax_amount=7.0, item_tax_rate=0.075, ) ], mode=0, accounting_field_1="MyInternalId", vendor=VendorData( vendor_number="1234-A", ), end_date=datetime.date.fromisoformat( "2024-07-01", ), frequency="monthly", terms="NET30", status=-99, attachments=[ FileContent( ftype="pdf", filename="my-doc.pdf", furl="https://mysite.com/my-doc.pdf", ) ], ) ``` ```typescript CreateBill import { PayabliClient } from "@payabli/sdk-node"; const client = new PayabliClient({ apiKey: "YOUR_API_KEY" }); await client.bill.addBill("8cfec329267", { body: { billNumber: "ABC-123", netAmount: 3762.87, billDate: "2024-07-01", dueDate: "2024-07-01", comments: "Deposit for materials", billItems: [{ itemProductCode: "M-DEPOSIT", itemProductName: "Materials deposit", itemDescription: "Deposit for materials", itemCommodityCode: "010", itemUnitOfMeasure: "SqFt", itemCost: 5, itemQty: 1, itemMode: 0, itemCategories: ["deposits"], itemTotalAmount: 123, itemTaxAmount: 7, itemTaxRate: 0.075 }], mode: 0, accountingField1: "MyInternalId", vendor: { vendorNumber: "1234-A" }, endDate: "2024-07-01", frequency: "monthly", terms: "NET30", status: -99, attachments: [{ ftype: "pdf", filename: "my-doc.pdf", furl: "https://mysite.com/my-doc.pdf" }] } }); ``` ```go CreateBill import ( context "context" option "github.com/payabli/sdk-go/option" sdkgo "github.com/payabli/sdk-go" sdkgoclient "github.com/payabli/sdk-go/client" ) client := sdkgoclient.NewClient( option.WithApiKey( "", ), ) response, err := client.Bill.AddBill( context.TODO(), "8cfec329267", &sdkgo.AddBillRequest{ Body: &sdkgo.BillOutData{ BillNumber: sdkgo.String( "ABC-123", ), NetAmount: sdkgo.Float64( 3762.87, ), BillDate: sdkgo.Time( sdkgo.MustParseDate( "2024-07-01", ), ), DueDate: sdkgo.Time( sdkgo.MustParseDate( "2024-07-01", ), ), Comments: sdkgo.String( "Deposit for materials", ), BillItems: []*sdkgo.BillItem{ &sdkgo.BillItem{ ItemProductCode: sdkgo.String( "M-DEPOSIT", ), ItemProductName: sdkgo.String( "Materials deposit", ), ItemDescription: sdkgo.String( "Deposit for materials", ), ItemCommodityCode: sdkgo.String( "010", ), ItemUnitOfMeasure: sdkgo.String( "SqFt", ), ItemCost: 5, ItemQty: sdkgo.Int( 1, ), ItemMode: sdkgo.Int( 0, ), ItemCategories: []*string{ sdkgo.String( "deposits", ), }, ItemTotalAmount: sdkgo.Float64( 123, ), ItemTaxAmount: sdkgo.Float64( 7, ), ItemTaxRate: sdkgo.Float64( 0.075, ), }, }, Mode: sdkgo.Int( 0, ), AccountingField1: sdkgo.String( "MyInternalId", ), Vendor: &sdkgo.VendorData{ VendorNumber: sdkgo.String( "1234-A", ), }, EndDate: sdkgo.Time( sdkgo.MustParseDate( "2024-07-01", ), ), Frequency: sdkgo.FrequencyMonthly, Terms: sdkgo.String( "NET30", ), Status: sdkgo.Int( -99, ), Attachments: []*sdkgo.FileContent{ &sdkgo.FileContent{ Ftype: sdkgo.FileContentFtypePdf, Filename: sdkgo.String( "my-doc.pdf", ), Furl: sdkgo.String( "https://mysite.com/my-doc.pdf", ), }, }, }, }, ) ``` ```csharp CreateBill using PayabliApi; var client = new PayabliApiClient("API_KEY"); await client.Bill.AddBillAsync( "8cfec329267", new AddBillRequest { Body = new BillOutData { BillNumber = "ABC-123", NetAmount = 3762.87, BillDate = new DateOnly(2024, 7, 1), DueDate = new DateOnly(2024, 7, 1), Comments = "Deposit for materials", BillItems = new List() { new BillItem { ItemProductCode = "M-DEPOSIT", ItemProductName = "Materials deposit", ItemDescription = "Deposit for materials", ItemCommodityCode = "010", ItemUnitOfMeasure = "SqFt", ItemCost = 5, ItemQty = 1, ItemMode = 0, ItemCategories = new List() { "deposits" }, ItemTotalAmount = 123, ItemTaxAmount = 7, ItemTaxRate = 0.075, }, }, Mode = 0, AccountingField1 = "MyInternalId", Vendor = new VendorData { VendorNumber = "1234-A" }, EndDate = new DateOnly(2024, 7, 1), Frequency = Frequency.Monthly, Terms = "NET30", Status = -99, Attachments = new List() { new FileContent { Ftype = FileContentFtype.Pdf, Filename = "my-doc.pdf", Furl = "https://mysite.com/my-doc.pdf", }, }, }, } ); ``` ```ruby CreateBill require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/Bill/single/8cfec329267") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["requestToken"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"accountingField1\": \"MyInternalId\",\n \"attachments\": [\n {\n \"filename\": \"my-doc.pdf\",\n \"ftype\": \"pdf\",\n \"furl\": \"https://mysite.com/my-doc.pdf\"\n }\n ],\n \"billDate\": \"2024-07-01\",\n \"billItems\": [\n {\n \"itemCost\": 5,\n \"itemCategories\": [\n \"deposits\"\n ],\n \"itemCommodityCode\": \"010\",\n \"itemDescription\": \"Deposit for materials\",\n \"itemMode\": 0,\n \"itemProductCode\": \"M-DEPOSIT\",\n \"itemProductName\": \"Materials deposit\",\n \"itemQty\": 1,\n \"itemTaxAmount\": 7,\n \"itemTaxRate\": 0.075,\n \"itemTotalAmount\": 123,\n \"itemUnitOfMeasure\": \"SqFt\"\n }\n ],\n \"billNumber\": \"ABC-123\",\n \"comments\": \"Deposit for materials\",\n \"dueDate\": \"2024-07-01\",\n \"endDate\": \"2024-07-01\",\n \"frequency\": \"monthly\",\n \"mode\": 0,\n \"netAmount\": 3762.87,\n \"status\": -99,\n \"terms\": \"NET30\",\n \"vendor\": {\n \"vendorNumber\": \"1234-A\"\n }\n}" response = http.request(request) puts response.read_body ``` ```java CreateBill HttpResponse response = Unirest.post("https://api-sandbox.payabli.com/api/Bill/single/8cfec329267") .header("requestToken", "") .header("Content-Type", "application/json") .body("{\n \"accountingField1\": \"MyInternalId\",\n \"attachments\": [\n {\n \"filename\": \"my-doc.pdf\",\n \"ftype\": \"pdf\",\n \"furl\": \"https://mysite.com/my-doc.pdf\"\n }\n ],\n \"billDate\": \"2024-07-01\",\n \"billItems\": [\n {\n \"itemCost\": 5,\n \"itemCategories\": [\n \"deposits\"\n ],\n \"itemCommodityCode\": \"010\",\n \"itemDescription\": \"Deposit for materials\",\n \"itemMode\": 0,\n \"itemProductCode\": \"M-DEPOSIT\",\n \"itemProductName\": \"Materials deposit\",\n \"itemQty\": 1,\n \"itemTaxAmount\": 7,\n \"itemTaxRate\": 0.075,\n \"itemTotalAmount\": 123,\n \"itemUnitOfMeasure\": \"SqFt\"\n }\n ],\n \"billNumber\": \"ABC-123\",\n \"comments\": \"Deposit for materials\",\n \"dueDate\": \"2024-07-01\",\n \"endDate\": \"2024-07-01\",\n \"frequency\": \"monthly\",\n \"mode\": 0,\n \"netAmount\": 3762.87,\n \"status\": -99,\n \"terms\": \"NET30\",\n \"vendor\": {\n \"vendorNumber\": \"1234-A\"\n }\n}") .asString(); ``` ```php CreateBill request('POST', 'https://api-sandbox.payabli.com/api/Bill/single/8cfec329267', [ 'body' => '{ "accountingField1": "MyInternalId", "attachments": [ { "filename": "my-doc.pdf", "ftype": "pdf", "furl": "https://mysite.com/my-doc.pdf" } ], "billDate": "2024-07-01", "billItems": [ { "itemCost": 5, "itemCategories": [ "deposits" ], "itemCommodityCode": "010", "itemDescription": "Deposit for materials", "itemMode": 0, "itemProductCode": "M-DEPOSIT", "itemProductName": "Materials deposit", "itemQty": 1, "itemTaxAmount": 7, "itemTaxRate": 0.075, "itemTotalAmount": 123, "itemUnitOfMeasure": "SqFt" } ], "billNumber": "ABC-123", "comments": "Deposit for materials", "dueDate": "2024-07-01", "endDate": "2024-07-01", "frequency": "monthly", "mode": 0, "netAmount": 3762.87, "status": -99, "terms": "NET30", "vendor": { "vendorNumber": "1234-A" } }', 'headers' => [ 'Content-Type' => 'application/json', 'requestToken' => '', ], ]); echo $response->getBody(); ``` ```swift CreateBill import Foundation let headers = [ "requestToken": "", "Content-Type": "application/json" ] let parameters = [ "accountingField1": "MyInternalId", "attachments": [ [ "filename": "my-doc.pdf", "ftype": "pdf", "furl": "https://mysite.com/my-doc.pdf" ] ], "billDate": "2024-07-01", "billItems": [ [ "itemCost": 5, "itemCategories": ["deposits"], "itemCommodityCode": "010", "itemDescription": "Deposit for materials", "itemMode": 0, "itemProductCode": "M-DEPOSIT", "itemProductName": "Materials deposit", "itemQty": 1, "itemTaxAmount": 7, "itemTaxRate": 0.075, "itemTotalAmount": 123, "itemUnitOfMeasure": "SqFt" ] ], "billNumber": "ABC-123", "comments": "Deposit for materials", "dueDate": "2024-07-01", "endDate": "2024-07-01", "frequency": "monthly", "mode": 0, "netAmount": 3762.87, "status": -99, "terms": "NET30", "vendor": ["vendorNumber": "1234-A"] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/Bill/single/8cfec329267")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```