Skip to Content
API and MCPResources

Invoices

Create, list, update and void invoices, record payments against them, and get a payment link, with the FieldCamp Invoices API.

The Invoices API creates and reads invoices, records payments against them, voids them, and returns a payment link the customer can pay through. The path is /api/v1/invoices. For the in-app workflow, see Creating invoices.

Reads need the invoices:read scope and writes need invoices:write. Payments have their own scopes: payments:read and payments:write.

How an invoice is structured

  • Header — clientId, title, date, dueDate, poNumber, paymentTerms (days), paymentInstructions, comments, privateNotes, and a document-level discount with discountType (1 = percent, 2 = amount). Also accepted: documentPreFix (the prefix before the invoice number, default INV), clientDetails (a snapshot of the client details printed on the invoice; filled from the client when left out), and markup with markupType, which are stored as sent and do not change the total.
  • Line items — the items array. Each line takes itemId, name, description, quantity, rate (the unit price), taxIds, exemptFromTax, unitType, itemType and code.
  • Totals — subTotal, total, exclusiveTaxAmount and inclusiveTaxAmount are worked out by FieldCamp from the lines, the account's tax rates and the discount.
  • Payment state — paidAmount, paymentStatus (unpaid, partial, paid, overdue, void) and depositDate are read-only. They change when a payment is recorded or the invoice is voided.

FieldCamp does the arithmetic

You do not have to send subTotal or total. If you do send them, they are checked against the server's figures and a mismatch returns 422 with the computed value in error.details. Amounts you send are never stored as they are.

Create an invoice

POST /api/v1/invoices requires clientId and a non-empty items array.

curl -X POST https://api.fieldcamp.ai/api/v1/invoices \
  -H "Authorization: Bearer $FIELDCAMP_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: invoice-2026-0412" \
  -d '{
    "clientId": "665f1c2ab7e4a91d3c0f8a11",
    "title": "Annual HVAC tune-up",
    "date": "2026-05-29",
    "dueDate": "2026-06-12",
    "discount": 5,
    "discountType": 1,
    "items": [
      {
        "itemId": "665f1c2ab7e4a91d3c0f8b22",
        "quantity": 1
      },
      {
        "name": "Filter replacement",
        "quantity": 2,
        "rate": 18.5,
        "taxIds": ["665f1c2ab7e4a91d3c0f8c33"]
      }
    ]
  }'

How a line is filled:

You sendWhat FieldCamp does
itemId onlyTakes the name, description, price, tax-exempt flag and default taxes from that item.
itemId plus name, rate or taxIdsYour values replace the item's defaults for this line.
No itemIdname is required. quantity defaults to 1 and rate to 0.
taxIdsEach must be one of the account's taxes. The tax amount is computed from the rate.
exemptFromTax: trueThe line carries no tax.

Validation:

  • A field the API does not know returns 422 naming it.
  • An itemId or tax ID that is not on the account returns 422.
  • A clientId that is not on the account returns 404.
  • date and dueDate take YYYY-MM-DD or an ISO-8601 timestamp.
  • The invoice number comes from the account's invoice sequence.

The response is the same shape as GET /api/v1/invoices/{id}.

Filtering and paging

GET /api/v1/invoices accepts:

  • clientId — invoices for one client.
  • status — filters on paymentStatus.
  • since — ISO-8601 timestamp; returns invoices whose updatedAt is at or after it. Send it with a timezone (…Z or an offset), or add timezone (an IANA name such as America/Denver) for a zone-less value.
  • limit — default 30, maximum 100.
  • cursor — set to meta.next.cursor from the previous response. meta.next is null on the last page.
  • sort and page — the older offset paging. sort is field:direction on createdAt, updatedAt, total, paymentStatus, dueDate or documentNumber.
curl "https://api.fieldcamp.ai/api/v1/invoices?clientId=$CLIENT_ID&status=unpaid" \
  -H "Authorization: Bearer $FIELDCAMP_API_KEY"

Update an invoice

PUT /api/v1/invoices/{id} is a partial update: send only what changes.

  • Header fields are replaced with the values you send.
  • Changing items, discount or discountType makes FieldCamp work out the totals again.
  • paidAmount and paymentStatus are not accepted here. Sending either returns 422. Record a payment or void the invoice instead.
  • actionStatus (0 pending, 1 approved, 2 declined) can be set on update, not on create.

items can be sent in two forms. Do not mix them in one request.

FormHow it works
ReplaceNo line carries action. The list is the new set: a line with id updates that line, a line without id is added, and lines you leave out are removed.
DeltaEvery line carries action: 1 add, 2 update, 3 remove. Lines you do not mention stay as they are.

