Official Rust client for the elizon hosting API.
Machine-facing SDK — no localized error messages. API failures return ApiError with a machine-readable code, HTTP status, and raw payload. Map code to your own i18n layer.
- Rust 1.75+
- Tokio runtime for async examples
From the monorepo:
[dependencies]
elizon-api-client = { path = "../public-api/rust" }
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }use elizon_api_client::{
ApiError, ClientKind, ElizonClient, ElizonClientConfig, ElizonError, LoginRequest,
};
#[tokio::main]
async fn main() -> Result<(), ElizonError> {
let client = ElizonClient::new(
ElizonClientConfig::new("https://www.elizon.app").client_kind(ClientKind::Api),
)?;
let login = client.auth.login(LoginRequest {
email: "you@example.com".into(),
password: "secret".into(),
two_factor_code: None,
remember_me: true,
}).await?;
if let Some(token) = login.token {
client.set_token(Some(token));
}
let services = client.services.list(50, None).await?;
println!("Services: {:?}", services.services);
Ok(())
}| Option | Type | Default | Description |
|---|---|---|---|
base_url |
String |
required | elizon API base URL |
token |
Option<String> |
None |
Bearer session token or API key |
client_kind |
ClientKind |
Api |
Sent as X-Elizon-Client header |
headers |
HashMap<String, String> |
empty | Extra headers on every request |
Some financially sensitive endpoints (checkout, invoice payment, business fund) require ClientKind::Desktop. The server rejects Mobile clients for these actions.
Create an API key via client.user.create_api_key("name"), then pass the secret as token:
let client = ElizonClient::new(
ElizonClientConfig::new("https://www.elizon.app")
.token(std::env::var("ELIZON_API_KEY").ok()),
)?;| Namespace | Description |
|---|---|
auth |
Login, sessions, 2FA, profile |
services |
VMs, containers, provider actions |
billing |
Invoices, subscriptions, payment methods |
checkout |
Cart validation, calculation, submit |
shop |
Product catalog |
dashboard |
Overview aggregates |
domains |
Domain list, DNS records |
subdomains |
Subdomain management |
ip_manager |
IP manager entries |
ssh_keys |
SSH key management |
support |
Tickets, knowledge base |
user |
Audit log, API keys, support PIN |
wallet |
Auto top-up, vouchers |
business |
Business fund, billing |
affiliates |
Affiliate profile, commissions |
family |
Family groups, invites |
byoip |
BYOIP networks |
floating_ips |
Floating IP management |
match client.billing.pay_invoice("inv_123", body).await {
Ok(result) => { /* ... */ }
Err(ElizonError::Api(err)) => {
eprintln!("code={} status={}", err.code, err.status);
// err.payload contains the raw API body
}
Err(err) => eprintln!("transport error: {err}"),
}cd public-api/rust
# Auth (email/password)
ELIZON_EMAIL=you@example.com ELIZON_PASSWORD=secret cargo run --example auth
# Services (token or API key)
ELIZON_TOKEN=ek_... cargo run --example services
# Checkout flow
ELIZON_TOKEN=... cargo run --example checkout
# Pay invoice
ELIZON_TOKEN=... ELIZON_INVOICE_ID=inv_... cargo run --example pay_invoicecd public-api/rust
cargo build
cargo testStandalone mirror: elizonapp/api-client-rust.
On every push to main, the Build workflow creates a GitHub Release titled api-client-rust {version} ({sha}) with:
elizon-api-client-{version}.crate— Cargo packageelizon-api-client-{version}-src.zip— source tree (src/,Cargo.toml, examples)
Bump "version" in Cargo.toml when you want a new major/minor/patch line; each release tag still includes the commit SHA.
From the repo root:
node scripts/sync-rust-error-codes.mjsOr:
bun run sync:rust-error-codesMIT — see LICENSE.