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

# Create or Fetch User

> Creates a new Swaps account for a user or fetches an existing one based on the provided EVM address.



## OpenAPI

````yaml /prediction-market-reference/openapi.json post /api/workflows/polymarket/createOrFetchPolymarketUser
openapi: 3.1.0
info:
  title: Prediction Market API
  description: >-
    API endpoints for trading on prediction markets and querying market data,
    user positions, and activity via workflows.
  version: 1.0.0
  contact:
    name: Swaps.xyz
    url: https://swaps.xyz
servers:
  - url: https://api-v2.swaps.xyz
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /api/workflows/polymarket/createOrFetchPolymarketUser:
    post:
      summary: Create or Fetch User
      description: >-
        Creates a new Swaps account for a user or fetches an existing one based
        on the provided EVM address.
      operationId: createOrFetchPolymarketUser
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOrFetchPolymarketUserRequest'
      responses:
        '200':
          description: Successful response with user information
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateOrFetchPolymarketUserResponse'
        '400':
          description: Bad request due to missing or invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowErrorResponse'
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowErrorResponse'
components:
  schemas:
    CreateOrFetchPolymarketUserRequest:
      type: object
      required:
        - evmEoa
      properties:
        evmEoa:
          $ref: '#/components/schemas/EvmAddress'
          description: EVM address (wallet address)
        unfreeze:
          type: boolean
          description: >-
            Set to `true` to unfreeze a wallet whose `proxyWalletStatus` is
            `temporary-frozen`.
    CreateOrFetchPolymarketUserResponse:
      type: object
      required:
        - userCredentials
        - newUser
        - userId
      properties:
        userCredentials:
          $ref: '#/components/schemas/UserCredentials'
          description: User credentials object containing wallet information
        newUser:
          type: boolean
          description: Whether this is a newly created user (true) or existing user (false)
          example: true
        userId:
          type: string
          description: Polymarket user ID (EVM address)
          example: '0x0797bfec6d2d4f733d461bbee8125805e9e9c892'
    WorkflowErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          description: Always false for error responses
          enum:
            - false
          example: false
        error:
          type: object
          required:
            - code
            - name
            - message
            - title
            - statusCode
            - timestamp
          properties:
            code:
              type: string
              description: Error type code for programmatic handling
            name:
              type: string
              description: Error class name
            message:
              type: string
              description: Detailed error message
            title:
              type: string
              description: Short, user-friendly error title
            statusCode:
              type: integer
              description: HTTP status code
            details:
              type: object
              description: Additional error details
              additionalProperties: true
            timestamp:
              type: string
              description: ISO 8601 timestamp when the error occurred
    EvmAddress:
      type: string
      pattern: ^0x[a-fA-F0-9]{40}$
      description: EVM address (0x prefix + 40 hex characters)
    UserCredentials:
      type: object
      required:
        - evmEoa
      properties:
        evmEoa:
          $ref: '#/components/schemas/EvmAddress'
          description: The home EOA address (wallet address)
        proxyWallet:
          anyOf:
            - $ref: '#/components/schemas/EvmAddress'
            - type: 'null'
          description: Proxy wallet address (if available)
        proxyWalletStatus:
          anyOf:
            - $ref: '#/components/schemas/ProxyWalletStatus'
            - type: 'null'
          description: Status of the proxy wallet
    ProxyWalletStatus:
      type: string
      enum:
        - ready
        - deploying
        - permissioning
        - failed-deploy
        - failed-permission
        - not-created
        - temporary-frozen
      description: Status of the proxy wallet
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key for authentication. Contact Swaps.xyz to obtain an API key.

````