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

# Deploy a passkey smart-account

> Sponsor-deploy a passkey smart-account (secp256r1 / WebAuthn). The SDK sends the passkey's 65-byte uncompressed public key; the facilitator holds the sponsor secret, enforces the pinned Wasm hash, and returns the deployed contract address.



## OpenAPI

````yaml /api-reference/openapi.json post /stellar/contract/deploy
openapi: 3.1.0
info:
  title: Buckspay Facilitator & BFF API
  version: 0.2.0
  description: >-
    HTTP wire contract for the Buckspay SDK. The SDK calls these endpoints
    internally via `@buckspay/relayer`; this reference is for teams building
    their own BFF relay route or calling the facilitator from server-side code.


    All facilitator endpoints require the `x-api-key` header. **The API key is a
    server-side secret - it must only appear in BFF or server-side code and must
    never be shipped to a browser bundle.** Use `createRelayRoute` and
    `createSignerProxyRoute` from `@buckspay/nextjs` to build compliant BFF
    handlers.
servers:
  - url: '{facilitatorUrl}'
    description: >-
      Buckspay facilitator (all endpoints). Set via BUCKSPAY_FACILITATOR_URL on
      the server.
    variables:
      facilitatorUrl:
        default: https://facilitator.buckspay.xyz
        description: Base URL of the Buckspay facilitator service.
security:
  - FacilitatorApiKey: []
tags:
  - name: Relay
    description: >-
      Submit a signed Soroban authorization entry for gasless relaying to the
      Stellar network.
  - name: Fee
    description: >-
      Quote the fee-token amount required for gas-in-token (token gas mode)
      before building the forward() invocation.
  - name: Account State
    description: Read on-chain state for classic G-addresses and contract C-addresses.
  - name: Onboarding
    description: >-
      Build and submit the sponsored onboarding transaction; deploy passkey
      smart-accounts and policy session-accounts.
  - name: Auth
    description: >-
      Signer-proxy for social and email authentication. The BFF forwards these
      requests to the facilitator; provider secrets remain server-side.
  - name: Swap
    description: >-
      Quote a gasless EVM token swap. Requires `swapChain` to be configured in
      the relayer.
paths:
  /stellar/contract/deploy:
    post:
      tags:
        - Onboarding
      summary: Deploy a passkey smart-account
      description: >-
        Sponsor-deploy a passkey smart-account (secp256r1 / WebAuthn). The SDK
        sends the passkey's 65-byte uncompressed public key; the facilitator
        holds the sponsor secret, enforces the pinned Wasm hash, and returns the
        deployed contract address.
      operationId: postStellarContractDeploy
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeployContractRequest'
      responses:
        '200':
          description: >-
            Contract deployed. The `address` is the new C-address of the
            smart-account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeployContractResponse'
        '400':
          description: Deployment rejected.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Invalid or missing API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Sponsor account not configured or unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                sponsor_not_configured:
                  value:
                    error: sponsor_not_configured
                sponsor_unavailable:
                  value:
                    error: sponsor_unavailable
components:
  schemas:
    DeployContractRequest:
      type: object
      required:
        - passkeyPublicKey
        - chain
      properties:
        passkeyPublicKey:
          type: string
          description: >-
            65-byte uncompressed secp256r1 / WebAuthn public key, hex-encoded.
            Obtained from `signer.getPublicKey()` on a
            `@buckspay/signers/passkey` instance.
        chain:
          $ref: '#/components/schemas/FacilitatorChain'
      description: Request body for `POST /stellar/contract/deploy`.
    DeployContractResponse:
      type: object
      required:
        - address
      properties:
        ok:
          type: boolean
          description: Optional status flag.
        address:
          allOf:
            - $ref: '#/components/schemas/StellarContractAddress'
          description: C-address of the newly deployed smart-account.
      description: >-
        Response shared by `POST /stellar/contract/deploy` and `POST
        /stellar/session-account/deploy`.
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: >-
            Machine-readable error code. SDK error codes (e.g.
            `RELAYER_REJECTED`, `SESSION_POLICY_VIOLATION`) or raw facilitator
            codes (e.g. `auth_expired`, `simulation_failed`) depending on
            context.
        message:
          type: string
          description: >-
            Optional human-readable detail. Never log raw upstream messages -
            they may contain addresses or sensitive information.
        details:
          type: object
          description: >-
            Optional structured validation errors (present on BFF-level schema
            failures).
      description: >-
        Error body returned on non-2xx responses. The `error` field maps to a
        `BuckspayErrorCode` or a raw facilitator error string (see
        `mapFacilitatorError` in `@buckspay/relayer`).
    FacilitatorChain:
      type: string
      enum:
        - stellar-testnet
        - stellar-pubnet
      description: Stellar network identifier used in facilitator requests.
    StellarContractAddress:
      type: string
      pattern: ^C[A-Z2-7]{55}$
      description: Stellar contract address (C-address, 56-character StrKey).
  securitySchemes:
    FacilitatorApiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Server-held API key. Injected by the BFF (`createRelayRoute` /
        `createSignerProxyRoute` from `@buckspay/nextjs`). This key must only
        appear in server-side code and must never be shipped to a browser
        bundle.

````