You are on page 1of 9

EPFO API Specification Doc 

(Confidential) 
(EPFO API: NoGUI) 

CONTENTS:

1. Obtain transaction id of user 


 
1. Generate(POST)access token 
 
2. Generate(POST)transaction id 
 
2. POST login info/credentials 
 
3. GET report

1. Obtain transaction id of user:

Generate access token:


With provided “client_id” and “client_secret”, make a post request to generate
“access_token”.

Request

Method https://api-oauth2.digiverifier.com/epfo/generate-post/

POST
Type Params Values
POST client_id String
client_secret String

SAMPLE PYTHON CODE( GENERATE ACCESS TOKEN):

import pandas as pd
import requests
import response
response=requests.post("https://api-oauth2.digiverifier.com/epfo/generate-
post/",headers={'Content-Type':'application/json'},
json={'client_id':'af5cc093-26d6-424d-8825-
582e26e1a10','client_secret':'31VegAwO2iLr1wBeR72mTEvn'})
token=pd.read_json(response.text)
print('Access token is generated:',token['message'][0])
print(response.json())

Response

>>> {'message': {'access_token': 'c343b46e-94c1-41d5-a4fd-154b16efba21', 'client_id': '


c41d1eba-6a34-453c-85e8-3571db86', 'expires_in': 900, 'created_time':
1562754835},
'code': 'success',
'success': True}
sucess Code message
True success {"access_token":
"f64c8179-ebaf-486f-94a0-
4492923bb359",
"client_id": "af5cc093- 26d6-424d-
8825- 582e26ae1a",
"client_name": "justin",
"expires_in": 900,
"created_time": 1646974494}
false Internal error client secret is not correct
false Internal error
client id is not registered
false Internal error client id and client secret is
not provided

Generate transaction id:


We now use the generated “access_token” in the previous step as “Authorization”
header.
Make a get request to generate the transaction id.

Request

Method https://api-oauth2.digiverifier.com/epfo/transaction-get/

GET

Type Header Values


POST c343b46e-94c1-41d5-a4fd- string
154b16efba21
SAMPLE PYTHON CODE (GENERATE TRANSACTION ID):

response = requests.get("https://api-oauth2.digiverifier.com/epfo/transaction-get/",
headers={'accept':'application/json','bearer':token['message'][0]})
tid=response.json()

print("Transaction id is generated:" ,tid['message'],'\n')


print(response.json())

Response

>>> {'message': 'EPFOEMPLOYER181264392702507931100529319290713666160',


'code': 'success',
'success': 'True'}

sucess Code message


True sucess 'EPFOEMPLOYER181264392702
5079311005293192907136661
60'
false Internal error Token is invalid for the client
false Internal error Token gets expired

2. POST login info/credentials:

Using credentials and login parameters from previous request, make a


post request to trigger report fetch at the API backend.
Request

Method https://api-
oauth2.digiverifier.com/epfo/submit-
post/?txnid=<transactionid>
POST
Type Params Values
POST epfoemployer-user string
epfoemployer-pwd String
employee-uan String

SAMPLE PYTHON CODE (TRIGGER REPORT FETCH):


response=requests.post("https://api-oauth2.digiverifier.com/epfo/submit-post/?
txnid="+str(tid['message']),
headers={'accept':'application/json','Bearer':token['message']
[0],'txnid':tid['message']},
json={'employee-uan':'UAN-NUMBER'})
print('')
print(response.json())

Response

>>> {'code': 'success', 'message': [{'uan', 'name': '',


'company': 'SOBHA LIM', 'doj': '25/04/2018', 'doe': 'NOT_AVAILABLE'}, {'uan': 1010,
'name': 'MOHAN', 'company': ' CONSULTING INDIA PVT
LTD', 'doj': '27/02/2017', 'doe': '28/02/2018'}], 'success': True}
sucess Code message
True sucess {'code': 'success',
'message': [{'uan': 101, 'name': 'MOHAN
',
'company': ' LIMITED', 'doj':
'25/04/2018', 'doe':
'NOT_AVAILABLE'}, {'uan': 101076, 'name':
'MOHAN',
'company': 'CONSULTING INDIA PVT LTD', 'doj':
'27/02/2017', 'doe':
'28/02/2018'}],
'success': True}
false invalid_usr_pwd invalid username or password

false internal_error invalid transactionid

false Internal error service unavailable

3. GET report:
It takes around 60 seconds to complete report generation at the backend after the
previous step of submitting credentials. A simple get request along with access token and
transaction id information can be used to obtain the report. We can obtain the report in
‘json’ format by using the URL. See python sample code below to obtain the report.
By default, the transaction id and json report associated with it expires in 20 minutes.
Request

Method Get report in ‘json’ format:


https://api-oauth2.digiverifier.com/epfoemployer
/report-get/txnid=<txnid>
GET
SAMPLE PYTHON CODE(GET REPORT IN JSON FORMAT):

respon=requests.get('https://api-oauth2.digiverifier.com/epfo/report-get/?
txnid='+str(tid['message'])+'&format=json',
headers={'accept':'application/json','Bearer':token['message'][0]})
respon.text

SAMPLE PYTHON CODE(GET REPORT IN XML FORMAT):

respon=requests.get('https://api-oauth2.digiverifier.com/epfo/report-get/?
txnid='+str(tid['message'])+'&format=json',
headers={'accept':'application/json','Bearer':token['message'][0]})
respon.text

Response
>>> {'code': 'success', 'message': [{'uan': 1010760729, 'name': 'MOHAN',
'company': ' LIMITED', 'doj': '25/04/2018', 'doe': 'NOT_AVAILABLE'}, {'uan':
1010760, 'name': 'MOHAN', 'company': ' CONSULTING INDIA PVTLTD', 'doj':
'27/02/2017', 'doe': '28/02/2018'}], 'success': True}
SAMPLE PYTHON CODE(GET REPORT IN pdf FORMAT):
import base64
from base64 import b64decode
import codecs

response=requests.get(check+'/epfo/report-get-pdf/?txnid='+str(tid['message'])
+'&format=json',
headers={'accept':'application/json','Bearer':token['message'][0]})

print(response.text)
decoded_string = base64.b64decode(ascii(response.text))
with open('Binary_string_checking.pdf', 'wb') as f:
f.write(decoded_string)
with open('report.pdf','wb') as f:
f.write(response.content)
Glossary 
 
Conventions 
 Client-Client application. 
 Status-HTTP status code of response. 
 All response are in JSON format. 
 
Status Codes 
All status codes are standard HTTP status codes. The below ones are used in this API. 
 
2XX-Successofsomekind 
4XX-Erroroccurredinclient’spart 
5XX-Erroroccurredinserver’spart 

You might also like