Skip to content

Latest commit

 

History

History
217 lines (139 loc) · 12 KB

File metadata and controls

217 lines (139 loc) · 12 KB

Invoices

(invoices)

Overview

Available Operations

list

Retrieve a list of invoices for the authenticated team.

Example Usage

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)

Parameters

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.

Response

models.ListInvoicesResponse

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

get_invoices_payment_status

Get payment status for the authenticated team.

Example Usage

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)

Parameters

Parameter Type Required Description
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.GetInvoicesPaymentStatusResponse

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

summary

Get summary of invoices for the authenticated team.

Example Usage

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)

Parameters

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.

Response

List[models.GetInvoiceSummaryResponse]

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

get

Retrieve a invoice by its unique identifier for the authenticated team.

Example Usage

from midday import Midday


with Midday(
    token="MIDDAY_API_KEY",
) as m_client:

    res = m_client.invoices.get(id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
id str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.GetInvoiceByIDResponse

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

delete

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.

Example Usage

from midday import Midday


with Midday(
    token="MIDDAY_API_KEY",
) as m_client:

    res = m_client.invoices.delete(id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
id str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.DeleteInvoiceResponse

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*