Add or remove one record link with the Inbound API
Select a target on a test record, verify the outgoing link, and remove just that link by its relationship ID.
Use a test table with a Relationships field that accepts multiple records. Pick a source record and a readable target that the field allows. Use an Inbound API key whose acting user can read both records and edit the source’s relationship field.
Add one outgoing link
- Read the source table schema with
GET /entities/{entityId}. Note the relationship field’sdataKey. The relationship endpoints take that value asfieldId. - Read the source record and note any existing links. In the example, replace
123and456with its table and record IDs,234and567with the target’s table and record IDs, andFIELD_DATA_KEYwith the key from the schema. Use the base URL from API Access and load the key from your secret manager.
curl --silent --show-error --fail-with-body \
--request POST "${NIXA_API_BASE_URL}/entities/123/records/456/relationships" \
-H "X-API-Key: ${NIXA_API_KEY}" \
-H 'Content-Type: application/json' \
--data '{"fieldId":"FIELD_DATA_KEY","targetEntityId":234,"targetRecordId":567,"role":"general"}'
- Read the same source record again. Find the outgoing link with the target’s
entityIdandid. Check that the existing links are still present. Thegeneralrole requests an ordinary link and prevents this operation from replacing a link or changing a parent.
Remove just that link
- From the source record’s outgoing link, copy its
relationshipId. The link’sididentifies the target record. Use the source record for this operation even if the link is also visible as an incoming link on the target. - Replace
890with therelationshipIdyou read and send the targeted removal request.
curl --silent --show-error --fail-with-body --get \
--request DELETE "${NIXA_API_BASE_URL}/entities/123/records/456/relationships/890" \
-H "X-API-Key: ${NIXA_API_KEY}" \
--data-urlencode 'fieldId=FIELD_DATA_KEY'
- Read the source record again. Verify that this relationship ID is gone and the other links remain. If Mainbase returns a conflict, read the current record and check the field and link again before retrying.
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?