Account Management
These endpoints let you manage your account's credit balance and OAuth2 authentication tokens programmatically. Check your balance before sending campaigns, purchase credits when running low, and manage token lifecycle for production applications.
Credits
Every message you send consumes credits. Use GET /v1/credits to check your current balance and POST /v1/credits/purchase to buy more. The purchase endpoint requires credits (integer) and creditCardLastFour (string). You can optionally include a couponCode.
# Check your credit balance
curl --request GET \
--url https://a.eztexting.com/v1/credits \
--header "Authorization: Basic $(echo -n 'your_username:your_password' | base64)"
# Purchase additional credits
curl --request POST \
--url https://a.eztexting.com/v1/credits/purchase \
--header "Authorization: Basic $(echo -n 'your_username:your_password' | base64)" \
--header "Content-Type: application/json" \
--data '{"credits": 1000, "creditCardLastFour": "4242"}'OAuth2 tokens
OAuth2 is the recommended authentication method for production applications. Tokens expire after 5,400 seconds (90 minutes). Refresh tokens remain valid for 60 days. The token endpoints don't require existing authentication — you create a token by posting your credentials.
# Create an OAuth2 token
curl --request POST \
--url https://a.eztexting.com/v1/tokens/create \
--header "Content-Type: application/json" \
--data '{
"username": "your_username",
"password": "your_password"
}'
# Refresh a token before it expires
curl --request POST \
--url https://a.eztexting.com/v1/tokens/refresh \
--header "Content-Type: application/json" \
--data '{
"refreshToken": "your_refresh_token_here"
}'
# Revoke a token
curl --request POST \
--url https://a.eztexting.com/v1/tokens/revoke \
--header "Content-Type: application/json" \
--data '{
"token": "your_access_token_here",
"type": "ACCESS_TOKEN"
}'Token lifecycle
- Create —
POST /v1/tokens/createwithusername(your EZ Texting username or email) andpassword. ReturnsaccessToken,refreshToken, andexpiresInSeconds. - Use — Include the access token in requests as
Authorization: Bearer {token}. - Refresh — Before the access token expires, call
POST /v1/tokens/refreshwith therefreshToken. - Revoke — When a token is no longer needed, call
POST /v1/tokens/revokewith thetokenand itstype(ACCESS_TOKENorREFRESH_TOKEN).
Endpoints reference
| Endpoint | Method | Description |
|---|---|---|
/v1/credits | GET | Check credit balance |
/v1/credits/purchase | POST | Purchase additional credits |
/v1/tokens/create | POST | Generate OAuth2 access token |
/v1/tokens/refresh | POST | Refresh an expiring token |
/v1/tokens/revoke | POST | Revoke an active token |
Next steps
- Authentication — Full guide to HTTP Basic Auth and OAuth2
- Transactional Messaging — Send individual messages
- Marketing Campaigns — Send campaigns to contact groups
- Contact Management — Manage your audience
- API Reference — Full interactive endpoint documentation