> ## Documentation Index
> Fetch the complete documentation index at: https://79cdaa32-9b19-4e9d-ab9d-a89800ef0f46.valox.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Create or Deploy a Safe (pending Setup)

> This endpoint serves two purposes - it first checks if a Safe account exists for the user. If no account exists, it creates one and initiates deployment.
If an account already exists but is not deployed, it initiates the deployment process.

This endpoint can be called immediately after user signup as there are no restrictions or prerequisites.

When deploying a new Safe, the endpoint waits for transaction execution and confirmation on-chain.
Because of this, the request may take up to 10 seconds to complete when a deployment is needed.

The deployment process is handled by a sponsored transaction on the ValoX Chain, and the response
includes the transaction hash for tracking the deployment status.

Next steps after successful deployment is to setup the Safe:
- Once this endpoint successfully creates and deploys a Safe account, the user should call
  the `/api/v1/safe/set-currency` endpoint to set the currency for the account.
- Note that the `/api/v1/safe/set-currency` endpoint requires the user to have completed
  the KYC process successfully.
- Then, the user should call the `/api/v1/account/signature-payload` endpoint to get the signature data for the account setup.
- Finally, the user should call the `/api/v1/account/deploy-safe-modules` endpoint to deploy the Safe modules with the user's signature.




## OpenAPI

````yaml specs/api/spec.json post /api/v1/account
openapi: 3.0.0
info:
  title: ValoX API
  version: 1.0.0
  description: OpenAPI documentation for ValoX
servers:
  - url: https://api.valox.co
security: []
tags:
  - name: Account Management
    description: Information about your Account
  - name: Authentication
    description: Authenticate to our API using SIWE
  - name: Card Management
    description: Manage all your Cards
  - name: IBAN
    description: Integrate with Monerium to issue IBANs
  - name: KYC
    description: KYC using Sumsub SDK
  - name: Physical Card Order
    description: Order a Physical Card and manage the process
  - name: Rewards
    description: Cashback Rewards
  - name: Safe Management
    description: Manage your Safe
  - name: Transactions
    description: Manage Card Transactions
  - name: User
    description: Manage User Information
  - name: Webhooks
    description: Manage Webhooks
paths:
  /api/v1/account:
    post:
      tags:
        - Safe Management
      summary: Create or Deploy a Safe (pending Setup)
      description: >
        This endpoint serves two purposes - it first checks if a Safe account
        exists for the user. If no account exists, it creates one and initiates
        deployment.

        If an account already exists but is not deployed, it initiates the
        deployment process.


        This endpoint can be called immediately after user signup as there are
        no restrictions or prerequisites.


        When deploying a new Safe, the endpoint waits for transaction execution
        and confirmation on-chain.

        Because of this, the request may take up to 10 seconds to complete when
        a deployment is needed.


        The deployment process is handled by a sponsored transaction on the
        ValoX Chain, and the response

        includes the transaction hash for tracking the deployment status.


        Next steps after successful deployment is to setup the Safe:

        - Once this endpoint successfully creates and deploys a Safe account,
        the user should call
          the `/api/v1/safe/set-currency` endpoint to set the currency for the account.
        - Note that the `/api/v1/safe/set-currency` endpoint requires the user
        to have completed
          the KYC process successfully.
        - Then, the user should call the `/api/v1/account/signature-payload`
        endpoint to get the signature data for the account setup.

        - Finally, the user should call the
        `/api/v1/account/deploy-safe-modules` endpoint to deploy the Safe
        modules with the user's signature.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - chainId
              properties:
                chainId:
                  type: string
                  enum:
                    - '100'
                  description: The ID of chain (currently only supports ValoX Chain)
      responses:
        '200':
          description: Successfully created or checked Safe account
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The Safe account ID
                  address:
                    type: string
                    description: The Safe account address
                  userId:
                    type: string
                    description: ID of the user owning this Safe
                  chainId:
                    type: string
                    description: ID of the blockchain
                  salt:
                    type: string
                    description: Salt used for Safe address generation
                  createdAt:
                    type: string
                    format: date-time
                    description: Timestamp of when the Safe was created
                  deployed:
                    type: boolean
                    description: Whether the Safe is deployed on-chain
                  transactionHash:
                    type: string
                    description: >-
                      Transaction hash of the deployment transaction (if
                      completed)
              examples:
                deployedSafe:
                  summary: Response when Safe is already deployed
                  value:
                    id: safe-account-id-123
                    address: '0x1234567890123456789012345678901234567890'
                    userId: user123
                    chainId: '100'
                    salt: some-salt-value
                    createdAt: '2024-01-01T00:00:00Z'
                    deployed: true
                newlyDeployedSafe:
                  summary: Response when Safe deployment is initiated and completed
                  value:
                    id: safe-account-id-123
                    address: '0x1234567890123456789012345678901234567890'
                    userId: user123
                    chainId: '100'
                    salt: some-salt-value
                    createdAt: '2024-01-01T00:00:00Z'
                    deployed: true
                    transactionHash: >-
                      0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890
        '400':
          description: Bad request (missing parameters or signer address)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message
              examples:
                missingSignerAddress:
                  value:
                    error: Missing signer address
                missingParameters:
                  value:
                    error: Missing required parameters
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '500':
          $ref: '#/components/responses/InternalServerError'
      deprecated: true
      security:
        - bearerAuth: []
components:
  responses:
    UnauthorizedError:
      description: Unauthorized Error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message
          example: Internal server error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````