Skip to main content
POST
/
v1
/
affiliates
/
{id}
/
onboarding-responses
curl -X POST "https://api.affonso.io/v1/affiliates/cmj8pptm10002p3010z8mk9ak/onboarding-responses" \
  -H "Authorization: Bearer sk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "responses": [
      {
        "question_id": "cmq1onb000onbq1",
        "answer": ["Newsletter", "Blog"]
      },
      {
        "question_id": "cmq1onb000onbq2",
        "answer": "Mostly indie SaaS founders and bootstrapped teams."
      }
    ],
    "mark_complete": true
  }'
{
  "success": true,
  "data": {
    "form_id": "cmf8onb0001p3010onbform1",
    "form_name": "Affiliate Onboarding",
    "form_description": "Tell us a bit about how you plan to promote our product.",
    "completed_at": "2024-04-22T17:32:11.000Z",
    "questions": [
      {
        "id": "cmq1onb000onbq1",
        "question": "Which channels will you use to promote us?",
        "type": "multiple_choice",
        "is_required": true,
        "options": ["YouTube", "Newsletter", "Blog", "Social"],
        "order": 0,
        "answer": ["Newsletter", "Blog"]
      },
      {
        "id": "cmq1onb000onbq2",
        "question": "Tell us about your audience",
        "type": "textarea",
        "is_required": false,
        "options": [],
        "order": 1,
        "answer": "Mostly indie SaaS founders and bootstrapped teams."
      }
    ]
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.affonso.io/llms.txt

Use this file to discover all available pages before exploring further.

Upserts one answer per question (existing answers are overwritten in place). Optionally pass mark_complete: true to record a completion — this fails with 400 VALIDATION_ERROR if any required question is still unanswered after this submission.

Path Parameters

id
string
required
The unique identifier of the affiliate

Body Parameters

responses
array
required
Up to 100 answers. Each answer must reference an active question by ID. Duplicate question_id values in the same payload are rejected.May be empty ([]) only when mark_complete: true — useful for finalizing onboarding after answers were saved incrementally over earlier calls. An empty array with mark_complete: false is rejected with a 400 VALIDATION_ERROR.
mark_complete
boolean
default:"false"
When true, records an onboarding completion for this affiliate. The completion row is unique per affiliate + form, so subsequent calls with mark_complete: true are idempotent — completed_at is preserved from the first successful completion.If any required question is still unanswered after this submission, the request fails with 400 VALIDATION_ERROR and the missing_question_ids list.

Response

Returns the same payload shape as GET /v1/affiliates/{id}/onboarding-responses — the full active form with all of the affiliate’s saved answers and the latest completed_at value.
curl -X POST "https://api.affonso.io/v1/affiliates/cmj8pptm10002p3010z8mk9ak/onboarding-responses" \
  -H "Authorization: Bearer sk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "responses": [
      {
        "question_id": "cmq1onb000onbq1",
        "answer": ["Newsletter", "Blog"]
      },
      {
        "question_id": "cmq1onb000onbq2",
        "answer": "Mostly indie SaaS founders and bootstrapped teams."
      }
    ],
    "mark_complete": true
  }'
{
  "success": true,
  "data": {
    "form_id": "cmf8onb0001p3010onbform1",
    "form_name": "Affiliate Onboarding",
    "form_description": "Tell us a bit about how you plan to promote our product.",
    "completed_at": "2024-04-22T17:32:11.000Z",
    "questions": [
      {
        "id": "cmq1onb000onbq1",
        "question": "Which channels will you use to promote us?",
        "type": "multiple_choice",
        "is_required": true,
        "options": ["YouTube", "Newsletter", "Blog", "Social"],
        "order": 0,
        "answer": ["Newsletter", "Blog"]
      },
      {
        "id": "cmq1onb000onbq2",
        "question": "Tell us about your audience",
        "type": "textarea",
        "is_required": false,
        "options": [],
        "order": 1,
        "answer": "Mostly indie SaaS founders and bootstrapped teams."
      }
    ]
  }
}

Notes

  • Required permission: write:affiliates.
  • Answers are validated against the question’s type, but not against the configured options. This matches the behavior of the hosted onboarding flow.