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

# Decrease wallet campaign daily budget

> Lowers the daily budget for a wallet-funded campaign to
`targetDailyBudget`. Requires the `campaigns:write` scope and an
`Idempotency-Key` header.

**Wallet campaigns only** (`generation: 3`).

**Modes** (default `current_and_renewals`):
- `current_cycle` — lowers current-cycle spend only
- `current_and_renewals` — also sets the next-cycle daily budget

`next_renewal` is not supported for decreases. Refund of unused budget
is applied asynchronously after acceptance (`accepted: true`).

Domain rules (also returned as `invalid_request` when violated):
- `targetDailyBudget` must be at least `$10`/day and lower than the
  current daily budget
- more than 3 days must remain in the current cycle




## OpenAPI

````yaml /openapi/soundlink-public-api-v1.yaml post /v1/campaigns/{campaignId}/budget/decrease
openapi: 3.0.3
info:
  title: Soundlink Public API
  version: 0.0.1-draft
  description: >
    Campaign listing, metrics, and write operations for Soundlink partner
    organizations.


    **Base URL:** `https://api.getsoundlink.com`


    **Authentication:** send a `sk_*` API key created in the Soundlink app
    (Settings → Developer → API keys) using one of:


    1. **`Authorization: Bearer` (recommended)**:
       ```
       Authorization: Bearer sk_abc123_<token>
       ```

    2. **`x-api-key` header (deprecated, retiring 2026-08-17)** — migrate to
    Bearer above before then:
       ```
       x-api-key: sk_abc123_<token>
       ```

    Sending both headers returns `401 mixed_credentials`.


    All responses are wrapped in a standard envelope:

    ```json

    { "data": <payload>, "meta": { "requestId": "<uuid>" } }

    ```


    Errors follow the same envelope shape with an `error` field instead of
    `data`.
servers:
  - url: https://api.getsoundlink.com
    description: Production
security:
  - apiKeyAuth: []
  - apiKeyBearerAuth: []
tags:
  - name: System
    description: Connectivity and auth verification
  - name: Campaigns
    description: >-
      Campaign listing, detail, creation, and wallet management (budget, stop,
      tiers)
  - name: Metrics
    description: Campaign performance metrics
  - name: Videos
    description: Partner video library import for Full Control campaigns
paths:
  /v1/campaigns/{campaignId}/budget/decrease:
    post:
      tags:
        - Campaigns
      summary: Decrease wallet campaign daily budget
      description: |
        Lowers the daily budget for a wallet-funded campaign to
        `targetDailyBudget`. Requires the `campaigns:write` scope and an
        `Idempotency-Key` header.

        **Wallet campaigns only** (`generation: 3`).

        **Modes** (default `current_and_renewals`):
        - `current_cycle` — lowers current-cycle spend only
        - `current_and_renewals` — also sets the next-cycle daily budget

        `next_renewal` is not supported for decreases. Refund of unused budget
        is applied asynchronously after acceptance (`accepted: true`).

        Domain rules (also returned as `invalid_request` when violated):
        - `targetDailyBudget` must be at least `$10`/day and lower than the
          current daily budget
        - more than 3 days must remain in the current cycle
      operationId: decreaseCampaignBudget
      parameters:
        - $ref: '#/components/parameters/campaignId'
        - $ref: '#/components/parameters/idempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DecreaseCampaignBudgetRequest'
            example:
              targetDailyBudget: 60
              mode: current_and_renewals
      responses:
        '200':
          description: Budget decrease accepted (refund may complete asynchronously)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DecreaseCampaignBudgetResponse'
              example:
                data:
                  campaignId: campaign-uuid
                  mode: current_and_renewals
                  targetDailyBudget: 60
                  accepted: true
                  walletNextCycleDailyBudget: 60
                meta:
                  requestId: 550e8400-e29b-41d4-a716-446655440000
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/IdempotencyKeyConflict'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - apiKeyAuth: []
        - apiKeyBearerAuth: []
