---
title: "Create a new affiliate for a customer."
method: POST
path: "/stores/{storeId}/affiliates/{customerId}"
tags: ["Affiliate"]
---

# Create a new affiliate for a customer.

`POST /stores/{storeId}/affiliates/{customerId}`

Creates a new affiliate record for the given customer in this store.
Requires the `stores.affiliates.update` permission.

## Path parameters

- `storeId` string, uuid, required
- `customerId` string, uuid, required

## Request body

- AffiliateForm — Form for creating or updating a store‐affiliate record.
  - `isEnabled` boolean, nullable — Indicates whether the affiliate is active. If null, defaults to true when creating, or leaves unchanged when updating.
  - `link` string, required — A link provided to affiliates for tracking and promotional purposes. Required and must not exceed 256 characters.
  - `returnPercentage` integer, nullable — The percentage of the order return the affiliate receives. If null, uses store’s default when creating, or leaves unchanged when updating.
  - `percentageOff` integer, nullable — The percentage discount offered by the affiliate link. If null, uses store’s default when creating, or leaves unchanged when updating.
  - `balance` number, double, nullable — The affiliate’s current balance. If null, defaults to zero when creating, or leaves unchanged when updating.

## Response `200`

The object was successfully created.

- AffiliateDtoResponse — Represents a default generic response for API endpoints.
  - `success` boolean, required — Indicates whether the operation or response was successful.
  - `message` string, nullable — A descriptive message providing additional context or information about the response.
  - `code` string, nullable — The error code (if there was an error) to use when referencing the error
  - `data` AffiliateDto — Form for store owners to edit affiliate status.
    - `isEnabled` boolean, required — Indicates whether the users affiliate status is enabled
    - `link` string, nullable — A link provided to affiliates for tracking and promotional purposes. Must not exceed 256 characters.
    - `returnPercentage` integer, nullable — The percentage of the return that an affiliate receives. Must be between 0 and 100 inclusive.
    - `percentageOff` integer, nullable — The percentage discount offered by the store affiliate. Must be between 0 and 100 inclusive.
    - `balance` number, double, required — Represents the balance of the affiliate, typically indicating the amount earned through affiliations. Must be a non-negative value.

## Other responses

- `400` — The provided form information is not valid, check that the provided data is valid. You can use the 'invalidFields' field to get the list of invalid fields or just use the 'message' field.
- `403` — You are not authorized to access this endpoint, you may be missing an API key scope or be requesting a privileged endpoint.

---

[API](https://skmtc.net/komerza/apis/komerza-api.md) · [All operations](https://skmtc.net/komerza/apis/komerza-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/komerza/komerza-api/revisions/060e78bc7f80/schema)
