Portfolio API
The calls behind the building portfolio import, with curl examples. They are the calls our own app makes.
Preview, can change These pages describe calls that can change. They are not a separate public product.
What this is#
Note. These are the calls our own app makes. They are not a separate public product, there is no REC Verify API key, and they can change. Every call needs a signed in Enterprise user.
Note. The curl examples on this page have not been run against a live API yet. The request shapes are read from the backend code.
Read Authentication first. Responses and errors use the same envelope as the REC Verify API: { "data": ... } on success and { "error": "<code>" } on failure.
Before you call#
Unknown. How an outside reader learns the real API host. The app reads it from its own server settings. Examples here use the placeholder https://<api-host> and never a real address.
export SOLSAT_API="https://<api-host>" export TOKEN="<token>"
Endpoints#
All calls need the token and an Enterprise account.
| Method | Path | What it does | Success | Needs a token |
|---|---|---|---|---|
| GET | /secure/portfolio/imports | List the imports of your organisation. | 200 | Yes |
| POST | /secure/portfolio/imports | Create an import from CSV text or from pasted addresses. | 200 | Yes |
| GET | /secure/portfolio/imports/{id} | Read an import with its buildings, estimate and blockers. | 200 | Yes |
| PATCH | /secure/portfolio/imports/{id}/buildings/{buildingId} | Choose a building, fix an address, or leave a building out. | 200 | Yes |
| POST | /secure/portfolio/imports/{id}/confirm | Confirm the import. Starts the roof analysis. | 200 | Yes |
| GET | /secure/portfolio/imports/{id}/quote | Read the quote for the import. | 200 | Yes |
| GET | /secure/portfolio/imports/{id}/ranking | Ranking of the buildings. Used by the results screens. Documentation in progress. | 200 | Yes |
| GET | /secure/portfolio/imports/{id}/export | CSV export of the results. Documentation in progress. | 200 | Yes |
| POST | /secure/portfolio/imports/{id}/share | Create a share link. Documentation in progress. | 200 | Yes |
| POST | /secure/portfolio/imports/{id}/share/revoke | Revoke share links. Documentation in progress. | 200 | Yes |
| POST | /secure/portfolio/imports/{id}/feasibility | Request feasibility for chosen buildings. Documentation in progress. | 200 | Yes |
Scroll sideways to see all columns
Create an import#
The body is JSON, not a file upload. Give the CSV text in csv, or addresses in pasted.
| Field | Type | Meaning |
|---|---|---|
fileName | string | Optional. The name shown for the import. |
csv | string | The text of the CSV file. When both csv and pasted are sent, csv is used. |
pasted | string | Addresses, one per line. |
mapping | object | Optional, for csv. Column positions counted from 0: name and address are required, buildingType and monthlyBill are optional. |
Scroll sideways to see all columns
The examples that send a file use jq to put the file text into the JSON body. Install jq, or build the body another way.
jq -n --arg fileName eec-portfolio-mock-30-factories.csv \
--rawfile csv eec-portfolio-mock-30-factories.csv \
'{fileName: $fileName, csv: $csv}' |
curl -sS -X POST "$SOLSAT_API/secure/portfolio/imports" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
--data @-curl -sS -X POST "$SOLSAT_API/secure/portfolio/imports" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"pasted":"First address\nSecond address"}'jq -n --arg fileName my-buildings.csv --rawfile csv my-buildings.csv \
'{fileName: $fileName, csv: $csv, mapping: {name: 0, address: 2, buildingType: 1}}' |
curl -sS -X POST "$SOLSAT_API/secure/portfolio/imports" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
--data @-{
"error": "header_mismatch",
"headers": ["Branch", "Type", "Where"],
"preview": ["Bang Na", "Warehouse", "1 Example Road"]
}| Code | Status | Meaning |
|---|---|---|
header_mismatch | 422 | No name column or no address column found. The answer has headers and preview. |
invalid_input | 400 | The body is not valid. |
invalid_file | 400 | The CSV text is not valid CSV. |
empty_file | 400 | There are no rows to import. |
file_too_large | 413 | The text is over 5 MiB. |
too_many_rows | 413 | More than 500 rows. |
Scroll sideways to see all columns
Follow the import#
The create call returns at once and the address checks run in the background. Read the import until estimate.pending is 0.
curl -sS "$SOLSAT_API/secure/portfolio/imports/$IMPORT_ID" \ -H "Authorization: Bearer $TOKEN"
| Field | Meaning |
|---|---|
import | importId, status (draft or confirmed), fileName, duplicatesRemoved, verifiedCount, confirmedAt, createdAt. |
buildings | One entry per row: buildingId, rowNumber, branchName, address, buildingType, monthlyBillThb, verification, candidates, latitude, longitude and, after the analysis, result. |
estimate | Counts: rows, verified, needsChoice, notFound, excluded, pending; the minimum (20) and whether it is met (minimumMet); and the price fields shown in the estimate and on the quote. |
blockers | What blocks the confirm step: verification_pending, choice_required, minimum_not_met. |
government | Whether the import is marked as government work. |
Scroll sideways to see all columns
curl -sS -X PATCH "$SOLSAT_API/secure/portfolio/imports/$IMPORT_ID/buildings/$BUILDING_ID" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"exclude":true}'curl -sS "$SOLSAT_API/secure/portfolio/imports/$IMPORT_ID/quote" \ -H "Authorization: Bearer $TOKEN"
Confirm#
Warning. Confirming an import starts the roof analysis for the verified buildings and tells the SOLSAT sales team, who then send an invoice at the price shown on the quote. No card is charged. Do not confirm a sample file on a live organisation.
curl -sS -X POST "$SOLSAT_API/secure/portfolio/imports/$IMPORT_ID/confirm" \ -H "Authorization: Bearer $TOKEN"
| Code | Status | Meaning |
|---|---|---|
confirm_blocked | 409 | The answer has blockers. Fix them and confirm again. |
import_confirmed | 409 | A building edit after the import was confirmed. |
duplicate_address | 409 | An address change that matches another row of the import. |
invalid_input | 400 | An edit with none or more than one of address, chooseCandidateId, exclude. |
Scroll sideways to see all columns
What we have not checked#
Unknown. The response shapes of ranking, export, share and feasibility, and what each address check costs SOLSAT. This guide does not state them.