Skip to main content
POST
/
get-invoices
Get invoices
curl --request POST \
  --url https://app.phonely.ai/api/get-invoices \
  --header 'Content-Type: application/json' \
  --data '
{
  "customerId": "<string>"
}
'
import requests

url = "https://app.phonely.ai/api/get-invoices"

payload = { "customerId": "<string>" }
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({customerId: '<string>'})
};

fetch('https://app.phonely.ai/api/get-invoices', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://app.phonely.ai/api/get-invoices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customerId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://app.phonely.ai/api/get-invoices"

payload := strings.NewReader("{\n \"customerId\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://app.phonely.ai/api/get-invoices")
.header("Content-Type", "application/json")
.body("{\n \"customerId\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://app.phonely.ai/api/get-invoices")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"customerId\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "message": "<string>",
  "invoices": {}
}
{
"error": "<string>",
"message": "<string>"
}
{
"error": "<string>",
"message": "<string>"
}
{
"error": "<string>",
"message": "<string>"
}
{
"error": "<string>",
"message": "<string>"
}
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

Last modified on July 11, 2026