components:
  parameters:
    campaignId:
      name: campaignId
      in: path
      required: true
      schema:
        type: string
      description: Campaign identifier (UUID)
    idempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      schema:
        type: string
        minLength: 1
        maxLength: 255
      description: |
        A unique string identifying this request, used to safely retry write
        operations (create, stop, budget increase/decrease) without repeating
        side effects. Required on every request that references this parameter.
        Reusing this key with an unchanged request body replays the original
        response; reusing it with a different body returns
        `409 idempotency_key_conflict`. Keys are honored for 24 hours.
  schemas:
    DecreaseCampaignBudgetRequest:
      type: object
      required:
        - targetDailyBudget
      properties:
        targetDailyBudget:
          type: number
          minimum: 10
          description: |
            New daily budget in USD (gross). Must be at least `$10`/day and
            lower than the campaign's current daily budget.
        mode:
          $ref: '#/components/schemas/BudgetDecreaseMode'
    DecreaseCampaignBudgetResponse:
      type: object
      required:
        - data
        - meta
      properties:
        data:
          $ref: '#/components/schemas/DecreaseCampaignBudgetData'
        meta:
          $ref: '#/components/schemas/Meta'
    BudgetDecreaseMode:
      type: string
      enum:
        - current_cycle
        - current_and_renewals
      description: |
        Defaults to `current_and_renewals` when omitted on decrease requests.
        `next_renewal` is not supported for decreases.
    DecreaseCampaignBudgetData:
      type: object
      required:
        - campaignId
        - mode
        - targetDailyBudget
        - accepted
      properties:
        campaignId:
          type: string
        mode:
          $ref: '#/components/schemas/BudgetDecreaseMode'
        targetDailyBudget:
          type: number
        accepted:
          type: boolean
          enum:
            - true
          description: |
            Always `true` on success. Unused budget refund is applied
            asynchronously after acceptance.
        walletNextCycleDailyBudget:
          type: number
          nullable: true
          description: |
            Present for `current_and_renewals` when the next-cycle daily
            budget was updated. Omitted for `current_cycle`.
    Meta:
      type: object
      required:
        - requestId
      properties:
        requestId:
          type: string
          format: uuid
          description: Server-generated request ID. Include when contacting support.
    ErrorResponse:
      type: object
      required:
        - error
        - meta
      properties:
        error:
          $ref: '#/components/schemas/Error'
        meta:
          $ref: '#/components/schemas/Meta'
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Stable snake_case error code.
          enum:
            - invalid_api_key
            - api_key_revoked
            - api_key_expired
            - mixed_credentials
            - insufficient_scope
            - not_found
            - campaign_not_found
            - invalid_query_parameter
            - invalid_date_range
            - page_size_exceeded
            - invalid_request
            - invalid_genre
            - invalid_duration_or_budget
            - invalid_daily_budget
            - invalid_duration_days
            - invalid_spotify_url
            - invalid_tier_budget_allocation
            - invalid_tier_status
            - tier_update_cooldown
            - wallet_not_enabled
            - insufficient_credit
            - idempotency_key_conflict
            - rate_limit_exceeded
            - invalid_video_url
            - video_import_limit_exceeded
            - video_import_session_not_found
            - internal_error
        message:
          type: string
          description: Human-readable error description. Do not parse programmatically.
        details:
          type: object
          nullable: true
          description: |
            Additive, error-code-specific context (e.g. `available`/`required`
            on `insufficient_credit`). Absent or `null` for error codes that
            carry no extra data.
          additionalProperties: true
  responses:
    BadRequest:
      description: Invalid query parameter or date range
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            invalid_query_parameter:
              value:
                error:
                  code: invalid_query_parameter
                  message: pageSize must be an integer between 1 and 500.
                meta:
                  requestId: 550e8400-e29b-41d4-a716-446655440000
            invalid_date_range:
              value:
                error:
                  code: invalid_date_range
                  message: endDate must not be before startDate.
                meta:
                  requestId: 550e8400-e29b-41d4-a716-446655440000
    Unauthorized:
      description: Missing, malformed, revoked, or expired API key
      headers:
        Retry-After:
          schema:
            type: integer
          description: Present only on `rate_limit_exceeded`
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            invalid_api_key:
              value:
                error:
                  code: invalid_api_key
                  message: >-
                    Missing or malformed API key. Expected: sk_<prefix>_<token>
                    (sent via x-api-key or Authorization: Bearer).
                meta:
                  requestId: 550e8400-e29b-41d4-a716-446655440000
            api_key_revoked:
              value:
                error:
                  code: api_key_revoked
                  message: >-
                    This API key has been revoked. Create a new key in Settings
                    → Developer → API keys.
                meta:
                  requestId: 550e8400-e29b-41d4-a716-446655440000
    Forbidden:
      description: Valid key but missing required scope
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: insufficient_scope
              message: This key does not have the metrics:read scope.
            meta:
              requestId: 550e8400-e29b-41d4-a716-446655440000
    NotFound:
      description: Campaign not found or belongs to another organization
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: campaign_not_found
              message: Campaign not found.
            meta:
              requestId: 550e8400-e29b-41d4-a716-446655440000
    IdempotencyKeyConflict:
      description: |
        The `Idempotency-Key` was reused with a materially different request
        body, or a request with the same key is still in progress.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            conflicting_body:
              value:
                error:
                  code: idempotency_key_conflict
                  message: >-
                    This Idempotency-Key was already used with a different
                    request body.
                meta:
                  requestId: 550e8400-e29b-41d4-a716-446655440000
            in_progress:
              value:
                error:
                  code: idempotency_key_conflict
                  message: >-
                    A request with this Idempotency-Key is still processing.
                    Retry after a short delay.
                meta:
                  requestId: 550e8400-e29b-41d4-a716-446655440000
    RateLimited:
      description: Per-key rate limit exceeded (60/min, 600/hr)
      headers:
        Retry-After:
          required: true
          schema:
            type: integer
          description: Seconds until the rate limit resets
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: rate_limit_exceeded
              message: >-
                Rate limit exceeded. Retry after the number of seconds indicated
                in the Retry-After header.
            meta:
              requestId: 550e8400-e29b-41d4-a716-446655440000
    InternalError:
      description: Unexpected server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: internal_error
              message: >-
                An unexpected error occurred. Contact support with the
                requestId.
            meta:
              requestId: 550e8400-e29b-41d4-a716-446655440000
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >
        Pass your Soundlink `sk_*` API key in the `x-api-key` header.

        Keys can carry explicit scopes (for example `campaigns:read`,
        `metrics:read`, `videos:write`) enforced by the backend.


        **Deprecated, retiring 2026-08-17** — migrate to `Authorization: Bearer
        sk_...` (see `apiKeyBearerAuth`) before then.
    apiKeyBearerAuth:
      type: http
      scheme: bearer
      description: |
        Pass your Soundlink `sk_*` API key as a Bearer token:
        `Authorization: Bearer sk_<prefix>_<token>`. Verified with the exact
        same key as `apiKeyAuth` — just the recommended header for the same
        `sk_*` credential. Do not combine with `x-api-key`.

````