Skip to content

docs: clarify v2 contact API request body shapes (#1089)#7552

Merged
jobenjada merged 2 commits intomainfrom
chore/clarify-contact-bulk
Mar 20, 2026
Merged

docs: clarify v2 contact API request body shapes (#1089)#7552
jobenjada merged 2 commits intomainfrom
chore/clarify-contact-bulk

Conversation

@xernobyl
Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes #1089

This PR clarifies the request body shapes for the V2 contacts endpoints in the API docs.

While investigating the issue, I verified that the current bulk endpoint PUT /api/v2/management/contacts/bulk still works with the nested payload shape shown in the cURL example:

  • environmentId
  • contacts[]
  • contacts[].attributes[]
  • contacts[].attributes[].attributeKey
  • contacts[].attributes[].value

The confusion came from the docs experience around the two contacts endpoints:

  • POST /management/contacts expects a top-level attributes object
  • PUT /management/contacts/bulk expects contacts[].attributes[]

The issue report showed a 422 response with attributes marked as required, which matches the single-contact request shape more closely than the bulk request shape. To make that distinction clearer, this PR updates the endpoint descriptions and request-body descriptions in the generated OpenAPI source and the checked-in OpenAPI YAML.

Changes made:

  • Clarified that PUT /management/contacts/bulk requires the nested bulk payload shape and does not accept a top-level attributes object
  • Clarified that POST /management/contacts is the single-contact endpoint and uses a top-level attributes object
  • Added wording that points readers from the single-contact endpoint to the bulk endpoint when uploading multiple contacts

How should this be tested?

  • Open the V2 API docs for PUT /management/contacts/bulk and confirm the description clearly states that the endpoint expects contacts[].attributes[]
  • Open the V2 API docs for POST /management/contacts and confirm the description clearly states that the endpoint expects a top-level attributes object
  • Confirm the checked-in OpenAPI YAML contains the same wording as the source OpenAPI definitions

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read How we Code at Formbricks
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand bits
  • Ran pnpm build
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues
  • First PR at Formbricks? Please sign the CLA! Without it we wont be able to merge it 🙏

Appreciated

  • If a UI change was made: Added a screen recording or screenshots to this PR
  • Updated the Formbricks Docs if changes were necessary

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 20, 2026

Walkthrough

This change updates OpenAPI documentation across three files to clarify the request payload structure for contact management endpoints. The single contact creation endpoint (POST /management/contacts) expects a top-level attributes object, while the bulk upload endpoint (PUT /management/contacts/bulk) expects contacts within a nested array, each with their own attributes array. Documentation strings in both TypeScript OpenAPI definition files and the YAML specification were revised to reflect these structural differences and emphasize that email must be present in the attributes. No functional code or API signatures were modified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR clarifies contact API documentation but linked issue #1089 requires PIN-protected surveys feature implementation with UI, validation, and server-side logic—completely unrelated to API documentation changes. Verify the correct issue number is linked or update the PR to address the actual PIN-protected surveys requirements from issue #1089.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'docs: clarify v2 contact API request body shapes (#1089)' is concise, specific, and accurately describes the main change of clarifying API documentation for contact endpoints.
Description check ✅ Passed The PR description is comprehensive, includes the issue reference, explains what was changed and why, provides testing steps, and completes most required checklist items.
Out of Scope Changes check ✅ Passed All changes are focused on clarifying OpenAPI documentation for contact API endpoints, which aligns with the PR's stated objective to improve API documentation clarity.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/api-v2-reference/openapi.yml`:
- Around line 1389-1394: The YAML description block for the endpoint is
malformed because the multiline text includes a colon ("shape:") which YAML
parses as a new mapping key; update the description value (the "description" key
shown in the diff) to use a block scalar indicator (e.g., add "|") immediately
after description: so the entire multiline paragraph becomes a single scalar
value, preserving the existing wording and line breaks.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: b09ff443-6a91-4610-9ac1-f7a55a89c5f4

📥 Commits

Reviewing files that changed from the base of the PR and between 13a56b0 and 916056e.

📒 Files selected for processing (3)
  • apps/web/modules/ee/contacts/api/v2/management/contacts/bulk/lib/openapi.ts
  • apps/web/modules/ee/contacts/api/v2/management/contacts/lib/openapi.ts
  • docs/api-v2-reference/openapi.yml

@sonarqubecloud
Copy link
Copy Markdown

@jobenjada jobenjada enabled auto-merge March 20, 2026 15:56
@jobenjada jobenjada added this pull request to the merge queue Mar 20, 2026
Merged via the queue into main with commit a96ba8b Mar 20, 2026
17 checks passed
@jobenjada jobenjada deleted the chore/clarify-contact-bulk branch March 20, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE][FormTribe 🔥][500 Points] PIN protected surveys

2 participants