> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.alphax.asia/llms.txt.
> For full documentation content, see https://docs.alphax.asia/llms-full.txt.

# Get order by ID

GET https://public-api.alphax.com/orders/{orderId}

Get order by its ID

Reference: https://docs.alphax.asia/api-reference/alpha-x-api/orders/get-order-by-id

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: alphax-openapi
  version: 1.0.0
paths:
  /orders/{orderId}:
    get:
      operationId: get-order-by-id
      summary: Get order by ID
      description: Get order by its ID
      tags:
        - subpackage_orders
      parameters:
        - name: orderId
          in: path
          description: ID of the order to retrieve
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Details of the requested order
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Orders_getOrderById_Response_200'
servers:
  - url: https://public-api.alphax.com
  - url: https://public-api.demo.alphax.asia
components:
  schemas:
    OrderLineItemsItems:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        quantity:
          type: integer
        unitPrice:
          type: number
          format: double
      title: OrderLineItemsItems
    Order:
      type: object
      properties:
        id:
          type: string
        reference:
          type: string
        description:
          type: string
        currency:
          type: string
        paidNotificationUrl:
          type:
            - string
            - 'null'
        dueNotificationUrl:
          type:
            - string
            - 'null'
        paymentLink:
          type: string
        dueAt:
          type:
            - string
            - 'null'
          format: date-time
        paidAt:
          type:
            - string
            - 'null'
          format: date-time
        createdAt:
          type:
            - string
            - 'null'
          format: date-time
        updatedAt:
          type:
            - string
            - 'null'
          format: date-time
        lineItems:
          type: array
          items:
            $ref: '#/components/schemas/OrderLineItemsItems'
      title: Order
    Orders_getOrderById_Response_200:
      type: object
      properties:
        order:
          $ref: '#/components/schemas/Order'
      title: Orders_getOrderById_Response_200
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

```

## SDK Code Examples

```python
import requests

url = "https://public-api.alphax.com/orders/orderId"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://public-api.alphax.com/orders/orderId';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://public-api.alphax.com/orders/orderId"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://public-api.alphax.com/orders/orderId")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://public-api.alphax.com/orders/orderId")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://public-api.alphax.com/orders/orderId', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://public-api.alphax.com/orders/orderId");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://public-api.alphax.com/orders/orderId")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```