RequestDraftPdfUrl
RequestDraftPdfUrl
This endpoint retrieves Draft PDF copies of a Form W2 for a single employee or multiple employees. Request the Draft PDF URLs by providing the RecordId associated with the forms.
GET formw2/requestdraftpdfUrl Request Params
| Field | Type | Description |
|---|---|---|
| RecordIds | GUID[] | A unique identifier generated by TaxBandits when a return is created. Mention the return's RecordId that you want to delete. |
Response Body
| Field | Type | Description |
|---|---|---|
| RecordId | GUID | A unique identifier of the record |
| employeeId | GUID | A unique employee identifier generated by TaxBandits |
| EmployeeRef | String | A unique identifier for each employee set by you. |
| DraftPdfUrl | String | URL of the Draft PDF |
| DraftPdfPath | String | Storage path of the draft PDF |
| Errors | object[] | Shows detailed error information |
| Id | String | Returns the validation error code |
| Name | String | Name of the validation error |
| Message | String | Description of the validation error |
| Errors | object[] | Shows detailed error information |
| Id | String | Returns the validation error code |
| Name | String | Name of the validation error |
| Message | String | Description of the validation error |
| Errors | object[] | Shows detailed error information |
| Id | String | Returns the validation error ID |
| Name | String | Name of the validation error |
| Message | String | Description of the validation error |
PDF Security
The PDFs contain PII (Personally Identifiable Information) data of the recipients. To make sure that the PII data involved is completely secured, TaxBandits has added additional security to the form PDFs.
The PDF links you get in the Response are encrypted, and you will have to decrypt them before downloading.
Refer to this link for the steps to decrypt PDF with Sample codes.
Payload

Go Lang
Node.js
Python
.NET C#

Ruby
Java

cURL
Request Params
| Sample | Description | Action |
|---|---|---|
| Sample 1 | Query Params - Request Draft PDF URLs for generated Form W2 returns using RecordId. |
Sample 1
formw2/requestdraftpdfUrl?recordid=cf0a188b-6661-4b57-b04b-ba9ead52a16e
Response JSON
| Response | Description | Action |
|---|---|---|
| 200 | Success Response - This is a sample response for successful API requests. | |
| 400 | Bad Request Response - You'll get the below response when your API requests contain any validation errors. | |
| 401 | Unauthorized Response - You'll get the below response when your API requests when Authorization Failed. |
Response: 200
{
"RecordId": "6374a0b5-c08c-494e-87be-8520edd9dc46",
"EmployeeId": "bfae6528-1795-46c4-bb9d-1b54c4142882",
"PayeeRef": “1234”,
"DraftPdfUrl": "https://expressirsforms.s3.us-east-1.amazonaws.com/pdfs/db83ebea-b8de-4b05-8ae6-dd601c896b05/9310bcad-5fb5-4f1d-8a2b-520480aa399d/w2/48726604/d/Single_Draft.pdf",
"DraftPdfPath": "pdfs/db83ebea-b8de-4b05-8ae6-dd601c896b05/9310bcad-5fb5-4f1d-8a2b-520480aa399d/w2/48726604/d/Single_Draft.pdf",
"Error": null
}
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "<APIURL>/v2.0.0/formW2/requestdraftpdfurl?recordid=9e47bb81-4fe0-4ef9-878a-a136c5cd0033"
method := "GET"
// GET request does not require a request body
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "<ACCESS_TOKEN>")
client := &http.Client{}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
const axios = require('axios');
let data = '';
let config = {
method: 'get',
maxBodyLength: Infinity,
url: '<APIURL>/v2.0.0/formw2/requestdraftpdfUrl?recordid=cf0a188b-6661-4b57-b04b-ba9ead52a16e',
headers: {
'Content-Type': 'application/json',
'Authorization': '<ACCESS_TOKEN>'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
import http.client
import json
conn = http.client.HTTPSConnection("<APIURL>")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': '<ACCESS_TOKEN>'
}
conn.request("GET", "/v2.0.0/formw2/requestdraftpdfUrl?recordid=cf0a188b-6661-4b57-b04b-ba9ead52a16e", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "<APIURL>/v2.0.0/formw2/requestdraftpdfUrl?recordid=cf0a188b-6661-4b57-b04b-ba9ead52a16e");
request.Headers.Add("Authorization", "<ACCESS_TOKEN>");
var content = new StringContent("", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
require "uri"
require "json"
require "net/http"
url = URI("<APIURL>/v2.0.0/formw2/requestdraftpdfUrl?recordid=cf0a188b-6661-4b57-b04b-ba9ead52a16e")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "<ACCESS_TOKEN>"
response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("<APIURL>/v2.0.0/formw2/requestdraftpdfUrl?recordid=cf0a188b-6661-4b57-b04b-ba9ead52a16e")
.method("GET", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "<ACCESS_TOKEN>")
.build();
Response response = client.newCall(request).execute();
curl --location '<APIURL>/v2.0.0/formw2/requestdraftpdfUrl?recordid=cf0a188b-6661-4b57-b04b-ba9ead52a16e' --header 'Content-Type: application/json' --header 'Authorization: <ACCESS_TOKEN>' --data ''