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

# Accounts Payable Workflows

> How to create, modify, pay and void bills in Campfire

<Info>All requests in this flow assume you have a valid access token attached in your request headers. See our [authentication guide](/quickstart) for more information.</Info>

## Creating a bill

This section will guide you through the process of creating a bill in Campfire.

<Steps>
  <Step title="Fetch related data">
    We'll need to grab some object references for related objects to create our bill. We'll need to pass in the id's of the related objects where applicable in the bill creation request. Linked here are the filter endpoints for the applicable objects. These include:

    * [Accounts (Expense Account on the Line Items)(Required)](/api-reference/company-objects/list-chart-accounts)
    * [Vendors (Required)](/api-reference/company-objects/list-vendors)
    * [Entities (Required)](/api-reference/settings/list-chart-entities)
    * [Departments (Optional)](/api-reference/company-objects/list-departments)
    * [Custom Dimension Fields (Optional)](/api-reference/company-objects/list-custom-dimensions)
  </Step>

  <Step title="Assemble the request">
    We can now create our request body by filling in the related fields. Here are the required fields:

    | Field                | Description                                                                                                 | Example                            |
    | -------------------- | ----------------------------------------------------------------------------------------------------------- | ---------------------------------- |
    | `terms`              | Payment terms (default is net\_30, can be: 7, 10, 15, 20, 30, 40, 45, 60, 90, 105, 120 or due\_on\_receipt) | `"net_30"`                         |
    | `bill_date`          | Accounting date for the bill in YYYY-MM-DD format                                                           | `"2025-07-01"`                     |
    | `due_date`           | Due date for the bill in YYYY-MM-DD format                                                                  | `"2025-08-25"`                     |
    | `lines`              | Array of line items for the bill                                                                            | See line item fields below         |
    | `entity`             | ID from entity                                                                                              | `"5"`                              |
    | `currency`           | Currency code                                                                                               | `"USD"`                            |
    | `exchange_rate_book` | Exchange rate between transactional and entity currency (auto-computed if not provided)                     | `1`                                |
    | `exchange_rate`      | Exchange rate between entity and consolidation currency (auto-computed if not provided)                     | `1.373`                            |
    | `vendor`             | ID from vendor                                                                                              | `"34182"`                          |
    | `bill_number`        | Bill number                                                                                                 | `"098765"`                         |
    | `item_date`          | Bill date in YYYY-MM-DD format                                                                              | `"2025-07-01"`                     |
    | `message_on_bill`    | Message to display on bill                                                                                  | `"Bill Message"`                   |
    | `mailing_address`    | Free text address                                                                                           | `"1234 Main St. San Francisco CA"` |

    **Line Item Fields:**

    | Field           | Description                                    | Example            |
    | --------------- | ---------------------------------------------- | ------------------ |
    | `tags`          | Array of custom dimension field IDs (optional) | `[{"id": "8114"}]` |
    | `account`       | ID from accounts (expense account)             | `"180564"`         |
    | `amount`        | Line item amount                               | `10000`            |
    | `description`   | Line item description                          | `"Line Desc"`      |
    | `bill_customer` | ID from vendor                                 | `"34182"`          |
    | `department`    | ID from department (optional)                  | `"35"`             |

    Example request body:

    ```json theme={null}
    {
        "terms": "net_30",
        "bill_date": "2025-07-01",
        "due_date": "2025-08-25",
        "lines": [
            {
                "tags": [
                    {
                        "id": "8114"
                    }
                ],
                "account": "180564",
                "amount": 10000,
                "description": "Line Desc",
                "bill_customer": "34182",
                "department": "35"
            }
        ],
        "entity": "5",
        "currency": "USD",
        "exchange_rate_book": 1,
        "exchange_rate": 1.373,
        "vendor": "34182",
        "bill_number": "098765",
        "item_date": "2025-07-01",
        "message_on_bill": "Bill Message",
        "mailing_address": "1234 Main St. San Francisco CA"
    }
    ```
  </Step>

  <Step title="Post the bill">
    Now that we have the request we can post it via the [Create Bill](/api-reference/accounts-payable/create-accounting-bill) endpoint.

    Congrats! You've created your first bill!
  </Step>
</Steps>

## Paying a Bill

This section will walk you through posting a payment to a bill.

<Steps>
  <Step title="Get a Journal & Transaction">
    We need to get a transaction id to reference in the payment.

    You have two options for this:

    * [Creating a Journal, and using one of its transactions](/guides/journal-entries)
    * [Finding Existing Transactions](/api-reference/core-accounting/list-chart-transactions)
  </Step>

  <Step title="Assembling the payment">
    Now that we have a transaction id, we can create our payment request body.

    Payments that don't use the full amount of a transaction will bump out a new line of the journal based on the referenced transaction.

    <Tip>You can apply multiple transactions to a bill at the same time. Each transaction will be a separate payment.</Tip>

    | Field            | Description                                                                  | Example  |
    | ---------------- | ---------------------------------------------------------------------------- | -------- |
    | `transaction_id` | ID from transaction                                                          | `"1234"` |
    | `amount`         | Payment amount                                                               | `10000`  |
    | `account`        | ID from account (If you want to categorize the transaction at the same time) | `"1234"` |

    Example request body:

    ```json theme={null}
    {
        "transactions": [
            {
                "transaction_id": 21069178,
                "account_id": "2550",
                "amount": 8999.99
            }
        ],
    }
    ```
  </Step>

  <Step title="Post the payment">
    Now that we have the request we can post it via the [Create Payment](/api-reference/accounts-payable/mark-bill-as-paid) endpoint.

    Congrats! You've paid your bill!
  </Step>
</Steps>
