> This page is for API.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.spreadspace.app/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.spreadspace.app/_mcp/server.

# Retrieve an AP aging

GET https://api.spreadspace.app/api/borrowers/{borrower_id}/extractions/{doc_id}/ap-aging

Retrieves a single extracted AP aging. Requesting a document of any other type returns a 404.

Requires the `extractions:read` scope. Rate limit: 200 requests per minute per key (the `api` lane).

Reference: https://docs.spreadspace.app/api/api-reference/ap-agings/get-ap-aging

## Authentication

- `Authorization` header (bearer token, required) — Bearer token. Use `ss_live_…` for live data or `ss_test_…` for the sandbox (test mode). See [Authentication](https://docs.spreadspace.app/api/authentication).

## Request

### Path parameters

- `borrower_id` (string, required) — The borrower's id.
- `doc_id` (string, required) — The document's id.

### Headers

- `SpreadSpace-Version` (string, optional) — Pin the API version, e.g. `2026-10-07`. Omit to get the latest. See [Versioning](https://docs.spreadspace.app/api/versioning).

## Response

### 200

OK

- `ApAgingReportData`
  - `report_subtype`: `summary` (Summary)
    - `anomalies` (list of string, required) — Irregularities noted on the report, in words.
    - `as_of_date` (string, required, nullable) — The aging date.
    - `company_name` (string, required, nullable) — The reporting company as printed.
    - `currency` (string, required) — Currency code; USD.
    - `customers` (list of ApAgingReportData_AgingCustomerRow, required) — One entry per counterparty.
    - `document_type` ("ap_aging", required) — Which family of document this is.
    - `grand_totals` (ApAgingReportData_AgingGrandTotals, required) — The printed grand totals.
    - `bucket_columns` (list of ApAgingReportData_AgingBucketColumn, optional, nullable) — The aging columns as the report prints them, in print order.
    - `computed_totals` (ApAgingReportData_AgingSummaryComputedTotals, optional) — The counterparty rows added together, column by column, beside the printed totals.
    - `entity_source` (string, optional) — What names the company when the report heading does not: the page image (`page_image`); absent when the heading names it.
    - `entity_source_sheet` (string, optional) — The sheet of the uploaded workbook that names the company, when this aging's own sheet does not and the workbook names exactly one company; absent otherwise.
    - `formula_census` (ApAgingReportData_AgingFormulaCensus, optional, nullable) — On a spreadsheet aging whose printed total covers only some of its rows, how many rows it covers; null otherwise.
    - `period_source` (string, optional) — Which part of the document dates the report when its printed as-of line states no date: the page image (`page_image`), the file's name (`filename`) or the file's own creation date (`file_metadata`); absent when the as-of line dates the report.
    - `signals` (list of ApAgingReportData_AgingSignal, optional) — Notes about the aging date, when any.
    - `status` (enum, optional) — `RECONCILED` when the printed grand totals equal the rows added together; `FLAGGED` otherwise.
      - Allowed values: `RECONCILED`, `FLAGGED`
  - `report_subtype`: `detail` (Detail)
    - `anomalies` (list of string, required) — Irregularities noted on the report, in words.
    - `as_of_date` (string, required, nullable) — The aging date.
    - `company_name` (string, required, nullable) — The reporting company as printed.
    - `computed_totals` (ApAgingReportData_AgingDetailComputedTotals, required) — The transaction rows added together.
    - `currency` (string, required) — Currency code; USD.
    - `customer_subtotals` (list of ApAgingReportData_AgingCustomerSubtotal, required) — One entry per counterparty.
    - `document_type` ("ap_aging", required) — Which family of document this is.
    - `grand_totals` (ApAgingReportData_AgingGrandTotals, required) — The printed grand totals.
    - `status` (enum, required) — `RECONCILED` when the printed grand total equals the rows added together; `FLAGGED` otherwise.
      - Allowed values: `RECONCILED`, `FLAGGED`
    - `transactions` (list of ApAgingReportData_AgingTransactionRow, required) — One entry per open transaction.
    - `customers` (list of ApAgingReportData_AgingCustomerRow, optional) — Empty on a detail aging.
    - `entity_source` (string, optional) — What names the company when the report heading does not: the page image (`page_image`); absent when the heading names it.
    - `entity_source_sheet` (string, optional) — The sheet of the uploaded workbook that names the company, when this aging's own sheet does not and the workbook names exactly one company; absent otherwise.
    - `period_source` (string, optional) — Which part of the document dates the report when its printed as-of line states no date: the page image (`page_image`), the file's name (`filename`) or the file's own creation date (`file_metadata`); absent when the as-of line dates the report.
    - `signals` (list of ApAgingReportData_AgingSignal, optional) — Notes about the aging date, when any.

## Errors

### 400 Bad Request Error

Bad request: validation failed, the cursor is malformed, or the API version is unknown.

- `error` (ApiErrorBody, required) — Inner body of the canonical API error envelope.

### 401 Unauthorized Error

Unauthorized: the bearer token or API key is missing or invalid.

- `error` (ApiErrorBody, required) — Inner body of the canonical API error envelope.

### 402 Payment Required Error

Payment required: the standard error envelope with `type` `subscription_required` when the workspace has no active or trialing subscription, or `billing_required` where a plan entitlement applies.

- `error` (ApiErrorBody, required) — Inner body of the canonical API error envelope.

### 403 Forbidden Error

Forbidden: authentication succeeded but the caller is not permitted to perform this action, for example an API key missing the required scope, an embed session reaching a loan it was not minted for, or a feature outside the workspace's plan.

- `error` (ApiErrorBody, required) — Inner body of the canonical API error envelope.

### 404 Not Found Error

Not found: the resource does not exist or is not visible to the calling tenant.

- `error` (ApiErrorBody, required) — Inner body of the canonical API error envelope.

### 429 Too Many Requests Error

Too many requests: the rate limit was hit, or an idempotency-key replay is still in progress.

- `error` (ApiErrorBody, required) — Inner body of the canonical API error envelope.

### 500 Internal Server Error

Internal server error: an unexpected failure. Quote the `request_id` in support tickets. A mutation sent with an `Idempotency-Key` replays this fault under that key rather than re-running; confirm the resource state before resending with a new key.

- `error` (ApiErrorBody, required) — Inner body of the canonical API error envelope.

## Types

### ApAgingReportData_AgingCustomerRow

One counterparty row of a summary aging: a customer on a receivables aging, a vendor on a payables aging. A column the report prints beyond the standard tiers appears under its own bucket_ key.

- `customer_name` (string, required, nullable) — The customer, or the vendor on a payables aging.
- `customer_no` (string, optional, nullable) — The counterparty's account number, when printed.
- `terms` (string, optional, nullable) — Payment terms, when printed.
- `status_flag` (string, optional, nullable) — A status mark printed on the row, when any.
- `status` (string, optional, nullable) — The status word printed on the row, when the report has a status column.
- `current` (string, optional, nullable) — Not yet due.
- `bucket_1_30` (string, optional, nullable) — 1 to 30 days past due.
- `bucket_31_60` (string, optional, nullable) — 31 to 60 days past due.
- `bucket_61_90` (string, optional, nullable) — 61 to 90 days past due.
- `bucket_91_plus` (string, optional, nullable) — 91 or more days past due.
- `retainage` (string, optional, nullable) — Retainage held, when the report has the column.
- `prepayments` (string, optional, nullable) — Prepayments on the row, when the report has the column. A credit, counted toward the total like retainage.
- `total` (string, optional, nullable) — The row's total.
- `is_intercompany` (boolean, optional) — True when the counterparty's name shares a distinctive word with the reporting company's name.

### ApAgingReportData_AgingGrandTotals

The report's own printed totals row. Each aged column the report prints beyond the standard five carries its own key.

- `current` (string, optional, nullable) — Printed total of the current column.
- `bucket_1_30` (string, optional, nullable) — Printed total of the 1 to 30 days column.
- `bucket_31_60` (string, optional, nullable) — Printed total of the 31 to 60 days column.
- `bucket_61_90` (string, optional, nullable) — Printed total of the 61 to 90 days column.
- `bucket_91_plus` (string, optional, nullable) — Printed total of the over 90 days column.
- `retainage` (string, optional, nullable) — Printed total of the retainage column.
- `prepayments` (string, optional, nullable) — Printed total of the prepayments column.
- `grand_total` (string, optional, nullable) — The printed grand total.

### ApAgingReportData_AgingBucketColumn

One aged column as the report prints it.

- `key` (string, required) — The key the column's figures carry on each row, for example bucket_91_plus.
- `label` (string, required) — The column heading as printed.

### ApAgingReportData_AgingSummaryComputedTotals

Column sums over the report's rows, kept apart from the printed totals. Each aged column has a matching key ending in _sum.

- `total_sum` (string, required) — The rows' total, stated beside the printed grand total for comparison.
- `current_sum` (string, optional) — The rows' current total, stated beside the printed total for comparison.
- `bucket_1_30_sum` (string, optional) — The rows' 1 to 30 days total, stated beside the printed total for comparison.
- `bucket_31_60_sum` (string, optional) — The rows' 31 to 60 days total, stated beside the printed total for comparison.
- `bucket_61_90_sum` (string, optional) — The rows' 61 to 90 days total, stated beside the printed total for comparison.
- `bucket_91_plus_sum` (string, optional) — The rows' over 90 days total, stated beside the printed total for comparison.
- `retainage_sum` (string, optional) — The rows' retainage total, stated beside the printed total for comparison.
- `prepayments_sum` (string, optional) — The rows' prepayments total, stated beside the printed total for comparison.

### ApAgingReportData_AgingFormulaCensus

Present when the report is a workbook whose printed total is a cell the workbook computes itself from only some of its rows, rather than a typed value: how many rows that total covers, how many it leaves out, and what those left out add up to, so the rows and the printed total can be read together.

- `foots` (boolean, required) — Whether the rows the printed total covers add up to it.
- `rows_in_total` (integer, required) — Number of rows the printed total covers.
- `rows_outside_total` (integer, required) — Number of rows the printed total leaves out.
- `outside_sum` (string, required) — The total column of the rows the printed total leaves out, added together.

### ApAgingReportData_AgingSignal

A note about the report's as-of date.

- `severity` (enum, required) — How much weight the note carries: info or warn.
  - Allowed values: `info`, `warn`
- `code` (enum, required) — The note's identifier.
  - Allowed values: `coverage_unreadable`, `no_reporting_period`, `year_from_file_metadata`, `year_from_filename`, `year_from_page_image`, `year_matches_print_stamp`
- `detail` (string, required) — The note in words.

### ApAgingReportData_AgingDetailComputedTotals

Sums over the open items in the report, kept apart from the printed totals.

- `balance_due_sum` (string, required) — The rows' balance due total, stated beside the printed total for comparison.
- `n_transactions` (integer, required) — Number of open items in the report.

### ApAgingReportData_AgingCustomerSubtotal

One counterparty's subtotal on a detail aging.

- `customer_name` (string, required) — The customer, or the vendor on a payables aging.
- `subtotal` (string, required) — Total balance due across the counterparty's transactions.
- `is_intercompany` (boolean, optional) — True when the counterparty's name shares a distinctive word with the reporting company's name.

### ApAgingReportData_AgingTransactionRow

One open transaction on a detail aging.

- `customer_name` (string, required, nullable) — The customer, or the vendor on a payables aging.
- `transaction_type` (string, required, nullable) — The transaction's kind as printed: invoice, credit, payment.
- `transaction_number` (string, required, nullable) — The transaction's number as printed.
- `transaction_date` (string, required, nullable) — The transaction date as printed.
- `due_date` (string, required, nullable) — The due date as printed.
- `po_number` (string, required, nullable) — Purchase order number, when printed.
- `age_days` (integer, required, nullable) — Days past the transaction or due date at the aging date, as printed.
- `amount` (string, required, nullable) — The transaction's original amount.
- `balance_due` (string, required, nullable) — The open balance.
- `bucket` (enum, optional) — The aging column the row sits under, as the column's key: `current`, `bucket_1_30`, `bucket_31_60`, `bucket_61_90` or `bucket_91_plus`; null when the report prints no aging sections.
  - Allowed values: `current`, `bucket_1_30`, `bucket_31_60`, `bucket_61_90`, `bucket_91_plus`

### ApiErrorBody

Inner body of the canonical API error envelope.

- `type` (string, required) — Stable error type identifier. Pattern-match on this value, not the human-readable message.
- `message` (string, required) — Human-readable error message. Subject to wording changes; do not parse.
- `request_id` (string, optional, nullable) — Per-request correlation ID (matches `X-Request-ID` response header). Quote in support tickets.
- `details` (map from string to string, optional, nullable) — Structured detail. Some error types populate documented keys in every environment: a version conflict (409) carries `current_version`, the version the resource is actually at, so the client can reload and re-apply. Free-form diagnostic detail beyond those keys appears in development environments only. An `insufficient_credits` 402 carries `balance_usd`, `reserved_usd`, `in_flight_docs`, `incoming_docs` and `per_doc_reservation_usd` as decimal strings.

## Examples

**Response**

```json
{
  "report_subtype": "summary",
  "anomalies": [],
  "as_of_date": "2024-12-31",
  "company_name": "Pinnacle Manufacturing LLC",
  "currency": "USD",
  "customers": [
    {
      "customer_name": "Superior Steel Supply",
      "current": "7089.04",
      "bucket_1_30": "3123.76",
      "bucket_31_60": "0.00",
      "bucket_61_90": "3376.09",
      "bucket_91_plus": "0.00",
      "total": "13588.89"
    },
    {
      "customer_name": "National Paper Products",
      "current": "18807.86",
      "bucket_1_30": "0.00",
      "bucket_31_60": "3901.42",
      "bucket_61_90": "0.00",
      "bucket_91_plus": "0.00",
      "total": "22709.28"
    },
    {
      "customer_name": "Pacific Shipping LLC",
      "current": "5447.50",
      "bucket_1_30": "10580.53",
      "bucket_31_60": "0.00",
      "bucket_61_90": "0.00",
      "bucket_91_plus": "0.00",
      "total": "16028.03"
    },
    {
      "customer_name": "Metro Office Solutions",
      "current": "4412.18",
      "bucket_1_30": "0.00",
      "bucket_31_60": "0.00",
      "bucket_61_90": "0.00",
      "bucket_91_plus": "0.00",
      "total": "4412.18"
    },
    {
      "customer_name": "Continental Insurance Corp",
      "current": "14635.42",
      "bucket_1_30": "3792.78",
      "bucket_31_60": "0.00",
      "bucket_61_90": "0.00",
      "bucket_91_plus": "0.00",
      "total": "18428.20"
    },
    {
      "customer_name": "Precision Tool & Die",
      "current": "4734.44",
      "bucket_1_30": "0.00",
      "bucket_31_60": "0.00",
      "bucket_61_90": "0.00",
      "bucket_91_plus": "0.00",
      "total": "4734.44"
    },
    {
      "customer_name": "Allied Chemical Supply",
      "current": "14377.48",
      "bucket_1_30": "13839.31",
      "bucket_31_60": "648.70",
      "bucket_61_90": "3002.79",
      "bucket_91_plus": "1769.76",
      "total": "33638.04"
    },
    {
      "customer_name": "Keystone Power Systems",
      "current": "7856.50",
      "bucket_1_30": "14318.98",
      "bucket_31_60": "6479.71",
      "bucket_61_90": "0.00",
      "bucket_91_plus": "0.00",
      "total": "28655.19"
    }
  ],
  "document_type": "ap_aging",
  "grand_totals": {
    "current": "77360.42",
    "bucket_1_30": "45655.36",
    "bucket_31_60": "11029.83",
    "bucket_61_90": "6378.88",
    "bucket_91_plus": "1769.76",
    "grand_total": "142194.25"
  },
  "bucket_columns": [
    {
      "key": "current",
      "label": "Current"
    },
    {
      "key": "bucket_1_30",
      "label": "1-30 Days"
    },
    {
      "key": "bucket_31_60",
      "label": "31-60 Days"
    },
    {
      "key": "bucket_61_90",
      "label": "61-90 Days"
    },
    {
      "key": "bucket_91_plus",
      "label": "90+ Days"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.spreadspace.app/api/borrowers/3f9c2b1e8d7a4c5b9e0f1a2b/extractions/7a1d4e9c2b3f4a5d8e6c1b0f/ap-aging"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.spreadspace.app/api/borrowers/3f9c2b1e8d7a4c5b9e0f1a2b/extractions/7a1d4e9c2b3f4a5d8e6c1b0f/ap-aging';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

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

func main() {

	url := "https://api.spreadspace.app/api/borrowers/3f9c2b1e8d7a4c5b9e0f1a2b/extractions/7a1d4e9c2b3f4a5d8e6c1b0f/ap-aging"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

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

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

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.spreadspace.app/api/borrowers/3f9c2b1e8d7a4c5b9e0f1a2b/extractions/7a1d4e9c2b3f4a5d8e6c1b0f/ap-aging")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.spreadspace.app/api/borrowers/3f9c2b1e8d7a4c5b9e0f1a2b/extractions/7a1d4e9c2b3f4a5d8e6c1b0f/ap-aging")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.spreadspace.app/api/borrowers/3f9c2b1e8d7a4c5b9e0f1a2b/extractions/7a1d4e9c2b3f4a5d8e6c1b0f/ap-aging', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.spreadspace.app/api/borrowers/3f9c2b1e8d7a4c5b9e0f1a2b/extractions/7a1d4e9c2b3f4a5d8e6c1b0f/ap-aging");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.spreadspace.app/api/borrowers/3f9c2b1e8d7a4c5b9e0f1a2b/extractions/7a1d4e9c2b3f4a5d8e6c1b0f/ap-aging")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```