opencloudportDocs

Building a platform on opencloudport

Run an app for each of your own customers, under one workspace, with each one's spending and keys kept apart.

If you run a product that builds or hosts apps for your own customers (an AI app builder, an agency's client sites, a course platform), you can run all of them on one opencloudport workspace. This page is the pattern: one app per customer, tagged so you can find it again, with usage, limits and keys per customer.

One app per customer, found by your own id

Create each customer's app with your own id for it as external_id. Creating again with the same external_id returns the app that already exists instead of making a second one, so a retried request or a re-run job is safe.

curl https://opencloudport.com/api/v1/apps \
  -H "Authorization: Bearer $OCP_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Ann’s bakery", "external_id": "customer_123", "metadata": { "plan": "pro" } }'

Find it later with GET /api/v1/apps?external_id=customer_123. metadata holds up to 50 short values of your own (plan names, owners), returned with the app.

Usage per customer: end_user

Tag work with the customer it's for. Sending email and starting sandboxes take an end_user, and the usage they cause carries it:

{ "to": "ann@example.com", "subject": "Your order", "text": "Thanks!", "end_user": "customer_123" }

Then ask what each customer used, this month or any range up to 92 days:

curl "https://opencloudport.com/api/v1/usage?group_by=end_user" -H "Authorization: Bearer $OCP_KEY"

Group by app instead to see each app's usage, whoever it was for.

Limits per customer

So one customer can't run up your whole balance:

  • A monthly limit per app. PUT /api/v1/apps/:id/spend-limit { "monthly_limit": "25.00" }. At its limit the app pauses (visitors see "This app is paused."), and it runs again when the month turns or you raise the limit. Its data can still be read.
  • A monthly limit per end user. PUT /api/v1/end-users/default-spend-limit { "monthly_limit": "5.00" } for everyone, or PUT /api/v1/end-users/:end_user/spend-limit for one customer. At their limit, new work tagged with them (an email, a sandbox) is refused with 402 end_user_limit_reached; their apps keep serving. GET /api/v1/end-users lists who spent what this month.
  • Pause and resume one app yourself, when a customer stops paying or asks you to: POST /api/v1/apps/:id/pause (with an optional note only you see) and POST /api/v1/apps/:id/resume. Nothing is deleted.

Your workspace's own balance still pays for everything: if it stays at $0 for 24 hours, every app in it pauses until you top up (nothing is deleted). Keep an eye on it with GET /api/v1/balance. Months are calendar months in UTC.

What paused apps show

By default, visitors of a paused app see a plain "This app is paused." Your customers' visitors shouldn't see our name, so choose what they see, for every kind of pause (yours, a spending limit, an empty balance):

curl -X PUT https://opencloudport.com/api/v1/workspace/paused-page \
  -H "Authorization: Bearer $OCP_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "kind": "redirect", "url": "https://yourplatform.com/paused" }'

{ "kind": "message", "message": "…" } shows your own plain-text message instead, and { "kind": "default" } goes back to ours. It's also under Settings in the dashboard, and reaches every app within about 15 seconds.

Limits for a platform

The workspace limits suit a person or a team. A platform with an app per customer needs more: we raise apps, sandboxes, services per app, domains per app, webhooks and the request rate per key for your workspace on request. Tell us roughly how many customers you expect.

Usage every few minutes

To refresh your own customers' allowances often, ask for usage over an exact window instead of whole days:

curl "https://opencloudport.com/api/v1/usage?since=2026-10-22T14:00:00Z&group_by=end_user" -H "Authorization: Bearer $OCP_KEY"

latest_recorded_at says how far recorded usage reaches. Emails count the moment they're sent, sandbox time within 10 minutes, and requests, CPU and database or storage use within about an hour (they come from the provider's analytics). See Usage.

A key per customer

If your customers (or their agents) call opencloudport themselves, give each one a key that reaches only their app:

curl https://opencloudport.com/api/v1/apps/$APP_ID/keys \
  -H "Authorization: Bearer $OCP_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "customer_123", "access": "full", "spend_limit": "10.00" }'

Add service_id to limit it to one database or bucket, and "access": "read" to make it read-only. Every change a key makes is in its activity log, so you can see what each customer's agent did.

Retries and rate limits

  • Send an Idempotency-Key header on POST requests you might retry (sending email, deploying, creating apps): a retry gets the first answer back instead of doing it twice. See the API's errors and retries.
  • Each key has its own rate limit, so one busy customer's key doesn't slow the others. See Limits.

On this page