# Set Refund Saver settings

> Set the refund preference individually for the user and record if the user gave their consent to share their data. By default, Refund Saver always asks Apple to decline a user's refund request. You can change this default behavior for all users in the Adapty Dashboard, or adjust it for a specific user using the Dashboard, the Adapty SDK, or the server-side API.

## OpenAPI

```yaml
/api-specs/adapty-api.yaml post /api/v2/server-side-api/purchase/profile/refund-saver/settings/
openapi: 3.1.0
info:
  title: Adapty server-side API
  version: 1.0.0
servers:
  - url: https://api.adapty.io
    description: Production server
paths:
  /api/v2/server-side-api/purchase/profile/refund-saver/settings/:
    post:
      summary: Set Refund Saver settings
      description: Set the refund preference individually for the user and record if the user gave their consent to share their data. By default, Refund Saver always asks Apple to decline a user's refund request. You can change this default behavior for all users in the Adapty Dashboard, or adjust it for a specific user using the Dashboard, the Adapty SDK, or the server-side API.
      operationId: setRefundSaverSettings
      tags:
        - Refund Saver
      security:
        - apikeyAuth: []
      parameters:
        - name: adapty-customer-user-id
          in: header
          required: false
          schema:
            type: string
          description: The unique ID of the customer in your system. Either `adapty-customer-user-id` or `adapty-profile-id` is required.
        - name: adapty-profile-id
          in: header
          required: false
          schema:
            type: string
            format: uuid
          description: The unique ID of the profile in your system. Your best option if you are working with anonymous profiles. Either `adapty-customer-user-id` or `adapty-profile-id` is required.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RefundSaverSettingsRequest"
            example:
              custom_preference: grant
              consent: true
      responses:
        "200":
          description: Settings updated successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RefundSaverSettingsResponse"
              example:
                profile_id: e5aab402-b1bd-4039-b632-57a91ebc0779
                settings:
                  consent: true
                  custom_preference: grant
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
              examples:
                profile_does_not_exist:
                  summary: Profile does not exist
                  value:
                    errors:
                      - Profile does not exist
                    error_code: profile_does_not_exist
                    status_code: 400
                validation_error:
                  summary: Validation error
                  value:
                    errors:
                      - Profile refund saver settings must have either consent or custom_preference or both
                    error_code: validation_error
                    status_code: 400
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
              example:
                errors:
                  - Invalid API key
                error_code: unauthorized
                status_code: 401
        "500":
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
components:
  schemas:
    RefundSaverSettingsRequest:
      type: object
      properties:
        custom_preference:
          type: string
          enum:
            - grant
            - no_preference
            - decline
          nullable: true
          description: |
            Set the refund preference individually for the user.
            - `grant`: approve each refund request
            - `no_preference`: do not provide any recommendations
            - `decline`: decline each refund request
        consent:
          type: boolean
          nullable: true
          description: |
            Record if the user gave their consent to share their data.
            - `true` means that if you receive an in-app refund request, you may provide Apple with information about the user
      example:
        custom_preference: grant
        consent: true
    RefundSaverSettingsResponse:
      type: object
      properties:
        profile_id:
          type: string
          format: uuid
          description: Customer profile ID
        settings:
          type: object
          properties:
            consent:
              type: boolean
              description: Defines whether the user consented to share their data
            custom_preference:
              type: string
              enum:
                - grant
                - no_preference
                - decline
              description: The refund preference
          description: Refund saver settings for the user
      required:
        - profile_id
        - settings
    ErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              source:
                type: string
                nullable: true
                description: Source of the error
              errors:
                type: array
                items:
                  type: string
                description: Array of error messages
        error_code:
          type: string
          description: Short error name
        status_code:
          type: integer
          description: HTTP status code
      required:
        - errors
        - error_code
        - status_code
  securitySchemes:
    apikeyAuth:
      type: apiKey
      name: Authorization
      in: header
      default: Api-Key {Your secret API key}
      description: |
        API requests must be authenticated by your secret API key as the **Authorization** 
        header with the value `Api-Key {your_secret_api_key}`, for example, 
        `Api-Key secret_live_...`. Find this key in the Adapty Dashboard -> 
        **App Settings** -> **General** tab -> **API keys** section.
```
