# Build with AI

> Give an AI assistant the Clouduxe API docs in one link, and start from ready-made prompts for ordering, syncing and webhooks.

Source: https://docs.clouduxe.com/api/build-with-ai/

Every page of these API docs is written to be read by an AI as easily as by
you. Point your assistant at the docs, paste one of the prompts below, and it
works from what the API actually does rather than from a guess.

## Give your AI the docs

| What | Where | Use it for |
| --- | --- | --- |
| **One file with everything** | [`/llms-full.txt`](https://docs.clouduxe.com/llms-full.txt) | Paste the link into any AI that reads URLs, or the file into one that does not. |
| **The index** | [`/llms.txt`](https://docs.clouduxe.com/llms.txt) | A short summary with a link to every page, in the llms.txt format. |
| **Any one page** | The **Copy page as Markdown** and **View as Markdown** buttons at the top of each page | Hand over just the page you are on. |
| **The contract** | [`/api/openapi.yaml`](https://docs.clouduxe.com/api/openapi.yaml) | The OpenAPI 3.1 file every reference page is generated from, for code generators and tools. |

The **Copy prompt for your AI** button at the top of each page copies a short
prompt that names the page, the base URL and how tokens are sent, and points
at `/llms-full.txt`. **Open in Claude** starts a chat with that prompt.

> **Keep tokens out of the chat:** An AI never needs your token to write code for you. Every prompt here tells it
> to read the token from `CLOUDUXE_API_KEY`. Never paste a `cxk_live_` token into
> a chat, an issue or a repository.

> **Coming: the Clouduxe MCP server:** An MCP server is planned, so AI agents can manage your services through the API
> with your own API token and the same scopes. It is not available yet, and this
> page will say so when it is.

## Prompts for common jobs

Each prompt tells the AI to use only the docs and the contract, to ask which
language you use, and to prefer the official SDK. Copy one, or run it in Claude
directly.

### Provision a VPS and wait for it

Preview the price, order from wallet credit, and wait for the server to be ready.

```text
Write a script that orders one VPS through the Clouduxe API and waits until it is ready.
1. Preview the order with POST /v1/orders/preview for a planId, billingCycleMonths, hostname and imageId I pass in, and print the total.
2. Place it with POST /v1/orders, paid from wallet credit, with a new Idempotency-Key, and with my own reference so I can find it later.
3. Wait for the order's provision action to reach a terminal status, reading GET /v1/actions/{actionId} no more than once every 2 seconds.
4. Print the new service's id and IPv4 address, or the action's failure code.
Handle insufficient_credit, api_ordering_disabled and plan_unavailable with a clear message each.
Use the Clouduxe API docs at https://docs.clouduxe.com/llms-full.txt and the OpenAPI contract at https://docs.clouduxe.com/api/openapi.yaml, and nothing else: if they do not say something, tell me instead of guessing. Read the API token from the CLOUDUXE_API_KEY environment variable. Ask me which language I use before you write code, and use the official Clouduxe SDK for it if there is one.
```

### Keep WHMCS in step with your services

A sync job that matches services to your clients by reference, then stays current from webhooks.

```text
I bill my customers in WHMCS. Build a sync between the Clouduxe API and WHMCS in PHP.
1. List every service with GET /v1/services, following nextCursor until hasMore is false.
2. Match each service to my WHMCS client by its reference field, and store the Clouduxe service id on the WHMCS service.
3. Update each WHMCS service's status from the Clouduxe status, and flag any Clouduxe service with no matching client.
4. Then keep it current without polling: subscribe a webhook endpoint to the service events and apply each one, ignoring an event id I have already processed.
Use the Clouduxe API docs at https://docs.clouduxe.com/llms-full.txt and the OpenAPI contract at https://docs.clouduxe.com/api/openapi.yaml, and nothing else: if they do not say something, tell me instead of guessing. Read the API token from the CLOUDUXE_API_KEY environment variable. Ask me which language I use before you write code, and use the official Clouduxe SDK for it if there is one.
```

### Verify webhook signatures

A receiver that checks Clouduxe-Signature, refuses replays and answers in time.

```text
Write a webhook receiver for Clouduxe events.
1. Read the raw request body before any JSON parsing.
2. Parse the Clouduxe-Signature header (t=<unix seconds>,v1=<hex>; during a secret rotation there are two v1 values).
3. Compute HMAC-SHA256 over "<t>.<raw body>" with the endpoint secret from CLOUDUXE_WEBHOOK_SECRET, and compare it with each v1 value in constant time.
4. Refuse the request when t is more than 300 seconds from my clock.
5. Record each event id and ignore one I have already processed.
6. Answer 2xx within 10 seconds, and do any slow work after answering.
Use the SDK's webhook helper if there is one, and show me how to test it with a sample event.
Use the Clouduxe API docs at https://docs.clouduxe.com/llms-full.txt and the OpenAPI contract at https://docs.clouduxe.com/api/openapi.yaml, and nothing else: if they do not say something, tell me instead of guessing. Read the API token from the CLOUDUXE_API_KEY environment variable. Ask me which language I use before you write code, and use the official Clouduxe SDK for it if there is one.
```

### Explain an error

Paste an error body and get what it means and what to do, from the error catalogue.

```text
I got this error from the Clouduxe API:

<paste the whole error JSON here>

Using the error catalogue in the docs, tell me what the code means, whether I should retry (and after how long), and what to change. Quote the requestId back to me so I can give it to support.
Use the Clouduxe API docs at https://docs.clouduxe.com/llms-full.txt and the OpenAPI contract at https://docs.clouduxe.com/api/openapi.yaml, and nothing else: if they do not say something, tell me instead of guessing. Read the API token from the CLOUDUXE_API_KEY environment variable. Ask me which language I use before you write code, and use the official Clouduxe SDK for it if there is one.
```
