Search invoices

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

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

ParameterTypeRequiredDescription
limitintegerNoMaximum number of results to return (default: 50, max: 1000)
offsetintegerNoNumber of records to skip (default: 0)
order_bystringNoField to sort by (default: "created_at")
order_directionstringNoSort direction: "asc" or "desc" (default: "desc")
criteriaarrayNoArray of search criteria objects

Search Criteria

Each criteria object supports:

FieldTypeDescription
fieldstringField name to search
valuemixedValue to search for
operatorstringComparison operator

Supported Fields

  • client_id - Filter by client ID
  • status - Invoice status (draft, sent, paid, overdue, cancelled)
  • amount - Invoice total amount
  • currency - Invoice currency
  • due_date - Invoice due date
  • created_at - Creation date
  • updated_at - Last modification date
  • invoice_number - Invoice number
  • description - Invoice description

Operators

  • = - Equals
  • != - Not equals
  • > - Greater than
  • < - Less than
  • >= - Greater than or equal
  • <= - Less than or equal
  • like - Contains text (case-insensitive)
  • in - Value is in array
  • between - 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

  1. Use pagination for large result sets to improve performance
  2. Be specific with your search criteria to reduce response times
  3. Cache results when possible to minimize API calls
  4. Use appropriate limits - don't request more data than you need
  5. Handle errors gracefully and implement retry logic for temporary failures

Related Endpoints

Response
200
Language
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here!