Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions docs/business.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Business

### Create New Business

<HttpMethod type='post' /> `/businesses`

This endpoint allows you to create a new business entity under current business.
It returns created business details, including the `urlKey` for creating invoices in the future. <br />
Use the existing token with the new `urlKey` to create invoices for the new business entity.

<Tabs>
<TabItem value="request" label="Request">
**Headers**

| Name | Type | `Value` Description |
| ---------------- | ------ | ------------------- |
| Content-Type \* | string | `application-json` |
| Authorization \* | string | `Bearer <jwt>` |

**Body**

| Name | Type | `Value` Description |
| ----------------- | ------------- | ----------------------------------------------------------------------------------- |
| name \* | string | Name of the business |
| country \* | string | Country code (e.g., "IN" for India) |
| gstin | string | GST Identification Number |
| **billedTo** | object | Billing information |
| billedTo.name | string | Name for billing |
| billedTo.phone | string | Phone number |
| billedTo.email | string | Email address |
| billedTo.country | string | Country code |
| billedTo.gstState | string | GST state code |
| billedTo.pincode | string | Postal code |
| billedTo.city | string | City name |
| billedTo.street | string | Street address |
| billedTo.gstin | string | GST Identification Number |
| **auth** | object | Authentication information |
| auth.email \* | array[string] | List of users to add in the business |

</TabItem>

<TabItem value="response" label="Response">
:::success `200: OK`
Successful creation of a business entity.

```json #
{
"_id": "60cc8cc6aa3024abd4bef447",
"name": "Business Name",
"country": "IN",
"gstin": "29ABCDE1234F2Z5",
"urlKey": "business-url-key",
"country": "IN",
"currency": "IN",
"billedTo": {
"name": "Billing Name",
"phone": "+91 9876543210",
"email": "billing@example.com",
"country": "IN",
"gstState": "29",
"pincode": "560100",
"city": "Bangalore",
"street": "Street Address",
"gstin": "29ABCDE1234F2Z5"
},
"users": [
{
"name": "John Doe",
"email": "doejohn04@gmail.com",
"_id": "65ae751d8d476d33b879162d"
}
],
"createdAt": "2024-08-18T12:08:38.000Z",
"updatedAt": "2024-08-18T12:08:38.000Z"
}
```

:::

:::danger `401: Unauthorized`
Invalid authentication.

```json #
{
"name": "NotAuthenticated",
"message": "Invalid login",
"code": 401,
"className": "not-authenticated",
"data": {
"message": "Invalid login"
},
"errors": {}
}
```

:::

</TabItem>
</Tabs>
94 changes: 94 additions & 0 deletions docs/generate-einvoice.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Generate IRN

### Generation of E-Invoices (IRN) for Indian Business Invoices

### Overview

The Invoice Reference Number (IRN) is a unique identifier assigned to invoices, debit notes, and credit notes under the e-Invoicing system within the Goods and Services Tax (GST) framework. This system, facilitated by the Invoice Registration Portal (IRP), ensures streamlined, compliant, and secure invoicing for businesses.

<HttpMethod type='post' /> `/businesses/:urlKey/invoices/:invoice/irn`

This endpoint allows you to generate IRN for an existing refrens invoice.

<Tabs>
<TabItem value="request" label="Request">
**Path Params**

`urlKey` - The unique identifier of the business. <br />
`invoice` - The invoice ID for which the IRN is to be generated.

**Query Params**

| Name | Type | `Value` Description |
| -------------- | ------- | ----------------------------------------------- |
| includePaymentDetails | boolean | Set to `true` if you want to include the associated payments. |

**Headers**

| Name | Type | `Value` Description |
| ---------------- | ------ | ------------------- |
| Content-Type \* | string | `application-json` |
| Authorization \* | string | `Bearer <jwt>` |

</TabItem>

<TabItem value="response" label="Response">
:::success `200: OK`
The response will include the details of the e-invoice generated for the specified invoice.

```json
{
"AckNo": "182510010588566",
"AckDt": "2025-04-21 01:16:26",
"Irn": "b5abd0386b52bd2c30e014609ae6403c87576b01583f7cf1ef25370e7a14a92f",
"SignedInvoice": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjNCRTE3RTUxNDE5MjUyMjY0N0YwMUZEQkZGNTI3MUFENTI2OEQ3MzUiLCJ4NXQiOiJPLUYtVVVHU1VpWkg4Ql9iXzFKeHJWSm8xelUiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJOSUMgU2FuZGJveCIsImRhdGEiOiJ7XCJBY2tO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hYmQwMzg2YjUyYmQyYzMwZTAxNDYwOWFlNjQwM2M4NzU3NmIwMTU4M2Y3Y2YxZWYyNTM3MGU3YTE0YTkyZlwiLFwiSXJuRHRcIjpcIjIwMjUtMDQtMjEgMDE6MTY6MjZcIn0ifQ.yQuP8IG5Qjc6juwfklMEQtMZkmKGgLPqIARnRWGye0Y-wV9BvBPXs6hfBFm_LcfLec0yrulnLuBbgTa67ngl0b-0CQkEPFy0EfqViVNQb7TtIPUSaIh4k0ewi9ff87R0PiaUqVbsPQdDPBVWb2o32rETzqcdddFeJ1idhBCYpwKqz__HNGE4i9CtMoPSXuip1GNRDyn7z-uT1-ayaeawjwGGSf8S9ADnGQxDFGvM6Jux20TqgPbiS91QwEfFXPP-_DXSp1UUp0bgDUXDUa8nWvGOCamn7OQdkk5geXtsomm0FFcH07T9lcGUzjeQ3QZ3YO14SxAnZq46sDpfBfiGZg",
"Status": "ACT",
"info": null,
"additionalInfo": null,
"alert": null,
"qr": "{\"SellerGstin\":\"19AAAPI3182M017\",\"BuyerGstin\":\"29AAICA3919L1ZE\",\"DocNo\":\"UG032\",\"DocTyp\":\"INV\",\"DocDt\":\"14/04/2025\",\"TotInvVal\":424.8,\"ItemCnt\":2,\"MainHsnCode\":\"8414\",\"Irn\":\"b5abd0386b52bd2c30e014609ae6403c87576b01583f7cf1ef25370e7a14a92f\",\"IrnDt\":\"2025-04-21 01:16:26\"}",
"invoiceNumber": "UG032",
"invoiceId": "67fcb537f811496b8721362b"
}
```

