> For the complete documentation index, see [llms.txt](https://docs-v2.bulkmail.shop/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-v2.bulkmail.shop/orders/place-an-order.md).

# Place an order

Buys a product: your balance is charged and the account lines come back in items. Manual products answer with status pending (or completed when ready stock covered it) and are delivered later.

```json
{"openapi":"3.1.0","info":{"title":"BulkMail API","version":"2.0"},"tags":[{"name":"Orders","description":"Buy products and read your orders.\n\n| Method | Endpoint | What it does |\n|---|---|---|\n| `GET` | `/orders` | List your orders |\n| `GET` | `/orders/{id}` | Get an order |\n| `POST` | `/orders` | Place an order |\n| `POST` | `/orders/{id}/cancel` | Cancel an order |\n| `GET` | `/orders/{id}/export` | Export delivered lines |\n\n**Authentication:** API key. Send your key in the `X-API-Key` header."}],"servers":[{"url":"https://bulkmail.shop/api/v2","description":"Production"}],"security":[{"ApiKeyAuth":[]},{"ApiKeyQuery":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key","description":"Your API key (sk_live_…)."},"ApiKeyQuery":{"type":"apiKey","in":"query","name":"api_key","description":"Same key as a query parameter. Prefer the header."}},"responses":{"Unauthorized":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","required":["success","error"],"properties":{"success":{"type":"boolean","const":false},"error":{"type":"string","description":"What went wrong."},"errors":{"type":"object","description":"Details: field name to messages for validation errors; code and allowed_quantities for pack-size errors."}}}}},"paths":{"/orders":{"post":{"tags":["Orders"],"summary":"Place an order","operationId":"postOrders","description":"Buys a product: your balance is charged and the account lines come back in items. Manual products answer with status pending (or completed when ready stock covered it) and are delivered later.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"product_id":{"type":"integer","description":"Product id (see GET /products)."},"quantity":{"type":"integer","description":"1 or more; for pack products one of allowed_quantities."},"reward_code":{"type":"string","description":"Optional discount code."}},"required":["product_id","quantity"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"true when the request worked, false on any error."},"data":{"type":"object","properties":{"order_id":{"type":"integer"},"product_name":{"type":"string"},"quantity":{"type":"integer","description":"Units to buy."},"unit_price":{"type":"number","description":"Price paid per unit, USD."},"total_amount":{"type":"number","description":"Amount charged, USD."},"balance_remaining":{"type":"number","description":"Your balance after this order, USD."},"items":{"type":"array","items":{"type":"string"},"description":"Delivered account lines."}},"required":["order_id","product_name","quantity","unit_price","total_amount","balance_remaining","items"],"description":"The account line."}},"required":["success","data"]}}}},"400":{"description":"Bad request: Missing product_id, Invalid pack size, Invalid reward code","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"true when the request worked, false on any error."},"error":{"type":"string","description":"What went wrong."},"errors":{"type":"object","properties":{"code":{"type":"string"},"allowed_quantities":{"type":"array","items":{"type":"integer"},"description":"Pack sizes you may order. null for normal products."}},"required":["code","allowed_quantities"],"description":"Details: field name to messages for validation errors; code and allowed_quantities for pack-size errors."}},"required":["success","error"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"description":"Validation failed or cannot be fulfilled: More than all stock","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"true when the request worked, false on any error."},"error":{"type":"string","description":"What went wrong."}},"required":["success","error"]}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs-v2.bulkmail.shop/orders/place-an-order.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
