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

# Generate a Coinbase onramp buy URL

> Generates a Coinbase onramp buy URL for purchasing crypto.



## OpenAPI

````yaml post /sdk/{environmentId}/onramps/coinbase/buy
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:
  /sdk/{environmentId}/onramps/coinbase/buy:
    post:
      tags:
        - SDK
      summary: Generate a Coinbase onramp buy URL
      operationId: generateCoinbaseOnrampBuyUrl
      parameters:
        - $ref: '#/components/parameters/environmentId'
      requestBody:
        description: Coinbase onramp order data
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CoinbaseOnrampGetBuyUrlRequest'
        required: true
      responses:
        '200':
          description: Successfully generated a Coinbase onramp buy URL
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CoinbaseOnrampGetBuyUrlResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    environmentId:
      in: path
      name: environmentId
      required: true
      description: ID of the environment
      schema:
        $ref: '#/components/schemas/uuid'
  schemas:
    CoinbaseOnrampGetBuyUrlRequest:
      type: object
      required:
        - destinationAddress
        - networks
      properties:
        assets:
          type: array
          items:
            $ref: '#/components/schemas/NonEmptyStringWith50MaxLength'
        defaultNetwork:
          $ref: '#/components/schemas/NonEmptyStringWith50MaxLength'
        defaultAsset:
          $ref: '#/components/schemas/NonEmptyStringWith50MaxLength'
        defaultExperience:
          $ref: '#/components/schemas/CoinbaseOnrampBuyUrlExperience'
        defaultPaymentMethod:
          $ref: '#/components/schemas/NonEmptyStringWith50MaxLength'
        destinationAddress:
          $ref: '#/components/schemas/WalletPublicKey'
        fiatCurrency:
          $ref: '#/components/schemas/NonEmptyStringWith50MaxLength'
        handlingRequestedUrls:
          type: boolean
          description: >-
            Prevents the widget from opening URLs directly & relies on
            onRequestedUrl entirely for opening links
        networks:
          type: array
          items:
            $ref: '#/components/schemas/NonEmptyStringWith50MaxLength'
        partnerUserRef:
          $ref: '#/components/schemas/NonEmptyStringWith255MaxLength'
        presetCryptoAmount:
          $ref: '#/components/schemas/NonEmptyAmountString'
        presetFiatAmount:
          $ref: '#/components/schemas/NonEmptyAmountString'
        redirectUrl:
          $ref: '#/components/schemas/OptionalNonEmptyUrlWithLocalhostAndDeepLink'
    CoinbaseOnrampGetBuyUrlResponse:
      type: object
      required:
        - url
      properties:
        url:
          type: string
          description: The URL to the hosted widget the user should be redirected to.
    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
    NonEmptyStringWith50MaxLength:
      type: string
      pattern: ^(?=\S)[\p{L}\p{N}a-zA-Z _.,:!?&%@\/+\-'|]+(?<=\S)$
      example: An example name
      maxLength: 50
    CoinbaseOnrampBuyUrlExperience:
      type: string
      description: >-
        Default visual experience. Either transfer funds from Coinbase (send) or
        buy assets (buy)
      enum:
        - buy
        - send
    WalletPublicKey:
      type: string
      pattern: ^[A-Za-z0-9]{18,100}$
      description: >-
        Valid blockchain wallet address, must be an alphanumeric string without
        any special characters
      example: '0xbF394748301603f18d953C90F0b087CBEC0E1834'
      maxLength: 255
    NonEmptyStringWith255MaxLength:
      type: string
      pattern: ^(?=\S)[\p{L}\p{N}a-zA-Z _.,:!?&%@\/+\-'|]+(?<=\S)$
      maxLength: 255
      example: An example name
    NonEmptyAmountString:
      type: string
      pattern: ^(\d+(\.\d+)?|\.\d+)$
      description: Digits with optional decimal part
      example: '100.00'
    OptionalNonEmptyUrlWithLocalhostAndDeepLink:
      type: string
      pattern: >-
        ^$|^((https?:\/\/)?([a-z0-9]+([-.]+[a-z0-9]+)*\.[a-z]{2,10}|localhost)(:[0-9]{1,5})?(\/.*)?|([a-zA-Z+-]{2,20}):\/\/(?!.*\*.*\*.*)[-*a-zA-Z0-9.-\/]{0,255}(:[*0-9]{1,5})?((\/|\?).*)?)$
      example: https://website-sample.com
    BadRequest:
      type: object
      properties:
        error:
          type: string
    InternalServerError:
      type: object
      properties:
        error:
          type: string
          example: Internal Server Error
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BadRequest'
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InternalServerError'

````