Skip to content
For AI agents · task runbook

Check usage and warn before the plan limit

To check usage, call GET /v1/usage with any API key, or GET /v1/agent with your agent token, and read how many live signatures the plan has left. Esign Comply also emails owners and admins and sends a webhook at 50%, 80%, 90% and 100% of the limit. Tell your person before the limit is reached.

Paste the prompt into your AI agent, or follow the steps yourself. The whole flow is in the guide for AI agents.

Last updated

esigncomply-check-usage.md · 195 words
Check our Esign Comply usage and tell me before we reach the plan's limit.

Read these first and follow them exactly:
- https://esigncomply.com/agents/check-usage.md (this task, step by step)
- https://esigncomply.com/agents.md (every dashboard label and every account call)
- https://esigncomply.com/setup.md (the whole setup runbook)

What stays with me: billing and plan changes. Upgrading is my step, at https://esigncomply.com/dashboard/settings/billing. Never change the plan and never retry a call that answers 402.

What you do:
1. Read the count with GET /v1/usage (ESIGNCOMPLY_API_KEY) or GET /v1/agent (ESIGNCOMPLY_AGENT_TOKEN). Never print the key or the token.
2. Tell me events.used, events.quota and events.remaining, and when the count starts again.
3. If events.level is anything other than "ok", tell me at once and give me the billing address above.
4. Make our webhook handler handle usage.threshold_reached, so the app hears about 50%, 80%, 90% and 100% of the limit.
5. From now on, read the count whenever you finish a piece of work on this project and put the number left in your report.

If the account is locked, stop, tell me, and give me the upgrade_url from GET /v1/agent.

The rules our signing and acceptance flows follow are at https://esigncomply.com/rules.md.

19 lines. Scroll inside the panel to read it, or copy the whole prompt with the button above.

Before step 1

What do you need before you check usage against the plan limit?

  • An API key of any permission in ESIGNCOMPLY_API_KEY, with the API address in ESIGNCOMPLY_API_URL. A test key and a live key of the same account read the same count, because the count is of live signatures.
  • Or an agent token in ESIGNCOMPLY_AGENT_TOKEN. It reads the same count through GET /v1/agent.
  • jq, for the two commands below that pick fields out of the answer.
  • A way to reach your person before the limit: your report, or the channel they asked you to use.
7 steps

How do you check usage against the plan limit with Esign Comply, step by step?

  1. 01

    Read the count with the API key

    The call works with every key permission and is never metered. events.used is the number of sealed live records in the current period, events.quota is what the plan covers, and events.remaining is what is left. events.period is month on the Free plan and year on paid plans, and events.resets_at is the time the count starts again. events.open_sessions reports live sessions that are open: it is not part of used and is not subtracted from remaining.

    curl -s "$ESIGNCOMPLY_API_URL/usage" \
      -H "Authorization: Bearer $ESIGNCOMPLY_API_KEY"
  2. 02

    Or read it with the agent token

    usage in the answer is the whole object of GET /v1/usage, so the same fields are under usage.events. locked is null, or the lock when the plan's limit was reached. plan.name is the name of the plan as a person reads it.

    curl -s https://esigncomply.com/v1/agent \
      -H "Authorization: Bearer $ESIGNCOMPLY_AGENT_TOKEN"
  3. 03

    Know what the plan covers

    Free covers 10 live signatures a month. If you use all 10 in a month, the account locks until you upgrade to a paid plan. It does not unlock at the start of the next month. Past the limit, new live signatures can be refused, so upgrade before you get there. Starter covers 2,000 live signature events a year. At 2,000 the account locks until you pay: upgrade to Unlimited, add an event pack, or renew. Past the limit, new live signatures can be refused, so upgrade before you get there. Unlimited and Enterprise have no limit: quota and remaining are null, locked is false and level is ok.

  4. 04

    Read the level and tell your person in time

    events.level is the highest of 50%, 80%, 90% and 100% of the limit that used has reached: ok, notice_50, notice_80, notice_90 or limit_reached. Read the count whenever you finish a piece of work and put the number left in your report. When the level is anything other than ok, tell your person at once: how many are used, how many the plan covers, and that upgrading is their step at https://esigncomply.com/dashboard/settings/billing. Tell them before the limit, because reaching it locks the account.

    The five fields to report
    curl -s "$ESIGNCOMPLY_API_URL/usage" \
      -H "Authorization: Bearer $ESIGNCOMPLY_API_KEY" \
      | jq '.events | { used, quota, remaining, level, locked }'
  5. 05

    Handle the usage.threshold_reached webhook

    The webhook is sent when live signature events reach 50%, 80%, 90% and 100% of the limit, on Free and Starter. Its data holds threshold (50, 80, 90 or 100), used, quota and period_end. It counts live signatures, so it is a live event and goes to an endpoint of the live environment. In a browser: switch "Environment" in the sidebar to "Live", open https://esigncomply.com/dashboard/webhooks, fill the field "Endpoint URL", set the group "Events" to "All events, including types added later" or "Selected events only", and press "Add endpoint". A status line reads "Endpoint added." and the page shows the line ESIGNCOMPLY_WEBHOOK_SECRET=whsec_… once. Without a browser, a full_access key adds an endpoint in its own environment with the call below, and the answer is a 201 with the secret once, in secret. The Free plan has one endpoint in each environment: a second one answers 403 plan_feature_unavailable.

    Without a browser
    curl -s "$ESIGNCOMPLY_API_URL/webhooks" \
      -H "Authorization: Bearer $ESIGNCOMPLY_API_KEY" -H "Content-Type: application/json" \
      -d '{ "url": "https://app.example.com/api/esigncomply/webhook", "events": ["record.completed", "usage.threshold_reached"] }'
  6. 06

    Know the emails your person gets

    The owners and admins of the organization get an email at the same four points, once per allowance period. On the Free plan that is at 5, 8, 9 and 10 live signatures. One more email is sent if new live signatures start being refused. The dashboard shows the count at https://esigncomply.com/dashboard/settings, page "Usage", and the page "Notifications" sets where usage emails go.

  7. 07

    Stop when the account is locked

    On a locked account events.locked is true, events.level is limit_reached and events.resets_at is null. GET /v1/agent keeps answering: locked holds limit, used, message and upgrade_url, and next_step.id is upgrade. Every other /v1/agent call answers 402 quota_exhausted and changes nothing. Do not retry in a loop: the lock does not lift on its own. Tell your person and give them upgrade_url. Sessions already created still complete.

    curl -s https://esigncomply.com/v1/agent \
      -H "Authorization: Bearer $ESIGNCOMPLY_AGENT_TOKEN" \
      | jq '{ locked, next_step }'

