1. orders
Product A
  • users
    • List all users
      GET
    • Create a new user
      POST
    • Get user by ID
      GET
    • Update user
      PUT
    • Delete user
      DELETE
  • orders
    • List all orders
      GET
    • Create a new order
      POST
    • Get order by ID
      GET
    • Update order status
      PATCH
    • Cancel an order
      POST
  • Schemas
    • ErrorResponse
    • UserResponse
    • OrderResponse
    • CreateUserRequest
    • OrderItem
    • UpdateUserRequest
    • Address
    • UserListResponse
    • CreateOrderRequest
    • UpdateOrderStatusRequest
    • OrderListResponse
  1. orders

Create a new order

Cloud Mock
https://mock.apidog.com/m1/1332245-0-default
Cloud Mock
https://mock.apidog.com/m1/1332245-0-default
POST
/orders
Create a new order for a user.
Payment is authorized synchronously: a 201 response means the order
is confirmed and the amount has been reserved. If authorization fails,
you receive a 400 with a machine-readable error code — safe to retry
after correcting the payment details.

Request

Authorization
OAuth 2.0
Authorization Code
Add the parameter
Authorization
to Headers
,whose value is to concatenate the Token after the Bearer.
Example:
Authorization: Bearer ********************
Authorize URL: https://account-service-test-user-pool.auth.us-east-1.amazoncognito.com/oauth2/authorize
Token URL: https://account-service-test-user-pool.auth.us-east-1.amazoncognito.com/oauth2/token
Scopes:
openid-OpenID Connect sign-in
or
Body Params application/jsonRequired

Examples

Responses

🟢201Created
application/json
Order created successfully
Headers

Bodyapplication/json

🟠400Bad Request
🟠401Unauthorized
🟠403Forbidden
🔴500Server Error
Request Request Example
Shell
JavaScript
Java
Swift
curl --location 'https://mock.apidog.com/m1/1332245-0-default/orders' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
    "userId": "usr_1a2b3c4d",
    "items": [
        {
            "productId": "prd_laptop001",
            "quantity": 1,
            "unitPrice": 999.99
        },
        {
            "productId": "prd_mouse001",
            "quantity": 2,
            "unitPrice": 25
        }
    ],
    "shippingAddress": {
        "street": "123 Main St",
        "city": "San Francisco",
        "state": "CA",
        "postalCode": "94102",
        "country": "US"
    }
}'
Response Response Example
201 - created
{
    "orderId": "ord_new123abc",
    "userId": "usr_1a2b3c4d",
    "status": "pending",
    "totalAmount": 1049.99,
    "currency": "USD",
    "items": [
        {
            "orderItemId": "itm_001",
            "productId": "prd_laptop001",
            "quantity": 1,
            "unitPrice": 999.99,
            "subtotal": 999.99
        },
        {
            "orderItemId": "itm_002",
            "productId": "prd_mouse001",
            "quantity": 2,
            "unitPrice": 25,
            "subtotal": 50
        }
    ],
    "shippingAddress": {
        "street": "123 Main St",
        "city": "San Francisco",
        "state": "CA",
        "postalCode": "94102",
        "country": "US"
    },
    "createdAt": "2024-01-20T11:00:00Z"
}
Modified at 2026-07-10 12:05:56
Previous
List all orders
Next
Get order by ID
Built with