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

# Purchase server

> This API endpoint allows you to purchase a new server using your
available balance. By default the server is provisioned for one month;
pass `duration` to purchase a longer initial term and benefit from the
duration discount tiers.




## OpenAPI

````yaml post /order
openapi: 3.1.0
info:
  title: APIFiddle Sample Definition
  version: 0.0.0
  description: Example workspace
servers:
  - url: https://rdp.sh/api/v1
    description: Default production endpoint.
security: []
paths:
  /order:
    post:
      summary: Order a new server
      description: |
        This API endpoint allows you to purchase a new server using your
        available balance. By default the server is provisioned for one month;
        pass `duration` to purchase a longer initial term and benefit from the
        duration discount tiers.
      operationId: orderANewServer
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - plan_id
                - region_id
                - distro_id
              properties:
                plan_id:
                  type: integer
                  description: ID of the plan to purchase.
                region_id:
                  type: integer
                  description: ID of the region to deploy in.
                  examples:
                    - 1
                distro_id:
                  type: integer
                  description: ID of the distro or ISO image to install on the server.
                duration:
                  type: integer
                  minimum: 1
                  maximum: 12
                  default: 1
                  description: >
                    Number of months to purchase the server for (1-12). The
                    total

                    is calculated as `plan.price * duration` with the duration

                    discount tier applied:

                    - 3 months: 5% off

                    - 6 months: 10% off

                    - 12 months: 15% off


                    Other durations (1, 2, 4, 5, 7, 8, 9, 10, 11) receive no

                    discount.
                ssh_key:
                  type: string
                  maxLength: 8192
                  description: >
                    Optional raw SSH **public** key (e.g. `ssh-ed25519 AAAA...
                    user@host`)

                    to install on the new server. Only valid when `distro_id`

                    refers to a Linux distro — supplying it together with a

                    Windows ISO returns an error.


                    The key is provisioned via cloud-init at first boot. You do

                    not need to register the key on the dashboard first.
                  examples:
                    - >-
                      ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIExampleKeyDataHere
                      user@example
      responses:
        '201':
          content:
            application/json:
              schema:
                type: object
                title: OrderANewServerCreated
                required:
                  - success
                properties:
                  success:
                    type: boolean
                  server_id:
                    type: integer
                  invoice_id:
                    type: integer
                    description: ID of the invoice created for this purchase.
                  duration:
                    type: integer
                    description: Number of months the server was purchased for.
                    examples:
                      - 1
                  amount_charged:
                    type: number
                    description: >
                      Total amount deducted from the user's balance after
                      applying

                      the duration discount tier.
                    examples:
                      - 102
                  expiry_date:
                    type: string
                    description: ISO-8601 expiry timestamp for the new server.
                    examples:
                      - '2027-05-04T12:00:00.000000Z'
          description: The request was successful, and a new resource was created.
      security:
        - Authorization: []
components:
  securitySchemes:
    Authorization:
      in: header
      name: Authorization
      type: apiKey

````