Saltar al contenido principal
PUT
Update affiliate

📌 Endpoint

PUT /stores/{storeId}/affiliates/{affiliateId} Actualiza los datos de un afiliado (nombre, correo electrónico, código, imagen, estado, metadata y reglas de comisión). Todos los campos son opcionales — solo los enviados son modificados.

🔐 Autenticación

  • Ruta privada.
  • Requiere el header Authorization con tu API key y plan activo.

🧾 Parámetros de ruta


📤 Body (JSON)


✅ Ejemplo de solicitud


📦 Respuesta exitosa (200)


⚠️ Posibles errores

  • 400 INVALID_DATA → body inválido
  • 400 INVALID_DATA_NAME → name fuera de 1 a 56 caracteres
  • 400 INVALID_DATA_EMAIL → email inválido o mayor de 120 caracteres
  • 400 INVALID_DATA_IMAGE → image inválida (URL http/https inválida o mayor de 512 caracteres)
  • 400 INVALID_DATA_CODE → code fuera de 3 a 50 caracteres o fuera del patrón slug
  • 400 INVALID_DATA_STATUS → status inválido (debe ser ativo o inativo)
  • 400 INVALID_DATA_METADATA → metadata inválido (no es un objeto o excede 64 claves)
  • 400 INVALID_DATA_RULES → commissionRules inválido (no es un array)
  • 400 INVALID_COMMISSION_RULES → commissionRules vacío
  • 400 INVALID_COMMISSION_RULE_TYPE → type inválido
  • 400 INVALID_COMMISSION_RULE_POSITION → position inválida/duplicada
  • 400 INVALID_COMMISSION_VALUE → commission fuera de 1 a 100
  • 400 COMMISSION_RULE_DEFAULT_REQUIRED → falta exactamente una regla DEFAULT
  • 400 INVALID_COMMISSION_RULE_TARGET → DEFAULT con targetId, o PRODUCT/CATEGORY/COUPON sin targetId
  • 400 RELATION_NOT_FOUND → targetId de producto/categoría/cupón inexistente en la tienda
  • 401 API_KEY_NOT_PROVIDED → header Authorization no enviado
  • 401 INVALID_API_KEY → API key inválida
  • 401 UNAUTHENTICATED → usuario no autenticado
  • 403 USER_DISABLED → usuario deshabilitado
  • 403 NO_ACTIVE_SUBSCRIPTION → sin plan activo
  • 404 STORE_NOT_FOUND → tienda no encontrada
  • 404 AFFILIATE_NOT_FOUND → afiliado no encontrado
  • 409 AFFILIATE_ALREADY_EXISTS → code ya usado por otro afiliado
  • 409 AFFILIATE_EMAIL_ALREADY_EXISTS → correo ya registrado por otro afiliado en la tienda
  • 429 RATE_LIMIT_EXCEEDED → límite de solicitudes por minuto excedido
  • 500 INTERNAL_SERVER_ERROR → error interno
  • 503 SERVICE_UNAVAILABLE → servicio no disponible

Autorizaciones

Authorization
string
header
predeterminado:YOUR_API_KEY_HERE
requerido

Parámetros de ruta

storeId
string
requerido
Required string length: 1 - 50
affiliateId
string
requerido
Required string length: 1 - 50

Cuerpo

application/json

Affiliate fields to update.

name
string
Required string length: 1 - 56
email
string<email>
Maximum string length: 120
code
string
Required string length: 3 - 50
Pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*$
image
string | null
Maximum string length: 512
status
enum<string>
Opciones disponibles:
ativo,
inativo
metadata
object | null
commissionRules
object[]

Respuesta

Update affiliate.

code
string
requerido
Ejemplo:

"AFFILIATE_UPDATED"

affiliate
object
requerido

Store affiliate (referral code, commission, and stats).