> This is Payabli documentation. For a complete page index, fetch https://docs.payabli.com/llms.txt — append .md to any page URL for lightweight markdown. For section-level indexes, query parameters, and other AI-optimized access methods, see https://docs.payabli.com/ai-agents.md

# Manage bills with the API

> Learn how to add and manage bills for vendors via the API

In Payabli, bills represent a bill from a vendor that a paypoint is expected to pay. Use managed payables with Payabli to turn those payouts to vendors into an income stream.

Learn how to use our OCR engine to scrape documents and create bills: [Use the OCR Engine](/guides/pay-ops-developer-ocr-use)

## Basic bill workflow

1. When you get an invoice from a vendor or supplier, add it to Payabli as a bill via the API, File Exchange, or the web.
2. Update or delete bills, and then queue them for approval.
3. After bills are approved, make payout requests, and you can pay one or many bills.

Via an enablement process, your vendors are contacted to help decide on a payment method. The goal is that they choose to receive payments through virtual cards for ease, speed, and security of payment.

## Considerations

Keep these points in mind when working with bills:

* You don't have to use Payabli's bill engine to make a payout. When making a payout request, set the query parameter `doNotCreateBills` to `true`.
* Payabli strongly recommends including bill images with your bills. Including bill images can make payouts faster, more accurate,  and prevent problems.
* You can pay more than one bill with one payout request. If several active bills added, queued, and ready to be paid, you can make a payout request to pay all active bills. Remittance information for that single payout request will include the details for all of the paid bills.
* Bill approval isn't required. If a bill status is *Active* (`1`) or *Approved* (`20`) it can be sent for payout. If a bill status is *Sent to Approval* (`2`) you can't send it for payout. For the full numeric mapping, see [Bill statuses](/guides/pay-out-status-reference#bill-statuses).
* You can use the [OCR engine](/developers/api-reference/import/ocr-a-base64-encoded-string) to capture data from uploaded bill images.

## Create a bill

To create a single bill, send a POST request to `/api/Bill/single/{entry}`.

For complete information, see the [API reference](/developers/api-reference/bill/add-bill).

This example adds a bill to the entrypoint with ID `8cfec329267`. The bill is for a vendor with the `vendorNumber` `VEN-123`. The bill number is *ABC-123*, and the request includes an uploaded bill image, and optional fields like comments. The `status` is `1` (*Active*), so the bill is payout-eligible. See [Bill statuses](/guides/pay-out-status-reference#bill-statuses) for the other values.

### Request

POST [https://api-sandbox.payabli.com/api/Bill/single/\{entry}](https://api-sandbox.payabli.com/api/Bill/single/\{entry})

```curl
curl -X POST https://api-sandbox.payabli.com/api/Bill/single/8cfec329267 \
     -H "Authorization: Bearer <token>" \
     -H "Content-Type: application/json" \
     -d '{
  "accountingField1": "MyInternalId",
  "attachments": [
    {
      "filename": "my-doc.pdf",
      "ftype": "pdf",
      "furl": "https://mysite.com/my-doc.pdf"
    }
  ],
  "billDate": "2024-07-01",
  "billItems": [
    {
      "itemCategories": [
        "deposits"
      ],
      "itemCommodityCode": "010",
      "itemCost": 5,
      "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": 1,
  "terms": "NET30",
  "vendor": {
    "vendorNumber": "VEN-123"
  }
}'
```

```typescript
import { PayabliClient } from "@payabli/sdk-node";

async function main() {
    const client = new PayabliClient({
        clientId: "YOUR_CLIENT_ID",
        clientSecret: "YOUR_CLIENT_SECRET",
    });
    await client.bill.addBill("8cfec329267", {
        body: {
            accountingField1: "MyInternalId",
            attachments: [
                {
                    filename: "my-doc.pdf",
                    ftype: "pdf",
                    furl: "https://mysite.com/my-doc.pdf",
                },
            ],
            billDate: "2024-07-01",
            billItems: [
                {
                    itemCategories: [
                        "deposits",
                    ],
                    itemCommodityCode: "010",
                    itemCost: 5,
                    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: 1,
            terms: "NET30",
            vendor: {
                vendorNumber: "VEN-123",
            },
        },
    });
}
main();

```

```python
from payabli import payabli, FileContent, BillItem, BillOutDataVendor
import datetime

client = payabli(
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)

client.bill.add_bill(
    entry="8cfec329267",
    accounting_field_1="MyInternalId",
    attachments=[
        FileContent(
            filename="my-doc.pdf",
            ftype="pdf",
            furl="https://mysite.com/my-doc.pdf",
        )
    ],
    bill_date=datetime.date.fromisoformat("2024-07-01"),
    bill_items=[
        BillItem(
            item_categories=[
                "deposits"
            ],
            item_commodity_code="010",
            item_cost=5,
            item_description="Deposit for materials",
            item_mode=0,
            item_product_code="M-DEPOSIT",
            item_product_name="Materials deposit",
            item_qty=1,
            item_tax_amount=7,
            item_tax_rate=0.075,
            item_total_amount=123,
            item_unit_of_measure="SqFt",
        )
    ],
    bill_number="ABC-123",
    comments="Deposit for materials",
    due_date=datetime.date.fromisoformat("2024-07-01"),
    end_date=datetime.date.fromisoformat("2024-07-01"),
    frequency="monthly",
    mode=0,
    net_amount=3762.87,
    status=1,
    terms="NET30",
    vendor=BillOutDataVendor(
        vendor_number="VEN-123",
    ),
)

```

```java
package com.example.usage;

import io.github.payabli.api.PayabliApiClient;
import io.github.payabli.api.resources.bill.requests.AddBillRequest;
import io.github.payabli.api.types.BillItem;
import io.github.payabli.api.types.BillOutData;
import io.github.payabli.api.types.BillOutDataVendor;
import io.github.payabli.api.types.FileContent;
import io.github.payabli.api.types.FileContentFtype;
import io.github.payabli.api.types.Frequency;
import io.github.payabli.api.types.Terms;
import java.util.Arrays;
import java.util.Optional;

public class Example {
    public static void main(String[] args) {
        PayabliApiClient client = PayabliApiClient.withCredentials("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET")
            .build()
        ;

        client.bill().addBill(
            "8cfec329267",
            AddBillRequest
                .builder()
                .body(
                    BillOutData
                        .builder()
                        .accountingField1("MyInternalId")
                        .attachments(
                            Arrays.asList(
                                FileContent
                                    .builder()
                                    .filename("my-doc.pdf")
                                    .ftype(FileContentFtype.PDF)
                                    .furl("https://mysite.com/my-doc.pdf")
                                    .build()
                            )
                        )
                        .billDate("2024-07-01")
                        .billItems(
                            Arrays.asList(
                                BillItem
                                    .builder()
                                    .itemCategories(
                                        Optional.of(
                                            Arrays.asList("deposits")
                                        )
                                    )
                                    .itemCommodityCode("010")
                                    .itemCost(5.0)
                                    .itemDescription("Deposit for materials")
                                    .itemMode(0)
                                    .itemProductCode("M-DEPOSIT")
                                    .itemProductName("Materials deposit")
                                    .itemQty(1)
                                    .itemTaxAmount(7.0)
                                    .itemTaxRate(0.075)
                                    .itemTotalAmount(123.0)
                                    .itemUnitOfMeasure("SqFt")
                                    .build()
                            )
                        )
                        .billNumber("ABC-123")
                        .comments("Deposit for materials")
                        .dueDate("2024-07-01")
                        .endDate("2024-07-01")
                        .frequency(Frequency.MONTHLY)
                        .mode(0)
                        .netAmount(3762.87)
                        .status(1)
                        .terms(Terms.NET_30)
                        .vendor(
                            BillOutDataVendor
                                .builder()
                                .vendorNumber("VEN-123")
                                .build()
                        )
                        .build()
                )
                .build()
        );
    }
}
```

```ruby
require "payabli"

client = Payabli::Client.new(api_key: "YOUR_API_KEY_HERE")

client.bill.add_bill(
  entry: "8cfec329267",
  accounting_field_1: "MyInternalId",
  attachments: [{
    filename: "my-doc.pdf",
    ftype: "pdf",
    furl: "https://mysite.com/my-doc.pdf"
  }],
  bill_date: "2024-07-01",
  bill_items: [{
    item_categories: ["deposits"],
    item_commodity_code: "010",
    item_cost: 5,
    item_description: "Deposit for materials",
    item_mode: 0,
    item_product_code: "M-DEPOSIT",
    item_product_name: "Materials deposit",
    item_qty: 1,
    item_tax_amount: 7,
    item_tax_rate: 0.075,
    item_total_amount: 123,
    item_unit_of_measure: "SqFt"
  }],
  bill_number: "ABC-123",
  comments: "Deposit for materials",
  due_date: "2024-07-01",
  end_date: "2024-07-01",
  frequency: "monthly",
  mode: 0,
  net_amount: 3762.87,
  status: 1,
  terms: "NET30",
  vendor: {
    vendor_number: "VEN-123"
  }
)

```

```csharp
using PayabliApi;
using System.Threading.Tasks;
using System.Collections.Generic;
using System;

public partial class Examples
{
    public async Task Example() {
        var client = new PayabliApiClient(
            clientId: "YOUR_CLIENT_ID",
            clientSecret: "YOUR_CLIENT_SECRET"
        );

        await client.Bill.AddBillAsync(
            entry: "8cfec329267",
            request: new AddBillRequest {
                Body = new BillOutData {
                    AccountingField1 = "MyInternalId",
                    Attachments = new List<FileContent>(){
                        new FileContent {
                            Filename = "my-doc.pdf",
                            Ftype = FileContentFtype.Pdf,
                            Furl = "https://mysite.com/my-doc.pdf"
                        },
                    }
                    ,
                    BillDate = DateOnly.Parse("2024-07-01"),
                    BillItems = new List<BillItem>(){
                        new BillItem {
                            ItemCategories = new List<string>(){
                                "deposits",
                            }
                            ,
                            ItemCommodityCode = "010",
                            ItemCost = 5,
                            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 = DateOnly.Parse("2024-07-01"),
                    EndDate = DateOnly.Parse("2024-07-01"),
                    Frequency = Frequency.Monthly,
                    Mode = 0,
                    NetAmount = 3762.87,
                    Status = 1,
                    Terms = Terms.Net30,
                    Vendor = new BillOutDataVendor {
                        VendorNumber = "VEN-123"
                    }
                }
            }
        );
    }

}

```

```go
package example

import (
    context "context"

    payabli "github.com/payabli/sdk-go"
    client "github.com/payabli/sdk-go/client"
    option "github.com/payabli/sdk-go/option"
)

func do() {
    client := client.NewClient(
        option.WithClientCredentials(
            "YOUR_CLIENT_ID",
            "YOUR_CLIENT_SECRET",
        ),
    )
    request := &payabli.AddBillRequest{
        Body: &payabli.BillOutData{
            AccountingField1: payabli.String(
                "MyInternalId",
            ),
            Attachments: &payabli.Attachments{
                &payabli.FileContent{
                    Filename: payabli.String(
                        "my-doc.pdf",
                    ),
                    Ftype: payabli.FileContentFtypePdf.Ptr(),
                    Furl: payabli.String(
                        "https://mysite.com/my-doc.pdf",
                    ),
                },
            },
            BillDate: payabli.Time(
                payabli.MustParseDate(
                    "2024-07-01",
                ),
            ),
            BillItems: &payabli.Billitems{
                &payabli.BillItem{
                    ItemCategories: []string{
                        "deposits",
                    },
                    ItemCommodityCode: payabli.String(
                        "010",
                    ),
                    ItemCost: payabli.Float64(
                        5,
                    ),
                    ItemDescription: payabli.String(
                        "Deposit for materials",
                    ),
                    ItemMode: payabli.Int(
                        0,
                    ),
                    ItemProductCode: payabli.String(
                        "M-DEPOSIT",
                    ),
                    ItemProductName: payabli.String(
                        "Materials deposit",
                    ),
                    ItemQty: payabli.Int(
                        1,
                    ),
                    ItemTaxAmount: payabli.Float64(
                        7,
                    ),
                    ItemTaxRate: payabli.Float64(
                        0.075,
                    ),
                    ItemTotalAmount: payabli.Float64(
                        123,
                    ),
                    ItemUnitOfMeasure: payabli.String(
                        "SqFt",
                    ),
                },
            },
            BillNumber: payabli.String(
                "ABC-123",
            ),
            Comments: payabli.String(
                "Deposit for materials",
            ),
            DueDate: payabli.Time(
                payabli.MustParseDate(
                    "2024-07-01",
                ),
            ),
            EndDate: payabli.Time(
                payabli.MustParseDate(
                    "2024-07-01",
                ),
            ),
            Frequency: payabli.FrequencyMonthly.Ptr(),
            Mode: payabli.Int(
                0,
            ),
            NetAmount: payabli.Float64(
                3762.87,
            ),
            Status: payabli.Int(
                1,
            ),
            Terms: payabli.TermsNet30.Ptr(),
            Vendor: &payabli.BillOutDataVendor{
                VendorNumber: payabli.String(
                    "VEN-123",
                ),
            },
        },
    }
    client.Bill.AddBill(
        context.TODO(),
        "8cfec329267",
        request,
    )
}

```

```php
<?php

namespace Example;

use Payabli\PayabliClient;
use Payabli\Bill\Requests\AddBillRequest;
use Payabli\Types\BillOutData;
use Payabli\Types\FileContent;
use Payabli\Types\FileContentFtype;
use DateTime;
use Payabli\Types\BillItem;
use Payabli\Types\Frequency;
use Payabli\Types\Terms;
use Payabli\Types\BillOutDataVendor;

$client = new PayabliClient(
    clientId: 'YOUR_CLIENT_ID',
    clientSecret: 'YOUR_CLIENT_SECRET',
);
$client->bill->addBill(
    '8cfec329267',
    new AddBillRequest([
        'body' => new BillOutData([
            'accountingField1' => 'MyInternalId',
            'attachments' => [
                new FileContent([
                    'filename' => 'my-doc.pdf',
                    'ftype' => FileContentFtype::Pdf->value,
                    'furl' => 'https://mysite.com/my-doc.pdf',
                ]),
            ],
            'billDate' => new DateTime('2024-07-01'),
            'billItems' => [
                new BillItem([
                    'itemCategories' => [
                        'deposits',
                    ],
                    'itemCommodityCode' => '010',
                    'itemCost' => 5,
                    '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' => new DateTime('2024-07-01'),
            'endDate' => new DateTime('2024-07-01'),
            'frequency' => Frequency::Monthly->value,
            'mode' => 0,
            'netAmount' => 3762.87,
            'status' => 1,
            'terms' => Terms::Net30->value,
            'vendor' => new BillOutDataVendor([
                'vendorNumber' => 'VEN-123',
            ]),
        ]),
    ]),
);

```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "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": [
    [
      "itemCategories": ["deposits"],
      "itemCommodityCode": "010",
      "itemCost": 5,
      "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": 1,
  "terms": "NET30",
  "vendor": ["vendorNumber": "VEN-123"]
] 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()
```

A successful response returns the bill ID in the `responseData` field.

### Response (200)

```json
{
  "responseText": "Success",
  "responseCode": 1,
  "pageIdentifier": null,
  "roomId": 0,
  "isSuccess": true,
  "responseData": 6101
}
```

If your workflow requires bill approval, you can send the bill to approval with the API. For more information, see [Send a bill to approval](/developers/api-reference/bill/send-a-bill-to-approval).

If an approver's email doesn't yet belong to a Payabli user, include the `autocreateUser=true` query parameter so the request creates the user. Without it, the call returns a `400` error with the message `Empty approvals`.

After your bill is approved you can make a payout request to pay the bill. For more information, see [Make a payout request](/developers/api-reference/moneyout/authorize-a-transaction-for-payout).

### Attach a bill image

Payabli recommends attaching a bill image to every bill — it makes payouts faster and more accurate. Add images with the `attachments` array when you create the bill.

Each attachment is a file object with a `filename`, an `ftype` (`pdf`, `doc`, `docx`, `jpg`, `jpeg`, `png`, `gif`, or `txt`), and the file itself, provided one of two ways:

* **Base64-encoded content** in `fContent`.
* **A public URL** in `furl` that Payabli fetches the file from. When you set `furl`, Payabli ignores `fContent`.

Payabli stores the file with the bill either way. The maximum upload size is 30 MB.

```json
{
  "billNumber": "ABC-123",
  "netAmount": 100.00,
  "billDate": "2026-08-20",
  "dueDate": "2026-09-20",
  "vendor": {
    "vendorNumber": "VEN-123"
  },
  "attachments": [
    {
      "ftype": "pdf",
      "filename": "invoice.pdf",
      "furl": "https://example.com/invoice.pdf"
    }
  ]
}
```

See [Add bill](/developers/api-reference/bill/add-bill) for the full API reference.

### Apply a credit to a bill

If a vendor offers a credit against a bill, record it with the bill's `discount` field when you create the bill. When you pay the bill, the payout pays the net amount after the credit, and the credit flows through to your reconciliation data.

Set the bill amounts like this:

* `discount` is the credit applied to the bill.
* `netAmount` is the bill total minus the `discount`. This is the amount you actually pay.

`discount` plus `netAmount` equals the original bill total. For example, a \$100.00 bill with a \$25.00 credit has a `netAmount` of `75.00` and a `discount` of `25.00`:

```json
{
  "billNumber": "ABC-123",
  "netAmount": 75.00,
  "discount": 25.00,
  "billDate": "2024-12-01",
  "dueDate": "2024-12-31",
  "comments": "Credit Memo 1234",
  "vendor": {
    "vendorNumber": "VEN-123"
  }
}
```

To record a credit memo number, use the `comments` field.

## Import bills

You can import a list of bills into Payabli using the API. This is useful if you have many bills to add at once, or if you want to automate the process. Before you get started, download the example CSV file and open it with the editor of your choice. Use it as an example to help you build your import file.

Download CSV

To create a bill, send a POST request to the `/api/Import/billsForm/{entrypoint}` endpoint, with an attached CSV file.

This example imports billImport.csv for the entrypoint `e56ce00572`.

### Request

POST [https://api-sandbox.payabli.com/api/Import/billsForm/\{entry}](https://api-sandbox.payabli.com/api/Import/billsForm/\{entry})

```curl
curl -X POST https://api-sandbox.payabli.com/api/Import/billsForm/8cfec329267 \
     -H "Authorization: Bearer <token>" \
     -H "Content-Type: multipart/form-data" \
     -F file=@<file1>
```

```typescript
import { PayabliClient } from "@payabli/sdk-node";

async function main() {
    const client = new PayabliClient({
        clientId: "YOUR_CLIENT_ID",
        clientSecret: "YOUR_CLIENT_SECRET",
    });
    await client.import.importBills("8cfec329267", {});
}
main();

```

```python
from payabli import payabli

client = payabli(
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)

client.import_.import_bills(
    entry="8cfec329267",
    file="example_file",
)

```

```java
package com.example.usage;

import io.github.payabli.api.PayabliApiClient;
import io.github.payabli.api.resources.import_.requests.ImportBillsRequest;

public class Example {
    public static void main(String[] args) {
        PayabliApiClient client = PayabliApiClient.withCredentials("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET")
            .build()
        ;

        client.import_().importBills(
            "8cfec329267",
            null,
            ImportBillsRequest
                .builder()
                .build()
        );
    }
}
```

```ruby
require "payabli"

client = Payabli::Client.new(api_key: "YOUR_API_KEY_HERE")

client.import.import_bills(entry: "8cfec329267")

```

```csharp
using PayabliApi;
using System.Threading.Tasks;
using System.IO;
using System.Text;

public partial class Examples
{
    public async Task Example() {
        var client = new PayabliApiClient(
            clientId: "YOUR_CLIENT_ID",
            clientSecret: "YOUR_CLIENT_SECRET"
        );

        await client.Import.ImportBillsAsync(
            entry: "8cfec329267",
            request: new ImportBillsRequest {
                File = new FileParameter(){
                    Stream = new MemoryStream(Encoding.UTF8.GetBytes("[bytes]"))
                }
            }
        );
    }

}

```

```go
package example

import (
    context "context"
    strings "strings"

    payabli "github.com/payabli/sdk-go"
    client "github.com/payabli/sdk-go/client"
    option "github.com/payabli/sdk-go/option"
)

func do() {
    client := client.NewClient(
        option.WithClientCredentials(
            "YOUR_CLIENT_ID",
            "YOUR_CLIENT_SECRET",
        ),
    )
    request := &payabli.ImportBillsRequest{
        File: strings.NewReader(
            "",
        ),
    }
    client.Import.ImportBills(
        context.TODO(),
        "8cfec329267",
        request,
    )
}

```

```php
<?php

namespace Example;

use Payabli\PayabliClient;
use Payabli\Import\Requests\ImportBillsRequest;
use Payabli\Utils\File;

$client = new PayabliClient(
    clientId: 'YOUR_CLIENT_ID',
    clientSecret: 'YOUR_CLIENT_SECRET',
);
$client->import->importBills(
    '8cfec329267',
    new ImportBillsRequest([
        'file' => File::createFromString("example_file", "example_file"),
    ]),
);

```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "multipart/form-data; boundary=---011000010111000001101001"
]
let parameters = [
  [
    "name": "file",
    "fileName": "<file1>"
  ]
]

let boundary = "---011000010111000001101001"

var body = ""
var error: NSError? = nil
for param in parameters {
  let paramName = param["name"]!
  body += "--\(boundary)\r\n"
  body += "Content-Disposition:form-data; name=\"\(paramName)\""
  if let filename = param["fileName"] {
    let contentType = param["content-type"]!
    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
    if (error != nil) {
      print(error as Any)
    }
    body += "; filename=\"\(filename)\"\r\n"
    body += "Content-Type: \(contentType)\r\n\r\n"
    body += fileContent
  } else if let paramValue = param["value"] {
    body += "\r\n\r\n\(paramValue)"
  }
}

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/Import/billsForm/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()
```

A successful request returns a JSON response with the number of added and rejected records, and any errors. The imported data is now available for use, and you can confirm by checking the Payabli Portal.

### Response (200)

```json
{
  "responseText": "Success",
  "isSuccess": true,
  "pageIdentifier": "null",
  "responseCode": 1,
  "responseData": {
    "added": 26,
    "errors": [
      "errors",
      "errors"
    ],
    "rejected": 2
  }
}
```

The `responseData` object contains the number of records added and rejected. The `errors` field contains any errors that occurred during the import process.

After you import bills, you can manage them with the API. For example, you can update or delete bills, send them for approval, and create payout requests.

## Manage bills

You can also manage your bills via the API. See these endpoint references for more information:

* [Update a bill](/developers/api-reference/bill/update-bill)
* [Delete a bill](/developers/api-reference/bill/delete-bill)
* [Send a bill to approval](/developers/api-reference/bill/send-a-bill-to-approval)
* [Approve a bill](/developers/api-reference/bill/approve-or-disapprove-a-bill)

## Related resources

See these related resources to help you get the most out of Payabli.

#### Prerequisites

* **[Manage vendors with the API](/guides/pay-out-developer-vendors-manage)** - Understanding vendors is important for using the Bills API effectively

#### Next steps

* **[Manage payouts with the API](/guides/pay-out-developer-payouts-manage)** - Making payouts is a good next step after learning about bills

#### References

* **[Pay Out schemas](/guides/pay-out-schemas-overview)** - Learn about money out statuses and events and how they work together
* **[Pay Out statuses](/guides/pay-out-status-reference)** - Learn about Pay Out statuses

#### Related topics

* **[Entities overview](/guides/platform-entities-overview)** - Understand how entities like organizations, sub-organizations, paypoints, customers, and vendors work in Payabli
* **[Manage vendors with the API](/guides/pay-out-developer-vendors-manage)** - Learn how to add and manage vendors with the Payabli API
* **[Use the OCR engine](/guides/pay-ops-developer-ocr-use)** - Learn how to use Payabli's OCR engine via the API to recognize text and import invoices and bills

#### Often confused with

**Manage invoices with the API** - Don't confuse bills with invoices, which are used in Pay In. See [Manage invoices with the API](/guides/pay-in-developer-invoices-manage)