It worked when

your report states events.used, events.quota and events.remaining, your person heard from you before events.level reached limit_reached, and the app's webhook handler handles usage.threshold_reached.

What must a person do, and what must the agent never do?

The account belongs to a person. These limits hold in this task, as they do in every task an agent runs on Esign Comply.

The person does

  • Your person upgrades the plan. Billing and plan changes are theirs, at https://esigncomply.com/dashboard/settings/billing.
  • Your person removes a lock by paying. On the Free plan that is an upgrade to a paid plan.

The agent never does

  • Never change billing or the plan.
  • Never retry in a loop when a call answers 402. The lock does not lift on its own.
  • Never wait for the limit to tell your person. Tell them before it is reached.
  • Never record an acceptance without a session when a new live session is refused. Stop the flow and tell the person.
  • Never print the key or the token in a usage report. Name the variable only.

Questions about this task: check usage against the plan limit

Does calling the usage endpoint cost anything?

No. GET /v1/usage is never metered and works with every key permission. That also makes it the plainest way to check that a key works.

What counts as one live signature event?

One sealed live record: one signer completing one ceremony with a live key. Test records, verifications, downloads, supplements and certificates are not counted.

When does the usage count start again?

On the Free plan at 00:00 UTC on the first of the next month, as long as the account is not locked. On paid plans at the end of the subscription year. The time is in events.resets_at, which is null while the account is locked.

Do open sessions use up the allowance?

No. events.open_sessions reports live sessions that are open and not expired, for information. It is not part of events.used and is not subtracted from events.remaining.

Who receives the usage emails?

The owners and admins of the organization. They get one email at 50%, 80%, 90% and 100% of the limit, once per allowance period. On the Free plan that is at 5, 8, 9 and 10 live signatures.

Can the agent upgrade the plan when the limit is close?

No. Billing and plan changes stay with the person. The agent tells them the count and the limit and gives them the billing page at /dashboard/settings/billing.

What happens to new live signatures once the limit is reached?

They can be refused. At the limit the account locks until your person pays, and past the limit a new live session can be refused with 402 quota_exhausted. Sessions already created still complete.

Does the plan limit apply to test mode?

No. Test records are not signature events and never count against the live limit. Test mode has its own monthly allowance of test events, reported in test_events.

Your person signs up once. You do the rest.

Free plan: 10 live signatures a month and a full test mode. No card required.

Working with an AI tool? This page is also available as Markdown: /agents/check-usage.md