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
- Read the test table with
GET /entities/{entityId}. Check thatdata.tableCapabilities.canManageSchemais true and no field has the nameapi_note. Savedata.updatedAtasNIXA_TABLE_UPDATED_ATso the proposal uses the version you reviewed. - Set
NIXA_API_BASE_URLto the base URL from API Access and loadNIXA_API_KEYfrom your secret manager. Replace123with 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\"}}"
- HTTP
201returns the proposal indata. Check thatdata.statusisreadyand reviewdata.operations,data.issues, anddata.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}"
- With HTTP
200or202, savedata.application.applicationId. ReadGET /schema-changes/applications/{applicationId}and checkdata.status. If it isqueued,running, orverifying, check again later. Inspect any issues before attempting another change if it isfailedorrecovery_required. - Once the application is
verified, readGET /entities/{entityId}again. Find the text field indata.fieldsand save itsdataKeyfor 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
Ask Mainbase AI
Ask about any feature in Mainbase. Find a setting, get step-by-step guidance, or troubleshoot a problem.
Open the AI assistantCopy 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?