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.

  1. Read the source table schema with GET /entities/{entityId}. Note the relationship field’s dataKey. The relationship endpoints take that value as fieldId.
  2. Read the source record and note any existing links. In the example, replace 123 and 456 with its table and record IDs, 234 and 567 with the target’s table and record IDs, and FIELD_DATA_KEY with 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"}'
  1. Read the same source record again. Find the outgoing link with the target’s entityId and id. Check that the existing links are still present. The general role requests an ordinary link and prevents this operation from replacing a link or changing a parent.
  1. From the source record’s outgoing link, copy its relationshipId. The link’s id identifies the target record. Use the source record for this operation even if the link is also visible as an incoming link on the target.
  2. Replace 890 with the relationshipId you 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'
  1. 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 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?