> 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.

# Replace EBITDA add-back selections

PUT https://api.spreadspace.app/api/borrowers/{borrower_id}/extractions/fin-ebitda-addbacks
Content-Type: application/json

Replaces the add-back selection set for one company scope on the loan; other scopes are untouched. The scope comes from the `entity_key` query parameter (absent means the whole-loan scope); `entity_key` in the body is ignored and `added_by` is null in the response. Limits: at most 100 selections; `key` and `label` at most 512 characters; `source` is `stmt_expense`, `stmt_income` or `write_in`; `years` is 1 to 24 distinct four-digit labels; write-in amounts are non-zero and at most 9,999,999,999,999 per year. A concurrent write to the same scope answers 409.

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

Reference: https://docs.spreadspace.app/api/api-reference/extractions/set-fin-ebitda-addbacks

## 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.

### Query parameters

- `loan_id` (string, required) — The loan's id. Required.
- `entity_key` (string, optional) — The company scope (`business:<folded name>` or `person:<folded name>`, at most 256 characters). Omit for the whole-loan scope.

### Headers

- `Idempotency-Key` (string, optional) — Idempotency token. Retries that reuse the key within 24h replay the original response. Up to 255 characters; a UUID is typical. See [Idempotency](https://docs.spreadspace.app/api/idempotency).
- `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).

### Body (application/json)

This endpoint expects a SetFinEbitdaAddbacksRequest.

- `selections` (list of FinEbitdaAddbackDto, required)

## Response

### 200

OK

- `selections` (list of FinEbitdaAddbackDto, required)

## 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.

### 409 Conflict Error

Conflict: a version mismatch, where `details.current_version` carries the version the resource is actually at so the client can reload and re-apply, or an idempotency key reused with a different request body.

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

### 423 Locked Error

Locked: the resource is frozen and refuses writes until it is reopened. `details.locked_at` says when it was frozen, and `details.locked_by_name` who did it, for callers that may see people's names. `details.entity_key` names the entity a finalized spread holds, present when the hold is entity-scoped.

- `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

### FinEbitdaAddbackDto

- `key` (string, required) — The selected line's opaque key: `fin_pl:&lt;label path&gt;` for a statement line, or `writein:&lt;uuid&gt;` for an analyst write-in. Pass it back unchanged.
- `label` (string, required) — Display label captured when the selection was made; shown when the key no longer resolves against the current extraction.
- `source` (string, required) — Candidate source kind: `stmt_expense` | `stmt_income` | `write_in`. Sets the add-back direction: an expense pick folds back into adjusted EBITDA, an income pick comes out.
- `entity_key` (string, optional, nullable) — Which of the loan's companies the pick belongs to: an entity key (`business:&lt;folded name&gt;`), or `""` for the whole-loan scope. Read-only on the wire: the GET returns every scope's rows in one pass and callers group by this field; the PUT takes its scope from the `entity_key` query parameter, not from the body, and ignores this field.
- `years` (list of string, optional, nullable) — Fiscal years the pick applies to (four-digit year labels, e.g. `"2023"`). Null means every year; new saves always carry explicit years.
- `write_in_amounts` (map from string to string, optional, nullable) — Write-in amounts by four-digit fiscal year label (source `write_in` only): the analyst's free-typed signed dollars. Positive folds into adjusted EBITDA, negative comes out. Null on every statement-resolved selection.
- `added_by` (string, optional, nullable) — Display name of the analyst who first added this selection, resolved from the row's author at read time, `write_in` selections only. Null when the author no longer resolves or the caller may not see names. Read-only: ignored on PUT.

### 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

**Request**

```json
{
  "selections": [
    {
      "key": "fin_pl:Expenses > Officer compensation",
      "label": "Officer compensation",
      "source": "stmt_expense",
      "entity_key": "",
      "years": [
        "2023"
      ]
    },
    {
      "key": "writein:6f1d2c3b-4a59-4e8f-9c0d-1e2f3a4b5c6d",
      "label": "One-time legal settlement",
      "source": "write_in",
      "entity_key": "",
      "years": [
        "2023"
      ],
      "write_in_amounts": {
        "2023": "12500.00"
      }
    }
  ]
}
```

**Response**

```json
{
  "selections": [
    {
      "key": "fin_pl:Expenses > Officer compensation",
      "label": "Officer compensation",
      "source": "stmt_expense",
      "entity_key": "",
      "years": [
        "2023"
      ],
      "write_in_amounts": null,
      "added_by": null
    },
    {
      "key": "writein:6f1d2c3b-4a59-4e8f-9c0d-1e2f3a4b5c6d",
      "label": "One-time legal settlement",
      "source": "write_in",
      "entity_key": "",
      "years": [
        "2023"
      ],
      "write_in_amounts": {
        "2023": "12500.00"
      },
      "added_by": null
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.spreadspace.app/api/borrowers/9f8e7d6c5b4a3210a1b2c3d4/extractions/fin-ebitda-addbacks"

querystring = {"loan_id":"9f8b7c6d5e4a3b2c1d0e4f5a"}

payload = { "selections": [
        {
            "key": "fin_pl:Expenses > Officer compensation",
            "label": "Officer compensation",
            "source": "stmt_expense",
            "entity_key": "",
            "years": ["2023"]
        },
        {
            "key": "writein:6f1d2c3b-4a59-4e8f-9c0d-1e2f3a4b5c6d",
            "label": "One-time legal settlement",
            "source": "write_in",
            "entity_key": "",
            "years": ["2023"],
            "write_in_amounts": { "2023": "12500.00" }
        }
    ] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers, params=querystring)

print(response.json())
```

```javascript
const url = 'https://api.spreadspace.app/api/borrowers/9f8e7d6c5b4a3210a1b2c3d4/extractions/fin-ebitda-addbacks?loan_id=9f8b7c6d5e4a3b2c1d0e4f5a';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"selections":[{"key":"fin_pl:Expenses > Officer compensation","label":"Officer compensation","source":"stmt_expense","entity_key":"","years":["2023"]},{"key":"writein:6f1d2c3b-4a59-4e8f-9c0d-1e2f3a4b5c6d","label":"One-time legal settlement","source":"write_in","entity_key":"","years":["2023"],"write_in_amounts":{"2023":"12500.00"}}]}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.spreadspace.app/api/borrowers/9f8e7d6c5b4a3210a1b2c3d4/extractions/fin-ebitda-addbacks?loan_id=9f8b7c6d5e4a3b2c1d0e4f5a"

	payload := strings.NewReader("{\n  \"selections\": [\n    {\n      \"key\": \"fin_pl:Expenses > Officer compensation\",\n      \"label\": \"Officer compensation\",\n      \"source\": \"stmt_expense\",\n      \"entity_key\": \"\",\n      \"years\": [\n        \"2023\"\n      ]\n    },\n    {\n      \"key\": \"writein:6f1d2c3b-4a59-4e8f-9c0d-1e2f3a4b5c6d\",\n      \"label\": \"One-time legal settlement\",\n      \"source\": \"write_in\",\n      \"entity_key\": \"\",\n      \"years\": [\n        \"2023\"\n      ],\n      \"write_in_amounts\": {\n        \"2023\": \"12500.00\"\n      }\n    }\n  ]\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	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/9f8e7d6c5b4a3210a1b2c3d4/extractions/fin-ebitda-addbacks?loan_id=9f8b7c6d5e4a3b2c1d0e4f5a")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"selections\": [\n    {\n      \"key\": \"fin_pl:Expenses > Officer compensation\",\n      \"label\": \"Officer compensation\",\n      \"source\": \"stmt_expense\",\n      \"entity_key\": \"\",\n      \"years\": [\n        \"2023\"\n      ]\n    },\n    {\n      \"key\": \"writein:6f1d2c3b-4a59-4e8f-9c0d-1e2f3a4b5c6d\",\n      \"label\": \"One-time legal settlement\",\n      \"source\": \"write_in\",\n      \"entity_key\": \"\",\n      \"years\": [\n        \"2023\"\n      ],\n      \"write_in_amounts\": {\n        \"2023\": \"12500.00\"\n      }\n    }\n  ]\n}"

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.put("https://api.spreadspace.app/api/borrowers/9f8e7d6c5b4a3210a1b2c3d4/extractions/fin-ebitda-addbacks?loan_id=9f8b7c6d5e4a3b2c1d0e4f5a")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"selections\": [\n    {\n      \"key\": \"fin_pl:Expenses > Officer compensation\",\n      \"label\": \"Officer compensation\",\n      \"source\": \"stmt_expense\",\n      \"entity_key\": \"\",\n      \"years\": [\n        \"2023\"\n      ]\n    },\n    {\n      \"key\": \"writein:6f1d2c3b-4a59-4e8f-9c0d-1e2f3a4b5c6d\",\n      \"label\": \"One-time legal settlement\",\n      \"source\": \"write_in\",\n      \"entity_key\": \"\",\n      \"years\": [\n        \"2023\"\n      ],\n      \"write_in_amounts\": {\n        \"2023\": \"12500.00\"\n      }\n    }\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.spreadspace.app/api/borrowers/9f8e7d6c5b4a3210a1b2c3d4/extractions/fin-ebitda-addbacks?loan_id=9f8b7c6d5e4a3b2c1d0e4f5a', [
  'body' => '{
  "selections": [
    {
      "key": "fin_pl:Expenses > Officer compensation",
      "label": "Officer compensation",
      "source": "stmt_expense",
      "entity_key": "",
      "years": [
        "2023"
      ]
    },
    {
      "key": "writein:6f1d2c3b-4a59-4e8f-9c0d-1e2f3a4b5c6d",
      "label": "One-time legal settlement",
      "source": "write_in",
      "entity_key": "",
      "years": [
        "2023"
      ],
      "write_in_amounts": {
        "2023": "12500.00"
      }
    }
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.spreadspace.app/api/borrowers/9f8e7d6c5b4a3210a1b2c3d4/extractions/fin-ebitda-addbacks?loan_id=9f8b7c6d5e4a3b2c1d0e4f5a");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"selections\": [\n    {\n      \"key\": \"fin_pl:Expenses > Officer compensation\",\n      \"label\": \"Officer compensation\",\n      \"source\": \"stmt_expense\",\n      \"entity_key\": \"\",\n      \"years\": [\n        \"2023\"\n      ]\n    },\n    {\n      \"key\": \"writein:6f1d2c3b-4a59-4e8f-9c0d-1e2f3a4b5c6d\",\n      \"label\": \"One-time legal settlement\",\n      \"source\": \"write_in\",\n      \"entity_key\": \"\",\n      \"years\": [\n        \"2023\"\n      ],\n      \"write_in_amounts\": {\n        \"2023\": \"12500.00\"\n      }\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["selections": [
    [
      "key": "fin_pl:Expenses > Officer compensation",
      "label": "Officer compensation",
      "source": "stmt_expense",
      "entity_key": "",
      "years": ["2023"]
    ],
    [
      "key": "writein:6f1d2c3b-4a59-4e8f-9c0d-1e2f3a4b5c6d",
      "label": "One-time legal settlement",
      "source": "write_in",
      "entity_key": "",
      "years": ["2023"],
      "write_in_amounts": ["2023": "12500.00"]
    ]
  ]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.spreadspace.app/api/borrowers/9f8e7d6c5b4a3210a1b2c3d4/extractions/fin-ebitda-addbacks?loan_id=9f8b7c6d5e4a3b2c1d0e4f5a")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```