(invoices)
- list - List all invoices
- get_invoices_payment_status - Payment status
- summary - Invoice summary
- get - Retrieve a invoice
- delete - Delete a invoice
Retrieve a list of invoices for the authenticated team.
from midday import Midday
with Midday(
token="MIDDAY_API_KEY",
) as m_client:
res = m_client.invoices.list(cursor="25", sort=[
"createdAt",
"desc",
], page_size=25, q="Acme", start="2024-01-01", end="2024-01-31", statuses=[
"paid",
"unpaid",
], customers=[
"customer-uuid-1",
"customer-uuid-2",
])
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
cursor |
OptionalNullable[str] | ➖ | N/A | 25 |
sort |
List[str] | ➖ | N/A | [ "createdAt", "desc" ] |
page_size |
Optional[float] | ➖ | N/A | 25 |
q |
OptionalNullable[str] | ➖ | N/A | Acme |
start |
OptionalNullable[str] | ➖ | N/A | 2024-01-01 |
end |
OptionalNullable[str] | ➖ | N/A | 2024-01-31 |
statuses |
List[str] | ➖ | N/A | [ "paid", "unpaid" ] |
customers |
List[str] | ➖ | N/A | [ "customer-uuid-1", "customer-uuid-2" ] |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
Get payment status for the authenticated team.
from midday import Midday
with Midday(
token="MIDDAY_API_KEY",
) as m_client:
res = m_client.invoices.get_invoices_payment_status()
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.GetInvoicesPaymentStatusResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
Get summary of invoices for the authenticated team.
from midday import Midday, models
with Midday(
token="MIDDAY_API_KEY",
) as m_client:
res = m_client.invoices.summary(status=models.GetInvoiceSummaryStatus.PAID)
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
status |
Optional[models.GetInvoiceSummaryStatus] | ➖ | Filter summary by invoice status | paid |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
List[models.GetInvoiceSummaryResponse]
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
Retrieve a invoice by its unique identifier for the authenticated team.
from midday import Midday
with Midday(
token="MIDDAY_API_KEY",
) as m_client:
res = m_client.invoices.get(id="<id>")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
id |
str | ✔️ | N/A |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
Delete an invoice by its unique identifier for the authenticated team. Only invoices with status 'draft' or 'canceled' can be deleted directly. If the invoice is not in one of these statuses, update its status to 'canceled' before attempting deletion.
from midday import Midday
with Midday(
token="MIDDAY_API_KEY",
) as m_client:
res = m_client.invoices.delete(id="<id>")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
id |
str | ✔️ | N/A |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |