Skip to main content
POST
/
it
/
calculator
/
pnl
/
securities
/
foreign
Submit P&L Job
curl --request POST \
  --url https://test-api.sandbox.co.in/it/calculator/pnl/securities/foreign \
  --header 'Authorization: <authorization>' \
  --header 'x-accept-type: <x-accept-type>' \
  --header 'x-api-key: <x-api-key>' \
  --header 'x-api-version: <x-api-version>'
import requests

url = "https://test-api.sandbox.co.in/it/calculator/pnl/securities/foreign"

headers = {
"x-accept-type": "<x-accept-type>",
"x-api-key": "<x-api-key>",
"x-api-version": "<x-api-version>",
"Authorization": "<authorization>"
}

response = requests.post(url, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {
'x-accept-type': '<x-accept-type>',
'x-api-key': '<x-api-key>',
'x-api-version': '<x-api-version>',
Authorization: '<authorization>'
}
};

fetch('https://test-api.sandbox.co.in/it/calculator/pnl/securities/foreign', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://test-api.sandbox.co.in/it/calculator/pnl/securities/foreign",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"x-accept-type: <x-accept-type>",
"x-api-key: <x-api-key>",
"x-api-version: <x-api-version>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://test-api.sandbox.co.in/it/calculator/pnl/securities/foreign"

req, _ := http.NewRequest("POST", url, nil)

req.Header.Add("x-accept-type", "<x-accept-type>")
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("x-api-version", "<x-api-version>")
req.Header.Add("Authorization", "<authorization>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://test-api.sandbox.co.in/it/calculator/pnl/securities/foreign")
.header("x-accept-type", "<x-accept-type>")
.header("x-api-key", "<x-api-key>")
.header("x-api-version", "<x-api-version>")
.header("Authorization", "<authorization>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://test-api.sandbox.co.in/it/calculator/pnl/securities/foreign")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-accept-type"] = '<x-accept-type>'
request["x-api-key"] = '<x-api-key>'
request["x-api-version"] = '<x-api-version>'
request["Authorization"] = '<authorization>'

response = http.request(request)
puts response.read_body
{
  "transaction_id": "df7e958a-3837-400d-a169-4337351915da",
  "code": 200,
  "data": {
    "job_id": "df7e958a-3837-400d-a169-4337351915da",
    "url": "https://s3.ap-south-1.amazonaws.com/in-co-sandbox-it-calculator-securities-tax-pnl-dev/df7e958a-3837-400d-a169-4337351915da.input?X-Amz-Security-Token=EXAMPLE_SECURITY_TOKEN&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230919T100048Z&X-Amz-SignedHeaders=host&X-Amz-Expires=86399&X-Amz-Credential=EXAMPLEACCESSKEY%2F20230919%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Signature=EXAMPLE_SIGNATURE"
  },
  "timestamp": "1695117648000"
}
{
"message": "Missing required request parameters: [output, input]"
}

Headers

x-accept-type
string
required

application/json or application/xlsx

x-api-key
string
required

Your API key used to authenticate and authorize the request.

x-api-version
string
required

Indicates the version of the API you want to use. Ensures backward-compatible behavior.

Authorization
string
required

Token for user-level authorization.

Query Parameters

input_file_key
string
input
enum<string>
default:tradewise_settlement
required

Type of input file. Allowed values: tradewise_settlement or tradebook.

Available options:
tradewise_settlement,
tradebook
from
number
required

Start timestamp (inclusive) for the P&L calculation period, expressed as Unix epoch time in milliseconds.

Required range: x >= 0
to
number
required

End timestamp (inclusive) for the P&L calculation period, expressed as Unix epoch time in milliseconds.

Required range: x >= 0
output
enum<string>
default:tradewise_pnl
required

Type of output file. Allowed values: tradewise_pnl or scripwise_pnl

Available options:
tradewise_pnl,
scripwise_pnl
output_file_key
string
bucket
string

Response

Success

transaction_id
string
code
integer
data
object
timestamp
string<utc-millisec>