API ReferenceapiaffiliatesPOST /v1/affiliates/apply

POST /v1/affiliates/apply

Service: affiliates · operationId: (none)

Submit an affiliate application (status = pending_approval)

Required scopes

(no scope declared — review service config)

Request body

{
  "type": "object",
  "properties": {
    "user_id": {
      "type": "string",
      "minLength": 1
    },
    "referral_code": {
      "type": "string",
      "minLength": 1
    },
    "commission_rate_bps": {
      "type": "integer",
      "minimum": 0,
      "maximum": 10000,
      "default": 1000
    },
    "brand_id": {
      "type": "string",
      "default": "loop-health"
    },
    "metadata": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {}
    }
  },
  "required": [
    "user_id",
    "referral_code"
  ]
}

Responses

201 Application submitted

{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "user_id": {
      "type": "string"
    },
    "referral_code": {
      "type": "string"
    },
    "commission_rate_bps": {
      "type": "integer"
    },
    "status": {
      "type": "string"
    },
    "brand_id": {
      "type": "string"
    },
    "applied_at": {
      "type": [
        "string",
        "null"
      ]
    },
    "reviewed_at": {
      "type": [
        "string",
        "null"
      ]
    },
    "reviewed_by": {
      "type": [
        "string",
        "null"
      ]
    },
    "rejection_reason": {
      "type": [
        "string",
        "null"
      ]
    },
    "created_at": {
      "type": "string"
    },
    "updated_at": {
      "type": "string"
    }
  },
  "required": [
    "id",
    "user_id",
    "referral_code",
    "commission_rate_bps",
    "status",
    "brand_id",
    "applied_at",
    "reviewed_at",
    "reviewed_by",
    "rejection_reason",
    "created_at",
    "updated_at"
  ]
}

409 Duplicate user or referral code

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}

Example

curl -X POST https://affiliates.platform.loop.health/v1/affiliates/apply \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'