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

# Update a Web Archive destination

> Rename a Web Archive destination, rotate its credentials or change its IAM role or region hint with PATCH /webarchive/destinations/{id}.

`PATCH /webarchive/destinations/{id}` changes `name`, `credentials`, `role_arn` or `region_hint`. Send at least one of these fields. Requests that use the destination don't change: deliveries in progress pick up the new values from their next file or retry.

> [!NOTE]
>
> * A rename alone doesn't validate.
> * New `access_keys`, `service_account_key`, `shared_key` or `sas_token` credentials are validated first. On `422` or `503`, nothing is changed.
> * `assume_role` changes are stored first and then validated, as on create. Check `validation.status`.
> * `credentials` are replaced as a whole, with the same shape as on create.

> [!WARNING]
>
> `bucket`, `provider`, `auth_mode`, `prefix`, `account`, `namespace` and `region` can't change (`400 invalid_destination`). Create a new destination instead.

`409 destination_changed` means the destination was changed at the same time: retry. Update is limited to 10 requests per minute and 60 per hour.


## OpenAPI

````yaml api-reference/web-archive-api PATCH /webarchive/destinations/{id}
openapi: 3.1.0
info:
  title: BrightData Web Archive API
  version: 1.0.0
  description: API to search and retrieve archived web pages.
servers:
  - url: https://api.brightdata.com
security:
  - bearerAuth: []
