Skip to main content

Overview

The Imports API allows you to upload CSV files to import transactions, trades, accounts, categories, and other data into Sure. The import process involves uploading a file, configuring column mappings, and publishing the import.

Authentication

  • List/Show: Requires read or read_write scope
  • Create: Requires read_write scope

Endpoints

List All Imports

GET
/api/v1/imports
Retrieve all imports for the family.
Query Parameters
status
string
Filter by status: pending, complete, importing, reverting, revert_failed, or failed
type
string
Filter by type: TransactionImport, TradeImport, AccountImport, MintImport, CategoryImport, RuleImport, or PdfImport
page
integer
Page number (default: 1)
per_page
integer
Items per page (1-100, default: 25)
Response Returns a paginated list of imports ordered by most recent first.
{
  "data": [
    {
      "id": "1",
      "type": "TransactionImport",
      "status": "complete",
      "created_at": "2024-03-01T10:00:00Z",
      "updated_at": "2024-03-01T10:05:00Z",
      "account_id": "123",
      "rows_count": 45,
      "error": null
    },
    {
      "id": "2",
      "type": "TransactionImport",
      "status": "pending",
      "created_at": "2024-03-04T14:00:00Z",
      "updated_at": "2024-03-04T14:00:00Z",
      "account_id": "456",
      "rows_count": 120,
      "error": null
    }
  ],
  "meta": {
    "current_page": 1,
    "next_page": null,
    "prev_page": null,
    "total_pages": 1,
    "total_count": 2,
    "per_page": 25
  }
}
Example Request
curl -X GET "https://your-domain.com/api/v1/imports?status=complete&page=1&per_page=25" \
  -H "X-Api-Key: your_api_key_here"

Get a Specific Import

GET
/api/v1/imports/:id
Retrieve detailed information about an import.
id
string
required
The unique identifier of the import
Response
{
  "data": {
    "id": "1",
    "type": "TransactionImport",
    "status": "complete",
    "created_at": "2024-03-01T10:00:00Z",
    "updated_at": "2024-03-01T10:05:00Z",
    "account_id": "123",
    "error": null,
    "configuration": {
      "date_col_label": "Date",
      "amount_col_label": "Amount",
      "name_col_label": "Description",
      "category_col_label": "Category",
      "tags_col_label": "Tags",
      "notes_col_label": "Notes",
      "account_col_label": null,
      "date_format": "%Y-%m-%d",
      "number_format": "1,234.56",
      "signage_convention": "inflows_positive"
    },
    "stats": {
      "rows_count": 45,
      "valid_rows_count": 45
    }
  }
}
Example Request
curl -X GET https://your-domain.com/api/v1/imports/1 \
  -H "X-Api-Key: your_api_key_here"

Create an Import

POST
/api/v1/imports
Upload and create a new import.
Request Parameters
type
string
Import type (default: TransactionImport). Options: TransactionImport, TradeImport, AccountImport, MintImport, CategoryImport, RuleImport, PdfImport
account_id
string
ID of the account to associate with this import
file
file
CSV file to upload (max 10MB for CSV, 25MB for PDF)
raw_file_content
string
Alternatively, provide raw CSV content as a string
publish
string
Set to "true" to automatically publish the import after configuration
Configuration Parameters (optional) Response Returns the created import with status 201 Created.
curl -X POST https://your-domain.com/api/v1/imports \
  -H "X-Api-Key: your_api_key_here" \
  -F "type=TransactionImport" \
  -F "account_id=123" \
  -F "[email protected]" \
  -F "date_col_label=Date" \
  -F "amount_col_label=Amount" \
  -F "name_col_label=Description" \
  -F "number_format=1,234.56" \
  -F "signage_convention=inflows_positive"
{
  "type": "TransactionImport",
  "account_id": "123",
  "raw_file_content": "Date,Amount,Description\n2024-01-01,100.00,Salary\n2024-01-02,-50.00,Groceries",
  "date_col_label": "Date",
  "amount_col_label": "Amount",
  "name_col_label": "Description",
  "number_format": "1,234.56",
  "signage_convention": "inflows_positive",
  "publish": "true"
}
{
  "data": {
    "id": "3",
    "type": "TransactionImport",
    "status": "pending",
    "created_at": "2024-03-04T16:00:00Z",
    "updated_at": "2024-03-04T16:00:00Z",
    "account_id": "123",
    "error": null,
    "configuration": {
      "date_col_label": "Date",
      "amount_col_label": "Amount",
      "name_col_label": "Description",
      "category_col_label": null,
      "tags_col_label": null,
      "notes_col_label": null,
      "account_col_label": null,
      "date_format": null,
      "number_format": "1,234.56",
      "signage_convention": "inflows_positive"
    },
    "stats": {
      "rows_count": 2,
      "valid_rows_count": 2
    }
  }
}

Import Types

Import Statuses

Number Formats

Supported number format patterns:
  • 1,234.56 - US/UK/Asia format (comma thousands separator, period decimal)
  • 1.234,56 - Most of Europe (period thousands separator, comma decimal)
  • 1 234,56 - French/Scandinavian (space thousands separator, comma decimal)
  • 1,234 - Zero-decimal currencies like JPY

Error Responses

{
  "error": "not_found",
  "message": "Import not found"
}
{
  "error": "file_too_large",
  "message": "File is too large. Maximum size is 10MB."
}
{
  "error": "invalid_file_type",
  "message": "Invalid file type. Please upload a CSV file."
}
{
  "error": "validation_failed",
  "message": "Import could not be created",
  "errors": ["Account must belong to your family"]
}
{
  "error": "internal_server_error",
  "message": "Error processing import"
}

Important Notes

File Size Limits:
  • CSV files: Maximum 10MB
  • PDF files: Maximum 25MB
Row Limits:
  • Maximum 10,000 rows per import
Accepted MIME Types for CSV: text/csv, text/plain, application/vnd.ms-excel, application/csvAccepted MIME Types for PDF: application/pdf
Auto-Publishing: Set publish=true to automatically process the import after upload. Otherwise, you’ll need to configure column mappings through the web interface before publishing.
Template Reuse: Sure automatically suggests configuration templates based on previous successful imports to the same account, making repeat imports faster.

Build docs developers (and LLMs) love