> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cabrapi.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete Affiliate

> Learn how to delete an affiliate using the DELETE /stores/{storeId}/affiliates/{affiliateId} endpoint.

## 📌 Endpoint

`DELETE /stores/{storeId}/affiliates/{affiliateId}`

Removes an affiliate from the store (**soft delete**). The affiliate disappears from listings, but the record remains in the database for safety — including commission resolution no longer considers it.

> **Requirement:** The affiliate must be **paused** (`status: "inativo"`) for at least **7 days** before it can be deleted. Otherwise, the API returns `400` (`AFFILIATE_NOT_PAUSED` or `AFFILIATE_PAUSE_PERIOD_NOT_ELAPSED`).

***

## 🔐 Authentication

* **Private route**.
* Requires the `Authorization` header with your API key and an active plan.

```json theme={null}
{
	"Authorization": "YOUR_API_KEY_HERE"
}
```

***

## 🧾 Route parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `storeId` | string | Yes | Store ID |
| `affiliateId` | string | Yes | Affiliate ID |

***

## ✅ Request example

```bash theme={null}
curl -X DELETE "https://api.cabrapi.com.br/v1/stores/STORE_ID/affiliates/AFFILIATE_ID" \
	-H "Authorization: YOUR_API_KEY_HERE"
```

***

## 📦 Success response (200)

```json theme={null}
{
	"code": "AFFILIATE_DELETED"
}
```

***

## ⚠️ Possible errors

* `400 INVALID_DATA` → invalid parameters
* `400 AFFILIATE_NOT_PAUSED` → the affiliate must be paused (`status: "inativo"`) before deletion
* `400 AFFILIATE_PAUSE_PERIOD_NOT_ELAPSED` → the affiliate must remain paused for at least 7 days
* `401 API_KEY_NOT_PROVIDED` → `Authorization` header not provided
* `401 INVALID_API_KEY` → invalid API key
* `401 UNAUTHENTICATED` → unauthenticated user
* `403 USER_DISABLED` → user disabled
* `403 NO_ACTIVE_SUBSCRIPTION` → no active plan
* `404 STORE_NOT_FOUND` → store not found
* `404 AFFILIATE_NOT_FOUND` → affiliate not found
* `429 RATE_LIMIT_EXCEEDED` → per-minute rate limit exceeded
* `500 INTERNAL_SERVER_ERROR` → internal server error
* `503 SERVICE_UNAVAILABLE` → service unavailable


## OpenAPI

````yaml DELETE /stores/{storeId}/affiliates/{affiliateId}
openapi: 3.1.0
info:
  title: caBRAPI
  version: 1.0.0
servers:
  - url: https://api.cabrapi.com.br/v1
security: []
paths:
  /stores/{storeId}/affiliates/{affiliateId}:
    delete:
      tags:
        - Affiliates
      summary: Delete affiliate
      operationId: deleteAffiliate
      parameters:
        - $ref: '#/components/parameters/StoreId'
        - $ref: '#/components/parameters/AffiliateId'
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  code:
                    example: AFFILIATE_DELETED
                    type: string
                required:
                  - code
                type: object
          description: Delete affiliate.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Invalid request.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Missing or invalid API key.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Forbidden (inactive plan or insufficient permissions).
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Resource not found.
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Rate limit exceeded.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Internal server error.
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Service unavailable.
      security:
        - ApiKey: []
components:
  parameters:
    StoreId:
      in: path
      name: storeId
      required: true
      schema:
        type: string
        minLength: 1
        maxLength: 50
    AffiliateId:
      in: path
      name: affiliateId
      required: true
      schema:
        type: string
        minLength: 1
        maxLength: 50
  schemas:
    Error:
      properties:
        code:
          example: STORE_NOT_FOUND
          type: string
      required:
        - code
      type: object
  securitySchemes:
    ApiKey:
      in: header
      name: Authorization
      type: apiKey
      x-default: YOUR_API_KEY_HERE

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.