Identity
Who-am-I, organization membership, the live scope catalog, and OAuth2 token issuance/revocation.
/api/v1/meGet the authenticated principal
Returns the user, active organization, role, raw token scopes, and effective permissions (token scopes ∩ role permissions). `organization.logoUrl` is a public, absolute image URL (it changes when the logo is replaced), or null when the business has not uploaded one.
Example request
curl "https://pre-invoice.avscorp.in/api/v1/me" \
-H "Authorization: Bearer YOUR_API_KEY"Example response
{
"user": {
"id": "clx2usr001000000000000001",
"email": "you@example.com",
"name": "Karthik"
},
"organization": {
"id": "clx2org001000000000000001",
"name": "AVS Textiles",
"slug": "avs-textiles",
"logoUrl": "https://avsinvoice.app/api/org/logo/public/clx2org001000000000000001?v=1767225600000"
},
"role": "ADMIN",
"tokenType": "oauth",
"scopes": [
"invoices",
"paymentsReceived.read",
"customers.read"
],
"effectivePermissions": [
"invoices.read",
"invoices.create",
"invoices.update",
"invoices.delete",
"paymentsReceived.read",
"customers.read"
]
}Possible errors: unauthorized
/api/v1/me/organizationsList the authenticated user's organizations
Bare array, not paginated — use for an organization switcher.
Example request
curl "https://pre-invoice.avscorp.in/api/v1/me/organizations" \
-H "Authorization: Bearer YOUR_API_KEY"Example response
[
{
"id": "clx2org001000000000000001",
"name": "AVS Textiles",
"slug": "avs-textiles",
"roleKey": "ADMIN"
},
{
"id": "clx2org002000000000000001",
"name": "Sunrise Apparel",
"slug": "sunrise-apparel",
"roleKey": "VIEWER"
}
]Possible errors: unauthorized
/api/v1/me/organizationGet the active organization's business profile
The seller info that appears on invoices: name, legal name, GSTIN, address, phone, email, state code, and base currency. Org-scoped via the token only — no request parameter.
Example request
curl "https://pre-invoice.avscorp.in/api/v1/me/organization" \
-H "Authorization: Bearer YOUR_API_KEY"Example response
{
"name": "AVS Textiles",
"legalName": "AVS Textiles Private Limited",
"gstin": "27AAAAA0000A1Z5",
"address": "12 Industrial Estate, Sector 5, Navi Mumbai, 400701",
"phone": "9876500000",
"email": "accounts@avstextiles.in",
"stateCode": "27",
"currency": "INR"
}Possible errors: unauthorized, not_found
/api/v1/me/subscriptionGet the active organization's plan, trial and access mode
Any member. `accessMode` is FULL, READ_ONLY (trial ended or subscription suspended: writes get 402) or DISABLED, by the same rule as the paywall. `trialDaysLeft` rounds up and is 0 once the trial has ended. Paying is on the web at `billingUrl`, for members with `canManageBilling`.
Example request
curl "https://pre-invoice.avscorp.in/api/v1/me/subscription" \
-H "Authorization: Bearer YOUR_API_KEY"Example response
{
"plan": "PRO",
"planName": "Pro",
"status": "ACTIVE",
"paid": false,
"billingCycle": null,
"isTrial": true,
"trialEndsAt": "2026-11-08T10:00:00.000Z",
"trialDaysLeft": 14,
"renewsAt": null,
"accessMode": "FULL",
"canManageBilling": true,
"billingUrl": "https://avsinvoice.app/settings/billing"
}Possible errors: unauthorized
/api/v1/me/setupGet the first-run setup wizard's state
Whether the active organization still needs setup (`pending`), whether this person should do it now (`canSetUp`: an owner or admin, on a writable org, as on the web), the draft to start from, and the states (`code` is what `stateCode` takes; `gstCode` is the GSTIN prefix).
Example request
curl "https://pre-invoice.avscorp.in/api/v1/me/setup" \
-H "Authorization: Bearer YOUR_API_KEY"Example response
{
"pending": true,
"canSetUp": true,
"draft": {
"name": "Kaveri & Co.",
"businessType": "",
"gstRegistered": true,
"gstin": "",
"stateCode": "",
"addressLine1": "",
"addressLine2": "",
"city": "",
"pincode": "",
"upiId": "",
"bankName": "",
"bankAccountNo": "",
"bankIfscCode": "",
"invoicePrefix": "INV",
"layoutId": "standard",
"modules": [
"inventory",
"purchases"
],
"start": "fresh"
},
"states": [
{
"code": "TN",
"name": "Tamil Nadu",
"gstCode": "33"
}
]
}Possible errors: unauthorized, not_found
/api/v1/me/setupSave the first-run setup wizard
settings.updateThe web /setup wizard's rules and save, in one transaction: business, GST and address, UPI and bank, invoice prefix and design, modules. Clears setupPending. With `start: "sample"`, sample data is added too (`sampleAdded`); the setup is saved even if that fails. Field problems are 422 with `fields`.
Example request
curl -X POST "https://pre-invoice.avscorp.in/api/v1/me/setup" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Kaveri & Co.",
"businessType": "TRADER",
"gstRegistered": true,
"gstin": "33AAPFU0939F1ZV",
"stateCode": "TN",
"addressLine1": "12 Main Rd",
"addressLine2": "",
"city": "Coimbatore",
"pincode": "641001",
"upiId": "kaveri@okhdfc",
"bankName": "",
"bankAccountNo": "",
"bankIfscCode": "",
"invoicePrefix": "INV",
"layoutId": "standard",
"modules": [
"inventory",
"purchases"
],
"start": "fresh"
}'Example response
{
"done": true,
"sampleAdded": false,
"firstInvoiceNumber": "INV-00001",
"importUrl": "https://avsinvoice.app/settings/import"
}Possible errors: unauthorized, forbidden, insufficient_scope, validation_error, invalid_request, internal_error
/api/v1/me/setup/skipSkip the first-run setup wizard
settings.update"Skip setup for now": clears setupPending; the details can be filled in later in Settings.
Example request
curl -X POST "https://pre-invoice.avscorp.in/api/v1/me/setup/skip" \
-H "Authorization: Bearer YOUR_API_KEY"Example response
{
"skipped": true
}Possible errors: unauthorized, forbidden, insufficient_scope
/api/v1/me/email-verificationResend the confirm-your-email message
For the app's verify-email banner, shown while `GET /me` has `user.emailVerified: false`. Rate-limited per user (429).
Example request
curl -X POST "https://pre-invoice.avscorp.in/api/v1/me/email-verification" \
-H "Authorization: Bearer YOUR_API_KEY"Example response
{
"sentTo": "you@example.com"
}Possible errors: unauthorized, validation_error, rate_limited
/api/v1/me/passwordChange the signed-in user's password
First-party mobile app only: a personal access token or a third-party app gets 403. Checks `currentPassword`; `newPassword` needs at least 8 characters, must match `confirmPassword` and differ from the current one. Signs out every browser and every other app sign-in, keeps the calling app signed in, and emails the user a security notice. 10 attempts per 15 minutes per user (429). 409 when the account signs in only with Google and has no password.
Example request
curl -X POST "https://pre-invoice.avscorp.in/api/v1/me/password" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"currentPassword": "••••••••",
"newPassword": "••••••••••",
"confirmPassword": "••••••••••"
}'Example response
{
"passwordChangedAt": "2026-11-26T06:30:00.000Z"
}Possible errors: unauthorized, forbidden, validation_error, conflict, rate_limited, invalid_request, internal_error
/api/v1/signupGet whether signup is open, and the trial length
Public — no authentication required. For a signup screen's "14 days of Pro, free" line; `trialDays` is the master admin's current setting.
Example request
curl "https://pre-invoice.avscorp.in/api/v1/signup" \
-H "Authorization: Bearer YOUR_API_KEY"Example response
{
"enabled": true,
"trialDays": 14,
"plan": "PRO",
"planName": "Pro"
}/api/v1/signupCreate a user and their business on a trial
Public — first-party mobile app. The web signup's rules: a password of at least 8 characters, an email with no account yet, 5 attempts a minute per IP and per email. Then sign in with the password grant and the returned `organizationId`. 403 when signups are closed, 429 when rate-limited.
Example request
curl -X POST "https://pre-invoice.avscorp.in/api/v1/signup" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Priya",
"email": "priya@example.com",
"password": "••••••••••",
"orgName": "Priya Traders"
}'Example response
{
"email": "priya@example.com",
"organizationId": "clx…",
"trialDays": 14
}Possible errors: validation_error, forbidden, rate_limited, invalid_request, internal_error
/api/v1/me/organization/deletionStart deleting the active organization (emails a code)
settings.deleteOwner only. Emails the owner a 6-digit code, valid for 10 minutes and 5 attempts; a new request replaces the previous code. The same flow as Settings › Danger zone on the web. Confirm with `POST /api/v1/me/organization/deletion/confirm`. `502 internal_error` when the email couldn't be sent.
Example request
curl -X POST "https://pre-invoice.avscorp.in/api/v1/me/organization/deletion" \
-H "Authorization: Bearer YOUR_API_KEY"Example response
{
"sentTo": "owner@example.com",
"expiresInMinutes": 10
}Possible errors: unauthorized, forbidden, insufficient_scope, validation_error, internal_error
/api/v1/me/organization/deletion/confirmPermanently delete the active organization
settings.deleteOwner only, with the code from `POST /api/v1/me/organization/deletion`. Emails the owner a `.tar.gz` backup of every record, and only once that email is sent deletes the organization and all its data. Irreversible. Tokens for the organization stop working. A wrong, expired or used code is `422` with `fields.otp`; a failed backup email is `502` and nothing is deleted.
Example request
curl -X POST "https://pre-invoice.avscorp.in/api/v1/me/organization/deletion/confirm" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"otp": "123456"
}'Example response
{
"deleted": true
}Possible errors: unauthorized, forbidden, insufficient_scope, validation_error, internal_error
/api/v1/scopesGet the live scope catalog
Public — no authentication required. The authoritative, always-current list of group/module/granular scopes.
Example request
curl "https://pre-invoice.avscorp.in/api/v1/scopes" \
-H "Authorization: Bearer YOUR_API_KEY"Example response
{
"groups": [
"read",
"write",
"full"
],
"modules": [
"customers",
"quotes",
"salesOrders",
"invoices",
"creditNotes",
"recurringInvoices",
"paymentsReceived",
"collections",
"salespersons",
"schemes",
"crm",
"customerPortal",
"vendors",
"purchaseOrders",
"bills",
"debitNotes",
"paymentsMade",
"expenses",
"items",
"priceLists",
"stock",
"inventory",
"challans",
"manufacturing",
"accounts",
"taxes",
"currencies",
"paymentTerms",
"numberSeries",
"gstFiling",
"gstReconciliation",
"bankReconciliation",
"reports",
"salesReports",
"purchaseReports",
"inventoryReports",
"financialReports",
"approvals",
"whatsapp",
"settings",
"users",
"roles",
"auditLog",
"billing",
"apiAccess",
"dataImport"
],
"granular": [
"customers.read",
"customers.create",
"customers.update",
"customers.delete",
"customers.approve",
"invoices.read",
"invoices.create",
"invoices.update",
"invoices.delete"
]
}/api/v1/app/androidGet the latest Android app release
Public — no authentication required. The app's update check: the latest APK's version and download link, and the oldest version still allowed to run. `data` is null when no release is configured on this server. Cached for 5 minutes.
Example request
curl "https://pre-invoice.avscorp.in/api/v1/app/android" \
-H "Authorization: Bearer YOUR_API_KEY"Example response
{
"latestVersionCode": 10100,
"latestVersionName": "1.1.0",
"minVersionCode": 10000,
"apkUrl": "https://avsinvoice.app/downloads/avs-invoice-1.1.0.apk",
"notes": "Sign in with Google."
}/api/v1/oauth/tokenIssue an OAuth2 token (authorization_code, password, google_id_token or refresh_token grant)
First-party mobile client only — the password grant means sending the end user's own credentials, which is not an appropriate pattern for a third-party integration. `grant_type=google_id_token` takes a Google `id_token` from native Google sign-in in place of username and password. Third-party apps use `grant_type=authorization_code` (with `code`, `redirect_uri`, `code_verifier`) after the consent screen, and get RFC 6749 error bodies; or a Personal Access Token (see Authentication). Response is the raw OAuth2 token payload, not the standard envelope.
Example request
curl -X POST "https://pre-invoice.avscorp.in/api/v1/oauth/token" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"grant_type": "password",
"username": "you@example.com",
"password": "••••••",
"client_id": "avs-mobile",
"scope": "invoices.read customers.read"
}'Example response
{
"access_token": "avs_at_9x7f2h1kQmZ...",
"refresh_token": "avs_rt_3jf82hDkqLp...",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "invoices.read paymentsReceived.read customers.read"
}Possible errors: invalid_grant, invalid_client, unsupported_grant_type, invalid_request
/api/v1/oauth/registerRegister an OAuth client (RFC 7591)
Dynamic client registration for MCP clients and other third-party apps. Open and rate-limited per IP. A registered client gets nothing until a member approves it on the consent screen (`/oauth/authorize`, authorization code + PKCE S256), and its tokens are capped by that member's role. Errors use the RFC shape `{ error, error_description }`, not the envelope.
Example request
curl -X POST "https://pre-invoice.avscorp.in/api/v1/oauth/register" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"client_name": "My MCP client",
"redirect_uris": [
"https://example.com/oauth/callback"
],
"token_endpoint_auth_method": "none"
}'Example response
{
"client_id": "avs_mcp_Qm9zZXJ2ZXJfY2xpZW50XzAx",
"client_id_issued_at": 1793289141,
"client_name": "My MCP client",
"redirect_uris": [
"https://example.com/oauth/callback"
],
"grant_types": [
"authorization_code",
"refresh_token"
],
"response_types": [
"code"
],
"token_endpoint_auth_method": "none"
}Possible errors: invalid_request, rate_limited
/api/v1/oauth/revokeRevoke an OAuth2 access or refresh token
Always returns 200 regardless of whether the token existed (RFC 7009 semantics). Response is not the standard envelope.
Example request
curl -X POST "https://pre-invoice.avscorp.in/api/v1/oauth/revoke" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"token": "avs_at_9x7f2h1kQmZ..."
}'Example response
{
"success": true
}