curl --request POST \
--url https://hpay-api.host-sl.com/api/v1/users/create/ \
--header 'api-key: YOUR_API_KEY' \
--header 'secret-key: YOUR_SECRET_KEY' \
--header 'Content-Type: application/json' \
--data '{
"app_user_id": "user_1001",
"name": "John Doe",
"email": "john.doe@example.com",
"phone_number": "+23279123456"
}'
from hostpay import HostPay
client = HostPay(api_key="YOUR_API_KEY", secret_key="YOUR_SECRET_KEY")
user = client.users.create(
app_user_id="user_1001",
name="John Doe",
email="john.doe@example.com",
phone_number="+23279123456",
)
print(user["id"])
import { HostPay } from "@hostpay/sdk";
const client = new HostPay({ apiKey: "YOUR_API_KEY", secretKey: "YOUR_SECRET_KEY" });
const user = await client.users.create({
appUserId: "user_1001",
name: "John Doe",
email: "john.doe@example.com",
phoneNumber: "+23279123456",
});
console.log(user.id);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://hpay-api.host-sl.com/api/v1/users/create/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"api-key: YOUR_API_KEY",
"secret-key: YOUR_SECRET_KEY",
"Content-Type: application/json"
],
CURLOPT_POSTFIELDS => json_encode([
"app_user_id" => "user_1001",
"name" => "John Doe",
"email" => "john.doe@example.com",
"phone_number" => "+23279123456"
])
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
{
"id": "9b2c1f0e-8a3d-4c7b-9e1a-2f5d6c8b0a11",
"app_user_id": "user_1001",
"name": "John Doe",
"email": "john.doe@example.com",
"phone_number": "+23279123456",
"is_active": true,
"created_at": "2025-01-16T10:30:00Z",
"updated_at": "2025-01-16T10:30:00Z"
}
{
"detail": "Email already exists"
}
{
"detail": "Invalid application credentials"
}
Users
Create User
Create a new application user
POST
/
api
/
v1
/
users
/
create
/
curl --request POST \
--url https://hpay-api.host-sl.com/api/v1/users/create/ \
--header 'api-key: YOUR_API_KEY' \
--header 'secret-key: YOUR_SECRET_KEY' \
--header 'Content-Type: application/json' \
--data '{
"app_user_id": "user_1001",
"name": "John Doe",
"email": "john.doe@example.com",
"phone_number": "+23279123456"
}'
from hostpay import HostPay
client = HostPay(api_key="YOUR_API_KEY", secret_key="YOUR_SECRET_KEY")
user = client.users.create(
app_user_id="user_1001",
name="John Doe",
email="john.doe@example.com",
phone_number="+23279123456",
)
print(user["id"])
import { HostPay } from "@hostpay/sdk";
const client = new HostPay({ apiKey: "YOUR_API_KEY", secretKey: "YOUR_SECRET_KEY" });
const user = await client.users.create({
appUserId: "user_1001",
name: "John Doe",
email: "john.doe@example.com",
phoneNumber: "+23279123456",
});
console.log(user.id);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://hpay-api.host-sl.com/api/v1/users/create/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"api-key: YOUR_API_KEY",
"secret-key: YOUR_SECRET_KEY",
"Content-Type: application/json"
],
CURLOPT_POSTFIELDS => json_encode([
"app_user_id" => "user_1001",
"name" => "John Doe",
"email" => "john.doe@example.com",
"phone_number" => "+23279123456"
])
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
{
"id": "9b2c1f0e-8a3d-4c7b-9e1a-2f5d6c8b0a11",
"app_user_id": "user_1001",
"name": "John Doe",
"email": "john.doe@example.com",
"phone_number": "+23279123456",
"is_active": true,
"created_at": "2025-01-16T10:30:00Z",
"updated_at": "2025-01-16T10:30:00Z"
}
{
"detail": "Email already exists"
}
{
"detail": "Invalid application credentials"
}
Endpoint
POST /api/v1/users/create/
Headers
string
required
Your application API key
string
required
Your application secret key
string
default:"application/json"
Content type of the request body
Body Parameters
string
required
Your own identifier for this user in your system. Use it to reconcile HOST Pay
users with your database. Accepts any string identifier (e.g.
user_123, a
UUID, or a plain number). For backward compatibility a numeric value is also
accepted and stored as its string form (1001 becomes "1001"). It cannot be
changed after the user is created.string
required
Full name of the user
string
required
Phone number with country code (e.g., +23279123456)
string
Email address of the user (optional)
string
Optional username for the user
boolean
default:"true"
Whether the user is active on creation
Response
string
HOST Pay’s unique identifier for the user (UUID)
string
The identifier you supplied when creating the user. Always returned as a string.
string
User’s full name
string
User’s email address
string
User’s phone number
boolean
Whether the user account is active (default: true)
string
ISO 8601 timestamp of creation
string
ISO 8601 timestamp of last update
curl --request POST \
--url https://hpay-api.host-sl.com/api/v1/users/create/ \
--header 'api-key: YOUR_API_KEY' \
--header 'secret-key: YOUR_SECRET_KEY' \
--header 'Content-Type: application/json' \
--data '{
"app_user_id": "user_1001",
"name": "John Doe",
"email": "john.doe@example.com",
"phone_number": "+23279123456"
}'
from hostpay import HostPay
client = HostPay(api_key="YOUR_API_KEY", secret_key="YOUR_SECRET_KEY")
user = client.users.create(
app_user_id="user_1001",
name="John Doe",
email="john.doe@example.com",
phone_number="+23279123456",
)
print(user["id"])
import { HostPay } from "@hostpay/sdk";
const client = new HostPay({ apiKey: "YOUR_API_KEY", secretKey: "YOUR_SECRET_KEY" });
const user = await client.users.create({
appUserId: "user_1001",
name: "John Doe",
email: "john.doe@example.com",
phoneNumber: "+23279123456",
});
console.log(user.id);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://hpay-api.host-sl.com/api/v1/users/create/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"api-key: YOUR_API_KEY",
"secret-key: YOUR_SECRET_KEY",
"Content-Type: application/json"
],
CURLOPT_POSTFIELDS => json_encode([
"app_user_id" => "user_1001",
"name" => "John Doe",
"email" => "john.doe@example.com",
"phone_number" => "+23279123456"
])
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
{
"id": "9b2c1f0e-8a3d-4c7b-9e1a-2f5d6c8b0a11",
"app_user_id": "user_1001",
"name": "John Doe",
"email": "john.doe@example.com",
"phone_number": "+23279123456",
"is_active": true,
"created_at": "2025-01-16T10:30:00Z",
"updated_at": "2025-01-16T10:30:00Z"
}
{
"detail": "Email already exists"
}
{
"detail": "Invalid application credentials"
}
Notes
After creating a user, you need to create a wallet for them using the Create
Wallet endpoint. You can then retrieve it
using the Get Wallet endpoint.
Email addresses must be unique within your application’s schema. Attempting to
create a user with an existing email will result in a 400 error.
Next Steps
Create User Wallet
Create a wallet for the new user
Make a Deposit
Add funds to the user’s wallet