Prepare a CSV import into a personal table with the Inbound API

Submit a small CSV with its column mapping, then verify the proposed table before applying the import.

Use POST /imports/personal-tables to prepare a new personal table from a CSV. This step uploads the source and creates a proposal and an import session for review. You need access to data imports in the workspace. For a first test, use fictional data in a test workspace.

Prepare a source file and map its columns

The example uses a two-column CSV. Its first line contains the headers.

Name,State
Example item,New
  1. Encode the CSV bytes as Base64 for fileData. The example below already contains the encoded sample. Keep the .csv extension in fileName and set mimeType to text/csv.
  2. Supply one entry in config.worksheets for a CSV. Set destinationName to the name you want to see in Mainbase. Match the original headers exactly in columnMapping and map the chosen titleColumn to title.
  3. Choose one config.importId for this preparation. Keep it with the source file and mapping so you can safely check the same preparation after an interruption.

Send the preparation request and review the result

Use the base URL from API Access and load the API key from your secret manager.

curl --silent --show-error --fail-with-body --include \
  --request POST "${NIXA_API_BASE_URL}/imports/personal-tables" \
  -H "X-API-Key: ${NIXA_API_KEY}" \
  -H 'Content-Type: application/json' \
  --data-binary @- <<'JSON'
{
  "fileName": "example.csv",
  "mimeType": "text/csv",
  "fileData": "TmFtZSxTdGF0ZQpFeGFtcGxlIGl0ZW0sTmV3Cg==",
  "config": {
    "importId": "example-csv-import-001",
    "worksheets": [{
      "worksheetName": "CSV",
      "headerRow": 0,
      "destinationName": "API import example",
      "titleColumn": "Name",
      "columnMapping": { "Name": "title", "State": "state" }
    }]
  }
}
JSON

An HTTP 201 response confirms that the preparation created a session. Save data.importSession.importSessionId and data.importSession.proposalId. Review the proposed table and any issues in data.proposalResource.proposal. You can reload that proposal with GET /schema-changes/proposals/{proposalId}. The session is ready for review when status is awaiting_review. Applying the reviewed proposal is a separate step.

If the response was interrupted, resend the same source and configuration with the same importId and acting user. HTTP 200 with data.resumed: true returns an existing session. If the source or mapping changed, a reused ID can return 409. Check the original session and choose a new ID only for a separate import you intend to prepare.

Check and retry the original import session

Apply a reviewed personal table import with the Inbound API

Ask Mainbase AI

Ask about any feature in Mainbase. Find a setting, get step-by-step guidance, or troubleshoot a problem.

Open the AI assistant

Copy a question to get started

  • How do I create a Kanban view?
  • How do I invite a teammate?
  • Why is a record missing from this view?