Copy a table’s structure with the Inbound API
Create an empty personal test table from an existing table’s fields and verify that the copy has no records.
Use a simple test table with standalone fields. The API key’s acting user needs access to the source table, permission to export from it, and permission to create the destination table. The copy is a personal table in the same workspace.
Prepare the copy
- Read the source with
GET /entities/{entityId}. Savedata.updatedAtasNIXA_SOURCE_UPDATED_AT. Use the base URL from API Access and load the key from your secret manager. - Replace
123with the source table’s ID. SetcopyRecordsexplicitly tofalseto create an empty copy. Leaving it out requests a record copy.
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\":\"duplicate_table\",\"entityId\":123,\"name\":\"api_structure_copy\",\"displayName\":\"API structure copy\",\"copyRecords\":false,\"sourceSchemaVersion\":\"${NIXA_SOURCE_UPDATED_AT}\"}}"
HTTP 201 returns the proposal in data. Proceed when data.status is ready and data.operations shows the expected new table and fields. Mainbase can adjust the proposed name to make it unique, so keep the name shown in the reviewed proposal. Review data.issues and data.impact before applying. Saved views and table relationships need to be configured on the copy. Formulas that depend on related records can prevent preparation.
Apply and verify the empty table
Set NIXA_PROPOSAL_ID and NIXA_PROPOSAL_HASH from the reviewed proposal. Use a unique NIXA_APPLICATION_KEY for this application.
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}"
- Save
data.application.applicationIdfrom the response and checkGET /schema-changes/applications/{applicationId}untildata.statusisverified. If it isfailedorrecovery_required, check that application before preparing another copy. - Find the reviewed destination name in
GET /entitiesand use its ID to read the new table’s schema. Checkdata.ownershipTypeisPERSONALand verify its fields. CallGET /entities/{entityId}/recordswith the new table’s ID and confirm thatdatais empty.
If the apply response is interrupted, resend the same proposal ID, hash, application key, and confirmation value. After a conflict, check the application and the destination table before making a new proposal.
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?