Add a text field with the Inbound API

Review a proposed field on a test table, apply the exact change, and verify the field in the table schema.

Use an active test table whose fields the API key’s acting user can manage. This example adds one optional text field.

Prepare and review the field

  1. Read the test table with GET /entities/{entityId}. Check that data.tableCapabilities.canManageSchema is true and no field has the name api_note. Save data.updatedAt as NIXA_TABLE_UPDATED_AT so the proposal uses the version you reviewed.
  2. Set NIXA_API_BASE_URL to the base URL from API Access and load NIXA_API_KEY from your secret manager. Replace 123 with the test table ID.
curl --silent --show-error --fail-with-body \
  --request POST "${NIXA_API_BASE_URL}/schema-changes/proposals" \
  -H "X-API-Key: ${NIXA_API_KEY}" \
  -H 'Content-Type: application/json' \
  --data "{\"operation\":{\"kind\":\"add_field\",\"entityId\":123,\"expectedSchemaVersion\":\"${NIXA_TABLE_UPDATED_AT}\",\"name\":\"api_note\",\"displayName\":\"API note\",\"type\":\"text\"}}"
  1. HTTP 201 returns the proposal in data. Check that data.status is ready and review data.operations, data.issues, and data.impact. Apply only the intended text field addition. If the table version changed, read its current schema and prepare a new proposal.

Apply and verify

Set NIXA_PROPOSAL_ID and NIXA_PROPOSAL_HASH to the reviewed proposal’s full data.proposalId and data.proposalHash. Choose a unique NIXA_APPLICATION_KEY for this application and keep it with both values. Leave confirmDestructive set to false.

curl --silent --show-error --fail-with-body \
  --request POST "${NIXA_API_BASE_URL}/schema-changes/proposals/${NIXA_PROPOSAL_ID}/apply" \
  -H "X-API-Key: ${NIXA_API_KEY}" \
  -H 'Content-Type: application/json' \
  --data "{\"proposalHash\":\"${NIXA_PROPOSAL_HASH}\",\"idempotencyKey\":\"${NIXA_APPLICATION_KEY}\",\"confirmDestructive\":false}"
  1. With HTTP 200 or 202, save data.application.applicationId. Read GET /schema-changes/applications/{applicationId} and check data.status. If it is queued, running, or verifying, check again later. Inspect any issues before attempting another change if it is failed or recovery_required.
  2. Once the application is verified, read GET /entities/{entityId} again. Find the text field in data.fields and save its dataKey for record requests.

If the apply response is interrupted, retry with the same proposal ID, hash, application key, and confirmation value. If Mainbase returns HTTP 409, check the proposal and table schema before preparing another change.

Copy a table’s structure with the Inbound API

Create a personal table with the Inbound API

Rename a table field 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?