POST
/
get-invoices
Get invoices
curl --request POST \
  --url https://app.phonely.ai/api/get-invoices \
  --header 'Content-Type: application/json' \
  --data '{
  "customerId": "<string>"
}'
{
  "message": "<string>",
  "invoices": {}
}
Retrieves billing invoices for a specific customer from Stripe.

Request

Method: POST
Endpoint: /api/get-invoices
Headers:
  • Content-Type: application/json
  • Origin: Must match the configured app URL
Request Body:
{
  "customerId": "string"
}
Parameters:
  • customerId (string, required): The Stripe customer ID

Response

Success Response (200):
{
  "message": "Invoices retrieved.",
  "invoices": {
    "object": "list",
    "data": [
      {
        "id": "string",
        "object": "invoice",
        "amount_due": number,
        "amount_paid": number,
        "amount_remaining": number,
        "currency": "string",
        "customer": "string",
        "date": number,
        "due_date": number,
        "paid": boolean,
        "status": "string",
        "total": number
      }
    ],
    "has_more": boolean,
    "url": "string"
  }
}
Error Responses:
  • 400 Bad Request: Customer ID is required
  • 403 Forbidden: Unauthorized origin
  • 404 Not Found: Invoices not found
  • 500 Internal Server Error: Server error

Example

curl -X POST https://app.phonely.ai/api/get-invoices \
  -H "Content-Type: application/json" \
  -H "Origin: https://app.phonely.ai" \
  -d '{
    "customerId": "cus_xxxxxxxxxxxxxxxxx"
  }'

Notes

  • This endpoint requires the request to come from the configured app URL
  • Returns Stripe invoice objects with full billing details
  • Only accessible from the official Phonely application

Body

application/json
customerId
string
required

Stripe customer ID

Response

Successful response

message
string

Response message

invoices
object

Stripe invoices object