All GST return statement API calls

Generate GSTR-2B on demand

POST /v1/gstr2b/generate

Short answer

Send a connected GSTIN and a period. The GST network starts generating the statement and you get an int_tran_id back. Poll it with the status call until generation is done, then fetch the statement.

Cost: Free. Generating and polling are not charged; the fetch that reads the statement is.

Every call accepts "test_mode": true and returns a sample in the live shape, free. How the connection works before the first real call.

Connect the GSTIN once

These calls act on a GSTIN through a connection you make once in the dashboard, under GST Return Filing. You enter the GSTIN and the GST portal username that is registered as its API user, and the GST portal sends an OTP to the registered mobile number or email.

The connection lasts about six hours. After that the API answers 409 NOT_CONNECTED and you reconnect with a new OTP. One connection covers GSTR-2B, GSTR-2A and the other return calls.

The three-step flow

First call generate and keep the int_tran_id. Then poll POST /v1/gstr2b/generate/status with the GSTIN and that id until it shows generation finished. Then call fetch, the only billed step.

You do not need this at all when GSTN has already generated the statement for the period: fetch it directly.

When to regenerate

Use it when suppliers filed late and you want a statement that reflects them. If a period was regenerated more than once, fetch accepts file_num to pick which generation to read.

Request fields

FieldTypeRequiredMeaning
gstinstringYesThe GSTIN whose statement you want. It must be connected first.
ret_periodstringYesReturn period as MMYYYY, for example 042026.
int_tran_idstringNoFor the status call only: the id that generate returned.
test_modebooleanNotrue returns a sample in the live shape: free, never reaches the GST network.

Send your API key in the x-api-key header. The GSTIN is acted on through its connection, so no GST portal password is sent with the call.

Example

The request below runs in test mode, so it is free and files nothing. Remove test_mode for a real call.

curl -X POST "https://www.gstinapi.in/v1/gstr2b/generate" \
  -H "x-api-key: YOUR_API_KEY" -H "Content-Type: application/json" \
  -d '{ "gstin": "27ABCDE1234F1Z5", "ret_period": "042026", "test_mode": true }'

Response

{ "success": true, "int_tran_id": "TRAN-2B-1234" }

Errors you can expect

CodeMessageWhat to do
409NOT_CONNECTEDThe GSTIN is not connected, or its six-hour connection expired. Reconnect it in the dashboard with a new OTP. Not charged.
RET2B1013 / RET01203GSTIN in request doesnt match with sessionThe GST portal username you connected is not the API user of this GSTIN. It is a username/GSTIN pairing problem, not a missing feature. Reconnect with the right pair.

Questions

How long does generation take?
It is up to the GST network. Poll the status call until it reports that generation has finished rather than waiting a fixed time.
Is polling charged?
No. Generate and status are both free.

Not affiliated with the Government of India. Rules are the government network's own and can change; if a page here looks out of date, tell us.