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

# Create backup action for key shares using API token authentication

> Creates backup locations for wallet key shares. Requires API token authentication. Validates that the user belongs to the environment and that no client key shares exist for the wallet. This endpoint is intended for server-side integrations that need to backup key shares on behalf of users.




## OpenAPI

````yaml post /environments/{environmentId}/waas/{walletId}/keyShares/backup/locations
openapi: 3.0.1
info:
  title: Dashboard API
  description: Dashboard API documentation
  version: 1.0.0
servers:
  - url: https://app.dynamicauth.com/api/v0
  - url: https://app.dynamic.xyz/api/v0
  - url: http://localhost:3333/api/v0
security: []
tags:
  - name: Analytics
  - name: SDK
  - name: Organizations
  - name: Projects
  - name: Environments
  - name: Users
  - name: Invites
  - name: Tokens
  - name: Origins
  - name: Allowlists
  - name: Wallets
  - name: Members
  - name: Sessions
  - name: Settings
  - name: Gates
  - name: Chains
  - name: Exports
  - name: Events
  - name: Webhooks
  - name: Custom Fields
  - name: OrganizationMfaSettings
  - name: CustomHostnames
  - name: TestAccount
  - name: NameServices
  - name: GlobalWallets
  - name: GlobalWalletConnections
  - name: UserApiTokens
  - name: Waas
  - name: WalletConnect
paths:
  /environments/{environmentId}/waas/{walletId}/keyShares/backup/locations:
    post:
      tags:
        - Waas
      summary: Create backup action for key shares using API token authentication
      description: >
        Creates backup locations for wallet key shares. Requires API token
        authentication. Validates that the user belongs to the environment and
        that no client key shares exist for the wallet. This endpoint is
        intended for server-side integrations that need to backup key shares on
        behalf of users.
      operationId: backupKeySharesToLocationsForPregen
      parameters:
        - $ref: '#/components/parameters/environmentId'
        - $ref: '#/components/parameters/walletId'
      requestBody:
        description: Backup locations request with userId
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BackupKeySharesToLocationsWithUserIdRequest'
      responses:
        '201':
          description: Backup action and event created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BackupKeySharesToLocationsResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - bearerAuth: []
components:
  parameters:
    environmentId:
      in: path
      name: environmentId
      required: true
      description: ID of the environment
      schema:
        $ref: '#/components/schemas/uuid'
    walletId:
      in: path
      name: walletId
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: UUID of the wallet
  schemas:
    BackupKeySharesToLocationsWithUserIdRequest:
      type: object
      required:
        - userId
        - locations
      properties:
        userId:
          type: string
          format: uuid
          description: The ID of the user who owns the wallet
        locations:
          type: array
          items:
            type: object
            required:
              - location
            properties:
              location:
                $ref: '#/components/schemas/WaasBackupOptionsEnum'
              keygenId:
                $ref: '#/components/schemas/NonEmptyStringWith255MaxLength'
              thresholdSignatureScheme:
                $ref: '#/components/schemas/ThresholdSignatureScheme'
              externalKeyShareId:
                $ref: '#/components/schemas/NonEmptyString'
    BackupKeySharesToLocationsResponse:
      type: object
      required:
        - message
        - walletId
        - locationsWithKeyShares
      properties:
        message:
          type: string
        walletId:
          $ref: '#/components/schemas/uuid'
        locationsWithKeyShares:
          type: array
          items:
            type: object
            required:
              - location
              - keyShareId
              - externalKeyShareId
            properties:
              location:
                $ref: '#/components/schemas/WaasBackupOptionsEnum'
              keyShareId:
                $ref: '#/components/schemas/uuid'
              externalKeyShareId:
                $ref: '#/components/schemas/uuid'
    uuid:
      type: string
      pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
      minLength: 36
      maxLength: 36
      example: 95b11417-f18f-457f-8804-68e361f9164f
    WaasBackupOptionsEnum:
      type: string
      enum:
        - googleDrive
        - iCloud
        - dynamic
        - external
        - delegated
    NonEmptyStringWith255MaxLength:
      type: string
      pattern: ^(?=\S)[\p{L}\p{N}a-zA-Z _.,:!?&%@\/+\-'|]+(?<=\S)$
      maxLength: 255
      example: An example name
    ThresholdSignatureScheme:
      type: string
      enum:
        - TWO_OF_TWO
        - TWO_OF_THREE
        - THREE_OF_FIVE
    NonEmptyString:
      type: string
      pattern: ^(?=\S)[\p{L}\p{N}a-zA-Z _.,:!?&%@\/+\-'|]+(?<=\S)$
      example: An example name
    BadRequest:
      type: object
      properties:
        error:
          type: string
    Unauthorized:
      type: object
      properties:
        error:
          type: string
          example: No jwt provided!
    Forbidden:
      type: object
      properties:
        error:
          type: string
          example: Access Forbidden
    NotFound:
      type: object
      required:
        - error
        - code
      properties:
        error:
          type: string
          example: Not Found
        code:
          type: string
          example: not_found
    InternalServerError:
      type: object
      properties:
        error:
          type: string
          example: Internal Server Error
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BadRequest'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Unauthorized'
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Forbidden'
    NotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NotFound'
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InternalServerError'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````