Agencies, web studios and SaaS platforms that host sites for their customers all end up running image delivery for somebody else. Each client has its own brand domain, its own storage, its own people who need access, and its own bill to justify. Doing that by hand across twenty clients means twenty sets of credentials in a password manager, twenty DNS changes to remember, and an intern who still has access to a client you stopped working with last spring.
This article describes how to set up ZawCloud Images so that each client is cleanly separated, served from its own domain, and manageable by your team and your scripts without sharing passwords.
One account per client
The unit of separation is the account. Each account has its own origin, its own presets, its own custom domains, its own usage and quota, its own access logs and its own plan. Separate accounts mean one client's traffic spike never eats another client's quota, one client's purge cannot touch another's cache, and handing a client over (or offboarding one) is a single, self-contained operation.
You do not need a separate login per account. Teams separate identity from tenancy: the person signing in is one thing, and the account they are working in is another. Your team members belong to each client account with a role, and anyone who belongs to more than one gets an account switcher in the console sidebar. Working inside an account that is not your own shows a banner saying so, which matters when two clients have similar-looking dashboards.
Roles that match how agencies work
| Role | Can | Typical person |
|---|---|---|
| Owner | Everything, including billing | The client, or your account director if you hold the contract |
| Admin | Everything except billing, including inviting and removing people | Your technical lead on the account |
| Developer | API keys, signed URLs, presets, domains, purges, webhooks | Developers building and maintaining the site |
| Viewer | Read only: usage, analytics, settings | The client's marketing team, a project manager |
The roles are deliberately coarse. A per-person permission matrix is more flexible and much harder to reason about when you are auditing who can do what across twenty clients. When somebody is refused, the console names the role that would have been enough, instead of a bare "forbidden", so people know whom to ask.
Removing a person from an account takes effect immediately, and every management token they created in that account stops working with them (more on tokens below). The team's activity log records who changed what, which is the first place to look when a client asks why their thumbnails changed on Tuesday.
Every client on its own domain
Every account gets a platform hostname such as https://a3f9c21b.zwcld.net
straight away, with nothing to configure. It is opaque on purpose: a readable name would
publish who your client is in every page of their markup. For production, most clients want
images on their own brand domain, such as img.clientbrand.com.
- Register the hostname on the client account's Domains tab. The console shows the exact CNAME record to create.
- The client's DNS team adds the CNAME. This is the only step that needs their DNS, and it is a single record.
- Verification runs automatically, and once it passes, a TLS certificate is ordered, stored and rolled out to every edge node without anybody touching it. Renewal is automatic too. You never handle the client's private keys, and you do not need write access to their DNS zone.
Because the CNAME points at a name served by our GeoDNS, the client's domain is
automatically routed to the nearest edge node for each visitor. If a client later breaks
the record, the domain is taken out of service after repeated failed checks, and a
domain.unverified webhook tells you before the client does.
Paid plans include several custom domains per account (one on Indie, five on Pro Team,
fifteen on Scale), so one client can have img. for the shop and
media. for the blog.
Different origins and URL styles per hostname
Each custom hostname can override two account settings, which is what makes awkward client setups possible:
-
Its own origin.
img.clientbrand.comcan read from the client's private R2 bucket whilestatic.clientbrand.comreads from their public website folder. See Serving images from a private bucket. - Its own URL dialect. A client moving from imgix can keep its old hostname reading imgix-style URLs, while new pages use the native format on a new hostname. See Leaving imgix, Cloudinary or Thumbor without rewriting a URL.
Automate with scoped management tokens
Agencies live in CI pipelines and deployment scripts. The management API
(/api/v1 on the console) exposes presets, custom domains, purges, webhooks and
usage with the same validation as the console's forms. Access is by
management token, created under API Keys → Management API
tokens, and each one carries only the scopes it needs:
| Scope | Lets the token |
|---|---|
read | Read the account, usage, presets, domains, purge history and webhooks |
purge | Purge by path or prefix |
presets:write | Create, change and delete presets |
domains:write | Add, verify and remove custom domains |
webhooks:write | Create and delete webhook endpoints |
Three properties make tokens safe to spread across many client pipelines:
-
Writes do not imply reads. A deploy job that purges the cache after
each release needs
purgeand nothing else. If its token leaks, the worst anybody can do is empty a cache. - A token never does more than the person who created it. Every request checks the token's scope and its creator's current role in the account. Demote a developer to viewer, and the write scopes on their tokens stop working on the next request. Remove them from the team, and their tokens authenticate nobody.
- No token can mint credentials. There is deliberately no scope for API keys, signed URLs, the team or billing. One leaked token cannot become many.
Tokens can be set to expire after 30, 90 or 365 days, and they use a different prefix from delivery keys
(zaw_mgmt_ rather than zaw_live_), so secret scanners in your
repositories can tell them apart.
# In a client's deploy pipeline
curl -s https://console.zawcloud.io/api/v1/purges \
-H "Authorization: Bearer $ZAWCLOUD_TOKEN" \
-H "Content-Type: application/json" \
-d '{"target": "/v1/campaign/*"}'
Presets are worth managing as code. Keep each client's presets in their repository and
apply them with a presets:write token on deploy. A new site then starts with the
same, reviewed set of image sizes as the last one.
Reporting to clients
Clients want to know what they are paying for. Each account's Analytics &
Traffic tab shows deliveries and bandwidth, plus its busiest images, referring sites
and countries for the last day, 7 days or 30 days. Give the client's marketing team the
Viewer role and they can look for themselves. For your own reporting, read-scoped
tokens pull usage into whatever dashboard you already use, and daily access log files can be
downloaded per account.
To avoid surprises at the end of the month, register a webhook per client for
quota.warning and quota.exceeded. The account owner is also emailed
at 90% and at 100% of the allowance, once each per month.
Onboarding and offboarding checklist
New client
- Have the client create the account and invite you, so they own it and its billing from day one.
- Invite your team with the narrowest role each person needs.
- Set the origin, or add a private bucket with a read-only key from the client.
- Register the custom domain and send the client the one CNAME record.
- Apply presets from your template, and set permitted output sizes.
- Create a
purge-only token for the deploy pipeline. - Register webhooks for quota and domain events.
Ending an engagement
- Make sure the client's own people hold the Admin role alongside the client as Owner.
- Remove your team members. Their tokens stop working at the same moment.
- Remove your webhook endpoints from the account.
Nothing in the client's markup changes, because their images were on their own domain all along.