B3

B3 wallets API

The wallets API from B3 — 4 operation(s) for wallets.

OpenAPI Specification

b3-wallets-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  description: Workflow management API for B3OS
  title: B3OS Workflow Action wallets API
  version: '1.0'
tags:
- name: wallets
paths:
  /v1/organizations/{orgId}/wallets:
    get:
      description: List all wallets for an organization with pagination
      parameters:
      - description: Organization ID
        in: path
        name: orgId
        required: true
        schema:
          type: string
      - description: Limit (default 20, max 100)
        in: query
        name: limit
        schema:
          type: integer
      - description: Offset (default 0)
        in: query
        name: offset
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListWalletsSuccessResponse'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse'
          description: Unauthorized
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse'
          description: Internal Server Error
      tags:
      - wallets
    post:
      description: Create a new Turnkey wallet for an organization
      parameters:
      - description: Organization ID
        in: path
        name: orgId
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
              - type: object
              - $ref: '#/components/schemas/CreateWalletParams'
                summary: request
                description: Wallet name
        description: Wallet name
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WalletResponse'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse'
          description: Unauthorized
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse'
          description: Internal Server Error
      tags:
      - wallets
  /v1/organizations/{orgId}/wallets/{walletId}:
    delete:
      description: Archive a wallet (soft delete). Cannot archive default wallet or only wallet.
      parameters:
      - description: Organization ID
        in: path
        name: orgId
        required: true
        schema:
          type: string
      - description: Wallet ID
        in: path
        name: walletId
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_service_wallet.ArchiveWalletResponse'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse'
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse'
          description: Internal Server Error
      tags:
      - wallets
  /v1/organizations/{orgId}/wallets/{walletId}/default:
    put:
      description: Set a wallet as the default wallet for an organization.
      parameters:
      - description: Organization ID
        in: path
        name: orgId
        required: true
        schema:
          type: string
      - description: Wallet ID
        in: path
        name: walletId
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_pkg_entity.OrganizationWallet'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse'
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse'
          description: Internal Server Error
      tags:
      - wallets
  /v1/organizations/{orgId}/wallets/{walletId}/withdraw:
    post:
      description: Withdraw tokens from an organization wallet via Turnkey signing
      parameters:
      - description: Organization ID
        in: path
        name: orgId
        required: true
        schema:
          type: string
      - description: Wallet ID
        in: path
        name: walletId
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
              - type: object
              - $ref: '#/components/schemas/WithdrawWalletParams'
                summary: request
                description: Withdraw parameters
        description: Withdraw parameters
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WithdrawWalletResponse'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse'
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse'
          description: Not Found
        '502':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse'
          description: Bad Gateway
      tags:
      - wallets
components:
  schemas:
    CreateWalletParams:
      properties:
        name:
          maxLength: 100
          type: string
      required:
      - name
      type: object
    github_com_b3-fun_b3-mono_services_b3os-workflow_internal_pkg_entity.OrganizationWallet:
      properties:
        address:
          type: string
        createdAt:
          type: string
        deletedAt:
          type: string
        deletedBy:
          type: string
        id:
          type: string
        isDefault:
          type: boolean
        name:
          type: string
        organizationId:
          type: string
        turnkeyWalletId:
          type: string
        updatedAt:
          type: string
      type: object
    github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_service_wallet.ArchiveWalletResponse:
      properties:
        archivedWorkflowIds:
          items:
            type: string
          type: array
          uniqueItems: false
        message:
          type: string
      type: object
    ListWalletsSuccessResponse:
      properties:
        code:
          example: 200
          type: integer
        data:
          $ref: '#/components/schemas/PaginatedData-schemas_WalletResponse'
        message:
          example: success
          type: string
        requestId:
          example: abc-123
          type: string
      type: object
    WithdrawWalletResponse:
      properties:
        blockNumber:
          type: integer
        transactionHash:
          type: string
      type: object
    WithdrawWalletParams:
      properties:
        amount:
          type: string
        chainId:
          minimum: 1
          type: integer
        recipientAddress:
          type: string
        tokenAddress:
          type: string
      required:
      - amount
      - chainId
      - recipientAddress
      - tokenAddress
      type: object
    PaginatedData-schemas_WalletResponse:
      properties:
        hasMore:
          type: boolean
        items:
          items:
            $ref: '#/components/schemas/WalletResponse'
          type: array
          uniqueItems: false
        limit:
          type: integer
        offset:
          type: integer
      type: object
    WalletResponse:
      properties:
        address:
          type: string
        createdAt:
          type: integer
        id:
          type: string
        isDefault:
          type: boolean
        name:
          type: string
        organizationId:
          type: string
        turnkeySubOrgId:
          type: string
        turnkeyWalletId:
          type: string
        updatedAt:
          type: integer
      type: object
    github_com_b3-fun_b3-mono_services_b3os-workflow_internal_app_api_http.ErrorResponse:
      properties:
        code:
          type: integer
        details:
          items: {}
          type: array
          uniqueItems: false
        message:
          type: string
        requestId:
          type: string
      type: object