Synder Importer API
Import CSV/XLSX files into QuickBooks Online or Xero.
Setup
Getting an API Token
If the user doesn't have a token yet, guide them through these steps:
- 1. Create an account at importer.synder.com and confirm your email
- Connect your accounting software — in the web UI, link QuickBooks Online or Xero via OAuth
- Generate an API key — go to Account → API Keys, click Generate. Copy the token immediately — it's shown only once
CODEBLOCK0
Trial users: Imports are limited by row count without a paid subscription. No subscription is required to use the API itself.
Data Privacy
- - Homepage: importer.synder.com | Docs: importer.synder.com/apidocs
- Operator: Synder Technologies Inc. — synder.com
- What's sent: CSV/XLSX files containing accounting data (invoices, bills, journal entries, etc.) are uploaded to importer.synder.com and forwarded to your connected accounting provider (QuickBooks Online or Xero)
- Retention: Uploaded files are stored for import processing only and are not retained after import completion. Import logs (row counts, status, error messages) are retained for your account history.
- Scope: API tokens are scoped to a single user account and its connected companies. Tokens can be revoked at any time from the web UI.
- Recommendation: Always use
dryRun=true first to preview before importing live data. Use non-production data for initial testing.
Quick Reference
| Action | Method | Endpoint |
|---|
| Account info | GET | /account |
| List companies |
GET | /companies |
| Company settings | GET/POST | /companies/{id}/settings |
| List entities | GET | /companies/{id}/entities |
| Entity fields | GET | /companies/{id}/entities/{name}/fields |
| Create mapping | POST | /companies/{id}/mappings |
| List mappings | GET | /companies/{id}/mappings |
| Update mapping | PUT | /companies/{id}/mappings/{mid} |
| Delete mapping | DELETE | /companies/{id}/mappings/{mid} |
| Execute import | POST | /companies/{id}/imports |
| Auto-import | POST | /companies/{id}/imports/auto |
| List imports | GET | /companies/{id}/imports |
| Import status | GET | /companies/{id}/imports/{iid} |
| Cancel import | POST | /companies/{id}/imports/{iid}/cancel |
| Revert import | POST | /companies/{id}/imports/{iid}/revert |
| Import results | GET | /companies/{id}/imports/{iid}/results |
Core Workflow
1. Find the company
CODEBLOCK1
Response is an array. Pick the company with status: "ACTIVE". Save its id.
2. Choose entity and check fields
Common entities: Invoice, Bill, JournalEntry, Customer, Vendor, Expense, SalesReceipt, Payment, INLINECODE11
CODEBLOCK2
Fields with isRequired: true MUST be mapped. Fields with isForGrouping: true (e.g., DocNumber) combine multiple CSV rows into one entity (multi-line invoices).
Important: Check GET /companies/{id}/settings for dateFormat (e.g., MM/dd/yyyy). CSV date columns must match this format or the import will fail. Update with POST /companies/{id}/settings if needed.
3. Option A: Smart Auto-Import (recommended)
Skip manual mapping — auto-match CSV headers to fields:
CODEBLOCK3
- -
dryRun=true (default): Returns proposed mapping without importing. Check missingRequired array — if empty, safe to import. Response: proposedFields, missingRequired, totalFieldsMapped. - INLINECODE23 : Maps AND imports in one call. Returns
{"id": "42", "status": "SCHEDULED", "mappingId": "33", ...} — use the id to poll for completion (same as step 5).
Confidence levels in proposedFields: high = exact title match, medium = matched via alternative title. Review medium matches before importing with dryRun=false.
3. Option B: Manual Mapping
Create a mapping linking CSV columns to entity fields:
CODEBLOCK4
- -
sourceFieldTitle: CSV column header name - INLINECODE32 : from the fields endpoint
- INLINECODE33 : constant value for every row (set
sourceFieldTitle to null)
4. Upload and Execute Import
CODEBLOCK5
Returns 202 with status: "SCHEDULED". Always send Idempotency-Key to prevent duplicate imports on retry.
5. Poll for Completion
CODEBLOCK6
Terminal statuses: FINISHED, FINISHED_WITH_WARNINGS, FAILED, CANCELED.
Poll with exponential backoff: start 2s, multiply 1.5x, cap 30s.
6. Check Results
CODEBLOCK7
Result types: INFO (success), WARNING, ERROR.
File Requirements
- - CSV: UTF-8, comma-delimited, header row required, max 50MB
- XLSX: First sheet by default (use
sheetName param for others), header row required, max 50MB
Error Handling
All errors return {"error": {"code": "...", "message": "..."}}.
| Code | HTTP | Action |
|---|
| UNAUTHORIZED | 401 | Check/refresh API token |
| NOT_FOUND |
404 | Verify company/mapping/import/entity ID |
| BAD_REQUEST | 400 | Check request format, file validity, provider connection |
| VALIDATION_ERROR | 422 | Map all required fields — call GET .../fields to see which |
| DUPLICATE_REQUEST | 409 | Same Idempotency-Key reused within 24h — use new UUID |
| CONFLICT | 409 | Import not in valid state for cancel/revert |
| RATE_LIMITED | 429 | Wait
Retry-After header seconds, then retry |
Rate Limits
- - Standard: 60 requests/minute per account
- Imports: 30 imports/hour per company
Check X-RateLimit-Remaining header. On 429, wait Retry-After seconds.
Tips
- - Use
dryRun=true on auto-import before committing — all operations hit live accounting data - Revert mistakes with
POST .../imports/{id}/revert (deletes created entities from QBO/Xero) - INLINECODE51 on fields show what CSV headers auto-mapping recognizes
- For multi-line entities (invoices with line items), use a grouping field (DocNumber) — rows with same value become one entity
- Paginated endpoints accept
page and perPage (max 100, default 20)
Full API Details
For complete field schemas, response examples, and OpenAPI spec: see references/api.md
Synder Importer API
将 CSV/XLSX 文件导入 QuickBooks Online 或 Xero。
设置
获取 API 令牌
如果用户还没有令牌,请引导他们完成以下步骤:
- 1. 创建账户 — 访问 importer.synder.com 并确认您的邮箱
- 连接您的会计软件 — 在 Web 界面中,通过 OAuth 关联 QuickBooks Online 或 Xero
- 生成 API 密钥 — 前往 账户 → API 密钥,点击 生成。立即复制令牌——它只显示一次
bash
export IMPORTERAPITOKEN=yourtokenhere
export BASE=https://importer.synder.com/api/v1
试用用户:若无付费订阅,导入受行数限制。使用 API 本身无需订阅。
数据隐私
- - 主页:importer.synder.com | 文档:importer.synder.com/apidocs
- 运营方:Synder Technologies Inc. — synder.com
- 发送内容:包含会计数据(发票、账单、日记账分录等)的 CSV/XLSX 文件会上传到 importer.synder.com,并转发至您关联的会计服务提供商(QuickBooks Online 或 Xero)
- 保留政策:上传文件仅用于导入处理,导入完成后不保留。导入日志(行数、状态、错误消息)将保留在您的账户历史中。
- 范围:API 令牌限定于单个用户账户及其关联的公司。可随时在 Web 界面中撤销令牌。
- 建议:在导入真实数据前,始终先使用 dryRun=true 进行预览。初始测试请使用非生产数据。
快速参考
| 操作 | 方法 | 端点 |
|---|
| 账户信息 | GET | /account |
| 列出公司 |
GET | /companies |
| 公司设置 | GET/POST | /companies/{id}/settings |
| 列出实体 | GET | /companies/{id}/entities |
| 实体字段 | GET | /companies/{id}/entities/{name}/fields |
| 创建映射 | POST | /companies/{id}/mappings |
| 列出映射 | GET | /companies/{id}/mappings |
| 更新映射 | PUT | /companies/{id}/mappings/{mid} |
| 删除映射 | DELETE | /companies/{id}/mappings/{mid} |
| 执行导入 | POST | /companies/{id}/imports |
| 自动导入 | POST | /companies/{id}/imports/auto |
| 列出导入 | GET | /companies/{id}/imports |
| 导入状态 | GET | /companies/{id}/imports/{iid} |
| 取消导入 | POST | /companies/{id}/imports/{iid}/cancel |
| 回滚导入 | POST | /companies/{id}/imports/{iid}/revert |
| 导入结果 | GET | /companies/{id}/imports/{iid}/results |
核心工作流程
1. 查找公司
bash
curl $BASE/companies -H Authorization: Bearer $IMPORTERAPITOKEN
返回一个数组。选择 status: ACTIVE 的公司。保存其 id。
2. 选择实体并检查字段
常见实体:Invoice、Bill、JournalEntry、Customer、Vendor、Expense、SalesReceipt、Payment、CreditMemo
bash
curl $BASE/companies/$CID/entities/$ENTITY/fields -H Authorization: Bearer $IMPORTERAPITOKEN
isRequired: true 的字段必须映射。isForGrouping: true 的字段(例如 DocNumber)将多个 CSV 行合并为一个实体(多行发票)。
重要:检查 GET /companies/{id}/settings 中的 dateFormat(例如 MM/dd/yyyy)。CSV 日期列必须与此格式匹配,否则导入将失败。如有需要,使用 POST /companies/{id}/settings 进行更新。
3. 选项 A:智能自动导入(推荐)
跳过手动映射——自动匹配 CSV 表头与字段:
bash
curl -X POST $BASE/companies/$CID/imports/auto \
-H Authorization: Bearer $IMPORTERAPITOKEN \
-F file=@data.csv \
-F entityName=Invoice \
-F dryRun=true
- - dryRun=true(默认):返回建议的映射而不导入。检查 missingRequired 数组——如果为空,则可以安全导入。响应:proposedFields、missingRequired、totalFieldsMapped。
- dryRun=false:在一次调用中完成映射和导入。返回 {id: 42, status: SCHEDULED, mappingId: 33, ...}——使用 id 轮询完成状态(同步骤 5)。
proposedFields 中的置信度:high = 精确标题匹配,medium = 通过替代标题匹配。在使用 dryRun=false 导入前,请检查 medium 匹配项。
3. 选项 B:手动映射
创建映射,将 CSV 列与实体字段关联:
bash
curl -X POST $BASE/companies/$CID/mappings \
-H Authorization: Bearer $IMPORTERAPITOKEN \
-H Content-Type: application/json \
-d {
title: 我的发票映射,
entityName: Invoice,
fields: [
{sourceFieldTitle: 发票编号, targetFieldId: 231},
{sourceFieldTitle: 客户, targetFieldId: 176},
{sourceFieldTitle: null, targetFieldId: 234, fixedValue: 通过 API 导入}
]
}
- - sourceFieldTitle:CSV 列标题名称
- targetFieldId:来自字段端点
- fixedValue:每行的常量值(将 sourceFieldTitle 设置为 null)
4. 上传并执行导入
bash
curl -X POST $BASE/companies/$CID/imports \
-H Authorization: Bearer $IMPORTERAPITOKEN \
-H Idempotency-Key: $(uuidgen) \
-F file=@data.csv \
-F mappingId=$MAPPING_ID
返回 202,状态为 status: SCHEDULED。始终发送 Idempotency-Key,以防止重试时重复导入。
5. 轮询完成状态
bash
curl $BASE/companies/$CID/imports/$IMPORTID -H Authorization: Bearer $IMPORTERAPI_TOKEN
最终状态:FINISHED、FINISHEDWITHWARNINGS、FAILED、CANCELED。
使用指数退避轮询:起始 2 秒,乘以 1.5 倍,上限 30 秒。
6. 检查结果
bash
所有结果
curl $BASE/companies/$CID/imports/$IMPORT
ID/results -H Authorization: Bearer $IMPORTERAPI_TOKEN
仅错误
curl $BASE/companies/$CID/imports/$IMPORT
ID/results?type=ERROR -H Authorization: Bearer $IMPORTERAPI_TOKEN
结果类型:INFO(成功)、WARNING、ERROR。
文件要求
- - CSV:UTF-8 编码,逗号分隔,需要标题行,最大 50MB
- XLSX:默认使用第一个工作表(其他工作表使用 sheetName 参数),需要标题行,最大 50MB
错误处理
所有错误返回 {error: {code: ..., message: ...}}。
| 代码 | HTTP | 操作 |
|---|
| UNAUTHORIZED | 401 | 检查/刷新 API 令牌 |
| NOT_FOUND |
404 | 验证公司/映射/导入/实体 ID |
| BAD_REQUEST | 400 | 检查请求格式、文件有效性、提供商连接 |
| VALIDATION_ERROR | 422 | 映射所有必填字段——调用 GET .../fields 查看哪些字段 |
| DUPLICATE_REQUEST | 409 | 同一 Idempotency-Key 在 24 小时内重复使用——使用新的 UUID |
| CONFLICT | 409 | 导入状态无效,无法取消/回滚 |
| RATE_LIMITED | 429 | 等待 Retry-After 响应头指定的秒