:::

:::danger `401: Unauthorized`
Invalid authentication.

```json
{
"name": "NotAuthenticated",
"message": "Invalid login",
"code": 401,
"className": "not-authenticated",
"data": {
"message": "Invalid login"
},
"errors": {}
}
```
:::

:::danger `400: Bad Request`
Error in generating IRN.

```json
{
"errorMessage": {
"details": [
{
"ErrorCode": "2240",
"ErrorMessage": "For Sl. No 1, GST rate of tax is incorrect or not as notified"
}
]
},
"errorMessageDate": 1745178346990
}
```
:::

</TabItem>
</Tabs>
110 changes: 106 additions & 4 deletions docs/invoices.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### Create New Invoice

<HttpMethod type="post" /> `/businesses/:urlKey/invoices`
<HttpMethod type='post' /> `/businesses/:urlKey/invoices`

This endpoint allows you to create an invoice

Expand Down Expand Up @@ -173,14 +173,15 @@ This endpoint allows you to create an invoice
```

:::

</TabItem>
</Tabs>

---

### Find Invoices

<HttpMethod type="get" /> `/businesses/:urlKey/invoices`
<HttpMethod type='get' /> `/businesses/:urlKey/invoices`

This endpoint allows you to find created invoices

Expand All @@ -199,7 +200,7 @@ This endpoint allows you to find created invoices

**Query Prams**

Optinal - Can be used for limiting results
Optional - Can be used for limiting results

| Name | Type | `Value` Description |
| -------------------- | ------ | --------------------------------------------------------- |
Expand All @@ -209,6 +210,7 @@ This endpoint allows you to find created invoices
| $sort[createdAt] | number | sort order on created date (1 ascending, -1 descending) |
| $sort[invoiceNumber] | number | sort order on invoice number (1 ascending, -1 descending) |
| $sort[invoiceDate] | number | sort order on invoice date (1 ascending, -1 descending) |

</TabItem>

<TabItem value="response" label="Response">
Expand Down Expand Up @@ -244,12 +246,12 @@ This endpoint allows you to find created invoices
```

:::

</TabItem>
</Tabs>

### Get Invoice


<HttpMethod type='get' /> `/businesses/:urlKey/invoices/:invoiceId`

This endpoint allows you to get a invoice via invoiceId (\_id)
Expand All @@ -268,6 +270,7 @@ This endpoint allows you to get a invoice via invoiceId (\_id)
| ---------------- | ------ | ------------------- |
| Content-Type \* | string | `application-json` |
| Authorization \* | string | `Bearer <jwt>` |

</TabItem>

<TabItem value="response" label="Response">
Expand Down Expand Up @@ -383,5 +386,104 @@ This endpoint allows you to get a invoice via invoiceId (\_id)
```

:::

</TabItem>
</Tabs>

---

### Cancel Invoice

<HttpMethod type='patch' /> `/businesses/:urlKey/invoices/:invoice?cancelPayment=true`

This endpoint allows you to update an invoice for a specific business.

<Tabs>
<TabItem value="request" label="Request">
**Path Params**

`urlKey` - The unique identifier of the business. <br />
`invoice` - The invoice ID for which the status is to be updated.

**Query Params**

| Name | Type | `Value` Description |
| -------------- | ------- | ----------------------------------------------- |
| cancelPayment | boolean | Set to `true` if you want to cancel the associated payments. |

**Headers**

| Name | Type | `Value` Description |
| ---------------- | ------ | ------------------- |
| Content-Type \* | string | `application-json` |
| Authorization \* | string | `Bearer <jwt>` |

**Body**

```json
{
"status": "CANCELED"
}
```

</TabItem>

<TabItem value="response" label="Response">
:::success `200: OK`
Upon successful execution, the API responds with a status code of 200 and a JSON object containing the updated details of the invoice.

```json
{
"_id": "60cc8cc6aa3024abd4bef447",
"invoiceNumber": "APP-2020-0004",
"status": "CANCELED",
"currency": "INR",
"invoiceTitle": "Invoice",
"billType": "INVOICE",
"discount": {
"discountType": "PERCENTAGE"
},
"items": [
{
"name": "Item one name",
"rate": 100,
"quantity": 2,
"gstRate": 18,
"amount": 200,
"total": 236
}
],
"payments": [],
"finalTotal": {
"total": 0,
"amount": 0,
"subTotal": 0,
"igst": 0,
"cgst": 0,
"sgst": 0,
"discount": 0
},
"updatedAt": "2024-08-18T12:08:38.000Z"
}
```
:::

:::danger `401: Unauthorized`
Invalid authentication.

```json
{
"name": "NotAuthenticated",
"message": "Invalid login",
"code": 401,
"className": "not-authenticated",
"data": {
"message": "Invalid login"
},
"errors": {}
}
```
:::

</TabItem>
</Tabs>
Loading