post
https://app.investglass.com/new-endpoint-1
Recent Requests
Log in to see full request history
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Loading…
Search Invoices
The InvestGlass API provides powerful search functionality for invoices, allowing you to retrieve specific invoices based on various criteria.
Endpoint
POST /api/v1/invoices/search
Authentication
All requests require authentication using a Bearer token:
Authorization: Bearer <your_access_token>
Search Request
Send a POST request with search parameters in the request body. The search supports multiple criteria and field combinations.
Request Body
{
"limit": 50,
"offset": 0,
"order_by": "created_at",
"order_direction": "desc",
"criteria": [
{
"field": "client_id",
"value": 123,
"operator": "="
},
{
"field": "status",
"value": "paid",
"operator": "="
},
{
"field": "amount",
"value": 1000,
"operator": ">="
}
]
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | No | Maximum number of results to return (default: 50, max: 1000) |
offset | integer | No | Number of records to skip (default: 0) |
order_by | string | No | Field to sort by (default: "created_at") |
order_direction | string | No | Sort direction: "asc" or "desc" (default: "desc") |
criteria | array | No | Array of search criteria objects |
Search Criteria
Each criteria object supports:
| Field | Type | Description |
|---|---|---|
field | string | Field name to search |
value | mixed | Value to search for |
operator | string | Comparison operator |
Supported Fields
client_id- Filter by client IDstatus- Invoice status (draft, sent, paid, overdue, cancelled)amount- Invoice total amountcurrency- Invoice currencydue_date- Invoice due datecreated_at- Creation dateupdated_at- Last modification dateinvoice_number- Invoice numberdescription- Invoice description
Operators
=- Equals!=- Not equals>- Greater than<- Less than>=- Greater than or equal<=- Less than or equallike- Contains text (case-insensitive)in- Value is in arraybetween- Value is between two dates/numbers
Response
Success Response (200 OK)
{
"data": [
{
"id": 12345,
"invoice_number": "INV-2024-001",
"client_id": 123,
"client_name": "Acme Corp",
"amount": 1500.00,
"currency": "USD",
"status": "sent",
"due_date": "2024-02-15",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z",
"description": "Consulting services January 2024"
}
],
"pagination": {
"total": 1,
"limit": 50,
"offset": 0,
"has_more": false
}
}Error Responses
400 Bad Request
{
"error": "invalid_request",
"message": "Invalid search criteria provided",
"details": {
"field": "status",
"issue": "Invalid status value"
}
}401 Unauthorized
{
"error": "unauthorized",
"message": "Invalid or expired access token"
}403 Forbidden
{
"error": "forbidden",
"message": "Insufficient permissions to search invoices"
}Examples
Basic Search by Client
curl -X POST "https://app.investglass.com/api/v1/invoices/search" \
-H "Authorization: Bearer <your_token>" \
-H "Content-Type: application/json" \
-d '{
"criteria": [
{
"field": "client_id",
"value": 123,
"operator": "="
}
]
}'Search by Status and Date Range
curl -X POST "https://app.investglass.com/api/v1/invoices/search" \
-H "Authorization: Bearer <your_token>" \
-H "Content-Type: application/json" \
-d '{
"criteria": [
{
"field": "status",
"value": "overdue",
"operator": "="
},
{
"field": "due_date",
"value": ["2024-01-01", "2024-12-31"],
"operator": "between"
}
],
"order_by": "due_date",
"order_direction": "asc"
}'Advanced Search with Multiple Criteria
curl -X POST "https://app.investglass.com/api/v1/invoices/search" \
-H "Authorization: Bearer <your_token>" \
-H "Content-Type: application/json" \
-d '{
"limit": 25,
"criteria": [
{
"field": "amount",
"value": 500,
"operator": ">="
},
{
"field": "currency",
"value": "USD",
"operator": "="
},
{
"field": "status",
"value": ["sent", "paid"],
"operator": "in"
}
]
}'Rate Limits
The search endpoint is subject to rate limiting:
- 100 requests per minute per API key
- 1000 requests per hour per API key
Best Practices
- Use pagination for large result sets to improve performance
- Be specific with your search criteria to reduce response times
- Cache results when possible to minimize API calls
- Use appropriate limits - don't request more data than you need
- Handle errors gracefully and implement retry logic for temporary failures
Related Endpoints
- Get Invoice - Retrieve a specific invoice by ID
- Create Invoice - Create a new invoice
- Update Invoice - Modify an existing invoice
200
