Skip to Content
Developer APIUsing the API (Advanced)

Using the API

The Clorvia API is a GraphQL API. You send a request to one endpoint and ask for exactly the data you want, or make a change.

Endpoint

POST https://api.clorvia.com/graphql

Every request must include your API key token:

Authorization: Bearer YOUR_API_KEY_TOKEN Content-Type: application/json

Explore your schema with the Playground

The fastest way to learn the API is the built‑in Playground:

Settings → APIs & Webhooks → Playground

It shows the exact queries, mutations, and fields available for your workspace (including any custom fields you’ve added) and lets you run them live.

Read data

Lists are paginated. Ask for the first few records:

query { invoices(first: 10) { edges { node { id invoiceNumber totalAmount status } } pageInfo { hasNextPage endCursor } } }

To get the next page, pass the previous endCursor as after:

query { invoices(first: 10, after: "PREVIOUS_END_CURSOR") { edges { node { id invoiceNumber } } pageInfo { hasNextPage endCursor } } }

Create and update data

Use the matching create… / update… mutation. For example, add a customer:

mutation { createParty(data: { name: "Acme Pvt Ltd", partyType: "Customer", gstin: "27ABCDE1234F1Z5" }) { id name } }

Update a record by id:

mutation { updateParty(id: "PARTY_ID", data: { phone: "+91 98765 43210" }) { id phone } }

The exact input fields for each object (Invoices, Items, Customers, Firms…) are shown in the Playground — use it to build your queries.

A full request with curl

curl https://api.clorvia.com/graphql \ -H "Authorization: Bearer YOUR_API_KEY_TOKEN" \ -H "Content-Type: application/json" \ -d '{"query":"mutation { createParty(data: { name: \"Acme Pvt Ltd\", partyType: \"Customer\" }) { id name } }"}'

Errors

GraphQL always returns HTTP 200 for a well‑formed request; check the errors array in the response body. Common cases:

  • Unauthenticated — missing, expired, or revoked token. Check the Authorization header and that the key is still active.
  • Forbidden — the key’s role doesn’t permit that action. Assign it a role with the needed permission.
  • User input — a required field is missing or invalid; the message says which.

Rate & fair use

Keep integrations efficient — request only the fields you need, paginate large reads, and prefer webhooks over frequent polling.