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

# Create an account

> Creates a personal account and returns an API token for it. Before you can create services or API tokens, finish verifying the account (see the Verification endpoints and `isVerified` in `GET /v1/me`).

If an account with this email address already exists and `password` matches it, you're logged in instead and get `200` with a token.

This endpoint is rate limited. Too many requests return `429`.



## OpenAPI

````yaml /spec/platform-auth.yaml post /v1/register
openapi: 3.0.1
info:
  title: Authentication & Account
  version: 1.0.0
  description: >-
    Log in, issue API tokens, change or reset your password, set up two-factor
    authentication, verify your email address and phone number, and manage your
    account profile and billing contact details.
servers:
  - url: https://api.liara.ir
security:
  - bearerAuth: []
tags:
  - name: Login
    description: Exchange your credentials or a one-time code for an API token.
  - name: Registration
    description: Create a new account.
  - name: Password
    description: Change your password while logged in, or reset a forgotten one.
  - name: API Tokens
    description: Issue additional API tokens for your account.
  - name: Account
    description: Read and update your profile and billing contact details.
  - name: Two-Factor Authentication
    description: Set up and manage authenticator-app (TOTP) two-factor authentication.
  - name: Verification
    description: Verify, or change, your account's email address and phone number.
paths:
  /v1/register:
    post:
      tags:
        - Registration
      summary: Create an account
      description: >-
        Creates a personal account and returns an API token for it. Before you
        can create services or API tokens, finish verifying the account (see the
        Verification endpoints and `isVerified` in `GET /v1/me`).


        If an account with this email address already exists and `password`
        matches it, you're logged in instead and get `200` with a token.


        This endpoint is rate limited. Too many requests return `429`.
      operationId: register
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - email
                - password
                - fullname
                - nationalCode
                - phone
              properties:
                email:
                  type: string
                  format: email
                password:
                  type: string
                  maxLength: 250
                fullname:
                  type: string
                  maxLength: 100
                  pattern: ^[\u0600-\u06FF\s]+$
                  description: Persian letters and spaces only.
                nationalCode:
                  type: string
                  pattern: ^\d{10,12}$
                  description: 10 to 12 digits.
                phone:
                  $ref: '#/components/schemas/PhoneNumber'
            example:
              email: you@example.com
              password: <your-password>
              fullname: نام نمونه
              nationalCode: '0000000000'
              phone: '09120000000'
      responses:
        '200':
          description: >-
            An account with this email address and password already exists;
            you're logged in.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoginResponse'
              example:
                api_token: <api-token>
                fullname: نام نمونه
                avatar: https://example.com/avatar.png
        '201':
          description: The account was created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  api_token:
                    type: string
                    description: 'API token to send as `Authorization: Bearer <api-token>`.'
                  avatar:
                    type: string
                    format: uri
              example:
                api_token: <api-token>
                avatar: https://example.com/avatar.png
        '400':
          $ref: '#/components/responses/ValidationError'
        '403':
          description: Accounts can't be registered with this email domain.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                statusCode: 403
                error: Forbidden
                message: >-
                  The email domain example.com is not supported for
                  registration.
                data:
                  code: unsupported_email_domain
        '409':
          description: >-
            The phone number is used by another account, or the email address is
            used by another account with a different password.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                phoneTaken:
                  summary: Phone number in use
                  value:
                    statusCode: 409
                    error: Conflict
                    message: The phone has already been taken by someone else.
                    data: null
                emailTaken:
                  summary: Email address in use
                  value:
                    statusCode: 409
                    error: Conflict
                    message: Email has aleady taken by someone else.
                    data: null
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security: []
components:
  schemas:
    PhoneNumber:
      type: string
      pattern: ^09\d{9}$
      description: Iranian mobile number in the form `09XXXXXXXXX`.
      example: '09120000000'
    LoginResponse:
      type: object
      properties:
        api_token:
          type: string
          description: 'API token to send as `Authorization: Bearer <api-token>`.'
        fullname:
          type: string
        avatar:
          type: string
          format: uri
    Error:
      type: object
      description: Standard error body.
      properties:
        statusCode:
          type: integer
        error:
          type: string
          description: HTTP status text.
        message:
          type: string
          description: What went wrong.
        data:
          type: object
          nullable: true
          description: >-
            Extra details. When present, `code` is a stable, machine-readable
            error code.
          properties:
            code:
              type: string
  responses:
    ValidationError:
      description: The request is invalid. `message` says which field failed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 400
            error: Bad Request
            message: >-
              "phone" with value "123" fails to match the required pattern:
              /^09\d{9}$/
    TooManyRequests:
      description: Too many requests. Wait and try again later.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 429
            error: Too Many Requests
            message: Too Many Requests
            data: null
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Send your API token as `Authorization: Bearer <api-token>`. Tokens
        expire (30 days by default) and stop working when you change or reset
        your password.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.