paths:
  /webarchive/destinations/{id}:
    parameters:
      - name: id
        in: path
        required: true
        description: 'Destination ID: `dst_` followed by 32 hex characters.'
        schema:
          type: string
          pattern: ^dst_[a-f0-9]{32}$
          example: dst_0123456789abcdef0123456789abcdef
    patch:
      summary: Update a destination
      description: >-
        Renames a destination, rotates its credentials, or changes its IAM role
        or region hint. Send at least one field. A rename alone doesn't
        validate. New credentials of `access_keys`, `service_account_key`,
        `shared_key` or `sas_token` destinations are validated first; when
        validation fails nothing is changed. `assume_role` changes are stored
        first and then validated, as on create. `bucket`, `provider`,
        `auth_mode`, `prefix`, `account`, `namespace` and `region` can't be
        changed. Deliveries in progress pick up the new values from their next
        file or retry. Limited to 10 requests per minute and 60 per hour.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DestinationUpdateRequest'
            examples:
              RotateAccessKeys:
                summary: Rotate S3 access keys
                value:
                  credentials:
                    access_key_id: AKIA...NEW
                    secret_access_key: ...
              Rename:
                summary: Rename
                value:
                  name: archive snapshots eu
      responses:
        '200':
          description: The updated destination. Check `validation.status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Destination'
        '400':
          description: '`invalid_destination`: a field is malformed or can''t be changed.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DestinationError'
        '401':
          description: Missing or invalid API key.
        '404':
          description: >-
            `destination_not_found`: unknown ID, or a destination of another
            account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DestinationError'
        '409':
          description: >-
            `destination_changed`: the destination was changed at the same time;
            retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DestinationError'
        '422':
          description: >-
            `destination_validation_failed`: Bright Data can't write to the
            bucket with the new credentials. Nothing was changed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DestinationError'
        '429':
          description: >-
            `destination_validation_busy`: too many validations at once; retry
            shortly. Also returned when the rate limit is exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DestinationError'
        '503':
          description: >-
            `destination_validation_unavailable` or `destination_unavailable`:
            retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DestinationError'
components:
  schemas:
    DestinationUpdateRequest:
      type: object
      minProperties: 1
      description: Send at least one field.
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 80
          description: New name. A rename alone doesn't validate.
        credentials:
          $ref: '#/components/schemas/DestinationCredentials'
        role_arn:
          type: string
          pattern: ^arn:aws:iam::[0-9]{12}:role/.+$
          description: '`assume_role` only. New IAM role.'
        region_hint:
          type: string
          description: S3 only. New region hint.
    Destination:
      type: object
      properties:
        id:
          type: string
          description: Destination ID
          example: dst_0123456789abcdef0123456789abcdef
        customer_id:
          type: string
          description: Your Bright Data Account ID
        name:
          type: string
        target:
          type: object
          description: Where Bright Data writes. Credentials are never returned.
          properties:
            provider:
              type: string
              enum:
                - s3
                - gcs
                - azure
                - oci
                - ali_oss
            auth_mode:
              type: string
            bucket:
              type: string
            prefix:
              type: string
            account:
              type: string
            namespace:
              type: string
            region:
              type: string
            role_arn:
              type: string
            region_hint:
              type: string
        validation:
          $ref: '#/components/schemas/DestinationValidation'
        firehose_validation:
          $ref: '#/components/schemas/DestinationValidation'
          description: >-
            `assume_role` only. Result of the same test with the Bright Data
            Data Firehose role. For information only: it doesn't change
            `validation.status`.
        target_revision:
          type: integer
          description: Increases when the target changes
        auth_revision:
          type: integer
          description: Increases when the credentials or role change
        next_validation_at:
          type: string
          format: date-time
          description: Earliest time of the next validation
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    DestinationError:
      type: object
      required:
        - error_code
      properties:
        error_code:
          type: string
          enum:
            - invalid_destination
            - invalid_destination_request
            - destination_not_found
            - destination_in_use
            - destination_changed
            - destination_limit_reached
            - destination_validation_superseded
            - destination_validation_failed
            - destination_validation_cooldown
            - destination_validation_busy
            - destination_validation_unavailable
            - destination_unavailable
    DestinationCredentials:
      description: >-
        Required for every `auth_mode` except `assume_role`. Up to 8 KiB. Stored
        encrypted and never returned. On update, replaced as a whole.
      oneOf:
        - title: Access keys (S3, OCI, Alibaba OSS)
          type: object
          required:
            - access_key_id
            - secret_access_key
          properties:
            access_key_id:
              type: string
              maxLength: 128
              description: >-
                AWS access key ID, OCI Customer Secret Key access key or Alibaba
                Cloud AccessKey ID.
            secret_access_key:
              type: string
              maxLength: 256
              description: The matching secret.
        - title: Service account key (GCS)
          type: object
          required:
            - project_id
            - client_email
            - private_key
          properties:
            project_id:
              type: string
              description: '`project_id` from the service account JSON key file.'
            client_email:
              type: string
              description: '`client_email` from the service account JSON key file.'
            private_key:
              type: string
              description: >-
                `private_key` from the service account JSON key file, with its
                `\n` line breaks JSON-escaped once.
        - title: Shared key (Azure)
          type: object
          required:
            - key
          properties:
            key:
              type: string
              description: Storage account access key.
        - title: SAS token (Azure)
          type: object
          required:
            - sas_token
          properties:
            sas_token:
              type: string
              maxLength: 4096
              description: >-
                Query string of a SAS URL without the leading `?`. Needs create
                and write permissions on the container.
    DestinationValidation:
      type: object
      description: Result of the last test upload.
      properties:
        status:
          type: string
          enum:
            - valid
            - expired
            - invalid
            - unavailable
            - unverified
            - validating
          description: >-
            `valid`: Bright Data can write to the bucket. `expired`: was valid
            more than 24 hours ago; deliveries are not blocked. `invalid`:
            Bright Data can't write; see `error_code`, `stage` and `checks`.
            `unavailable`: validation couldn't run; try again. `unverified`:
            stored but not validated yet. `validating`: a validation is running.
        error_code:
          type: string
          description: >-
            Why validation failed, for example `s3_access_denied`,
            `s3_assume_role_denied` or `region_mismatch`.
        stage:
          type: string
          description: Test step that failed.
        checks:
          type: object
          description: >-
            One key per test step. `true`: passed. `false`: ran and was denied.
            A missing key: the step was not reached.
          additionalProperties:
            type: boolean
        probe_key:
          type: string
          description: Path of the test object, under `<prefix>/.brd-destination-probe/`.
        probe_deleted:
          type: boolean
          description: >-
            `false` when the credentials can't delete and the test object stays
            in the bucket.
        location:
          type: object
          description: Bucket region found by validation.
          properties:
            provider:
              type: string
            regions:
              type: array
              items:
                type: string
            type:
              type: string
            source:
              type: string
            checked_at:
              type: string
              format: date-time
        checked_at:
          type: string
          format: date-time
        expires_at:
          type: string
          format: date-time
          description: >-
            When a `valid` result shows as `expired`: 24 hours after
            `checked_at`.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Use your Bright Data API Key as a Bearer token in the Authorization
        header.


        **How to authenticate:**

        1. Obtain your API Key from the Bright Data account settings at
        https://brightdata.com/cp/setting/users

        2. Include the API Key in the Authorization header of your requests

        3. Format: `Authorization: Bearer YOUR_API_KEY`


        **Example:**

        ```

        Authorization: Bearer
        b5648e1096c6442f60a6c4bbbe73f8d2234d3d8324554bd6a7ec8f3f251f07df

        ```


        Learn how to get your Bright Data API key:
        https://docs.brightdata.com/api-reference/authentication
      bearerFormat: API Key

````