An invoice must keep at least one line.

Record a payment

POST /api/v1/invoices/{id}/payments records a payment the same way the Record payment action in FieldCamp does. The key needs payments:write.

curl -X POST https://api.fieldcamp.ai/api/v1/invoices/$INVOICE_ID/payments \
  -H "Authorization: Bearer $FIELDCAMP_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: payment-ext-88213" \
  -d '{
    "amount": 120.50,
    "date": "2026-06-02",
    "method": "Bank transfer",
    "note": "Reference 88213"
  }'
FieldRequiredDescription
amountYesA number greater than 0, and not more than the balance still due.
dateNoYYYY-MM-DD or an ISO-8601 timestamp. Defaults to today.
methodNoFree text, for example Cash or Bank transfer.
noteNoFree text.
paymentTypeCodeNoYour own code for the payment type.

What happens next:

  • The invoice's paidAmount goes up and its paymentStatus is worked out again: partial while a balance remains, paid when it reaches zero.
  • A payment.recorded event is sent, and invoice.paid when the payment settles the invoice. See Webhook events.
  • The response is the payment, with status 201.

Refusals:

StatusWhen
422amount is missing, not a positive number, or more than the balance due. error.details carries balanceDue.
422The body has a field the API does not know.
409The invoice is void.
404The invoice is not on this account.

A payment cannot be changed or deleted through the API.

GET /api/v1/invoices/{id}/payments lists the payments on one invoice. See Payments for the fields and for reading payments across all invoices.

Send an Idempotency-Key

A retried request without one records the payment twice. See Idempotency.

Void an invoice

POST /api/v1/invoices/{id}/void sets paymentStatus to void. It takes no body and needs invoices:write.

  • The invoice keeps its lines and total.
  • A void invoice takes no more payments.
  • An invoice.voided event is sent.
  • The response is the invoice, in the GET /api/v1/invoices/{id} shape.

It returns 409 when the invoice already has a payment recorded against it, or is already void.

Delete an invoice

DELETE /api/v1/invoices/{id} removes the invoice whatever its state and returns { id, deleted: true }. Prefer voiding when you want the invoice to stay in your reports.

If your tenant has connected Stripe, call GET /api/v1/invoices/{id}/payment-link for a payment URL to send to the customer.

It returns four fields:

{
  "success": true,
  "data": {
    "paymentUrl": "https://app.fieldcamp.ai/documentView?token=…&docId=…",
    "invoiceId": "6a84…",
    "amount": 272.5,
    "currency": "usd"
  }
}

What the fields mean:

  • amount is the invoice total, not the balance still due. On a part-paid invoice it is still the full total; the page the customer opens shows the current balance.
  • currency is the invoice's currency, or usd when none is stored.
  • The link's host is app.fieldcamp.ai, or your own link domain when your account has one set up.

The route needs the invoices:read scope. It returns 404 when the invoice is not on this account, and 400 INTEGRATION_NOT_CONNECTED when Stripe is not connected and switched on for payments.

paymentUrl is a FieldCamp-hosted invoice page where the customer pays through your connected Stripe account — it is not a Stripe Checkout URL, so there is no stripePaymentIntentId to reconcile against and no expiresAt.

The link is stable and non-expiring: the view token is minted once per invoice and reused, so calling this endpoint again returns the same URL. That is deliberate — a link already sitting in a customer's inbox keeps working. It is safe to call repeatedly, and safe to store.

curl https://api.fieldcamp.ai/api/v1/invoices/$INVOICE_ID/payment-link \
  -H "Authorization: Bearer $FIELDCAMP_API_KEY"

You can email the same link to the client via two-way text messaging, or embed it in your own customer portal. Stripe handles the card capture; FieldCamp posts the payment back against the invoice automatically and moves paymentStatus from unpaid (or partial) to paid when the balance hits zero. For deposit-style up-front payments, see Deposits and partial payments.

FAQs

Do I have to calculate tax and totals myself? No. Send the lines, the tax IDs and the discount. FieldCamp computes the tax amounts, subTotal and total.

How do I mark an invoice as paid? Record a payment for the balance with POST /api/v1/invoices/{id}/payments. paymentStatus cannot be set directly.

Can I filter the list by both clientId and status? Yes. clientId, status and since can be combined.

What happens if Stripe is not connected? GET /api/v1/invoices/{id}/payment-link returns 400 with code INTEGRATION_NOT_CONNECTED. Connect Stripe via Connect Stripe for online payments and retry.

Troubleshooting

  • 422 on subTotal or total — the figures you sent differ from the server's. Leave both fields out, or send the computed value from error.details.
  • 422 Unknown field(s): paidAmount — payment fields are read-only. Use the payments route.
  • 409 when voiding — the invoice has a payment recorded, or is already void.
  • since not returning new rows — since matches updatedAt, not the invoice date. See Incremental sync.

Endpoints

GET/api/v1/invoices

Authorization

BearerAuth
AuthorizationBearer <token>

JWT from POST /api/auth/login (response.data.token). Tokens do not expire.

In: header

Query Parameters

page?integer

Page number, 1-based.

limit?integer

Rows per page. Values above 100 are clamped to 100.

since?string

Return only rows whose updatedAt is at or after this ISO-8601 timestamp — the incremental-sync cursor. A value that is not a date returns 400 rather than being ignored.

sort?string

Order the result as field:direction. Direction is asc or desc (default desc). Sortable fields: createdAt, updatedAt, total, paymentStatus, dueDate, documentNumber. An unsupported field returns 400.

clientId?string

Return only invoices for this client id.

status?string

Filter by payment status, matched case-insensitively — paid or unpaid. Matching is on the whole value, so paid never also returns unpaid.

Response Body

application/json

application/json

application/json

curl -X GET "https://example.com/api/v1/invoices"
{}
POST/api/v1/invoices

Authorization

BearerAuth
AuthorizationBearer <token>

JWT from POST /api/auth/login (response.data.token). Tokens do not expire.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/api/v1/invoices" \  -H "Content-Type: application/json" \  -d '{}'
{}
GET/api/v1/invoices/{id}

Authorization

BearerAuth
AuthorizationBearer <token>

JWT from POST /api/auth/login (response.data.token). Tokens do not expire.

In: header

Path Parameters

id*string

Response Body

application/json

application/json

curl -X GET "https://example.com/api/v1/invoices/665f1c2ab3e4d5f6a7b8c9d0"
{}
PUT/api/v1/invoices/{id}

Authorization

BearerAuth
AuthorizationBearer <token>

JWT from POST /api/auth/login (response.data.token). Tokens do not expire.

In: header

Path Parameters

id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X PUT "https://example.com/api/v1/invoices/665f1c2ab3e4d5f6a7b8c9d0" \  -H "Content-Type: application/json" \  -d '{}'
{}
DELETE/api/v1/invoices/{id}

Authorization

BearerAuth
AuthorizationBearer <token>

JWT from POST /api/auth/login (response.data.token). Tokens do not expire.

In: header

Path Parameters

id*string

Response Body

application/json

application/json

application/json

curl -X DELETE "https://example.com/api/v1/invoices/665f1c2ab3e4d5f6a7b8c9d0"
{}
GET/api/v1/invoices/{id}/payments

Authorization

BearerAuth
AuthorizationBearer <token>

JWT from POST /api/auth/login (response.data.token). Tokens do not expire.

In: header

Path Parameters

id*string

Query Parameters

limit?integer

1–100, default 50.

cursor?string

meta.next.cursor of the previous page.

updated_since?string

ISO-8601; only rows updated since.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/api/v1/invoices/665f1c2ab3e4d5f6a7b8c9d0/payments"
{  "success": true,  "code": "success.created",  "message": "Client created successfully",  "data": null}
POST/api/v1/invoices/{id}/payments

Authorization

BearerAuth
AuthorizationBearer <token>

JWT from POST /api/auth/login (response.data.token). Tokens do not expire.

In: header

Path Parameters

id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/v1/invoices/665f1c2ab3e4d5f6a7b8c9d0/payments" \  -H "Content-Type: application/json" \  -d '{    "amount": 0  }'
{  "success": true,  "code": "success.created",  "message": "Client created successfully",  "data": null}
POST/api/v1/invoices/{id}/void

Authorization

BearerAuth
AuthorizationBearer <token>

JWT from POST /api/auth/login (response.data.token). Tokens do not expire.

In: header

Path Parameters

id*string

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/v1/invoices/665f1c2ab3e4d5f6a7b8c9d0/void"
{  "success": true,  "code": "success.created",  "message": "Client created successfully",  "data": null}
GET/api/v1/invoices/{id}/payment-link

Authorization

BearerAuth
AuthorizationBearer <token>

JWT from POST /api/auth/login (response.data.token). Tokens do not expire.

In: header

Path Parameters

id*string

Response Body

application/json

application/json

curl -X GET "https://example.com/api/v1/invoices/665f1c2ab3e4d5f6a7b8c9d0/payment-link"
{}

On this page