<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE>Using the Flex Web Service</TITLE>
<meta name="generator" content="Adobe RoboHelp - www.adobe.com">
<link rel="stylesheet" href="reportmgmt_ns.css"><script type="text/javascript" language="JavaScript" title="WebHelpSplitCss">
<!--
if (navigator.appName !="Netscape")
{ document.write("<link rel='stylesheet' href='reportmgmt.css'>");}
//-->
</script>
<style type="text/css">
<!--
li.whs1 { list-style:decimal; }
img_whs2 { width:380.250pt; height:124.500pt; }
img_whs3 { width:354.000pt; height:293.250pt; }
li.whs4 { list-style:lower-alpha; }
img_whs5 { width:504.000pt; height:105.500pt; }
-->
</style><script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">
<!--
function reDo() {
if (innerWidth != origWidth || innerHeight != origHeight)
location.reload();
}
if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {
        origWidth = innerWidth;
        origHeight = innerHeight;
        onresize = reDo;
}
onerror = null;
//-->
</script>
<style type="text/css">
<!--
div.WebHelpPopupMenu { position:absolute; left:0px; top:0px; z-index:4; visibility:hidden; }
-->
</style><script type="text/javascript" language="javascript1.2" src="../../whmsg.js"></script>
<script type="text/javascript" language="javascript" src="../../whver.js"></script>
<script type="text/javascript" language="javascript1.2" src="../../whproxy.js"></script>
<script type="text/javascript" language="javascript1.2" src="../../whutils.js"></script>
<script type="text/javascript" language="javascript1.2" src="../../whlang.js"></script>
<script type="text/javascript" language="javascript1.2" src="../../whtopic.js"></script>
</HEAD>
<BODY><script type="text/javascript" language="javascript1.2">
<!--
if (window.gbWhTopic)
{
        if (window.addTocInfo)
        {
        addTocInfo("Report Management\nDelivery Settings\nUsing the Flex Web Service");
addButton("show",BTN_TEXT,"Show","","","","",0,0,"","","");
        }
        if (window.writeBtnStyle)
                writeBtnStyle();
        if (window.writeIntopicBar)
                writeIntopicBar(1);
        if(1)
        {
        document.write("<p style=\"font-family: Verdana; font-size: 10pt; font-weight: 400; font-style:normal; color: rgb(0, 0, 255); text-decoration:none; text-align: right; background: #ffff99\"> ");
AddMasterBreadcrumbs("../../accountmanagement.htm", "font-family: Verdana; font-size: 10pt; font-weight: 400; font-style:normal; color: rgb(0, 0, 255); text-decoration:none; text-align: right; background: #ffff99", ">", "Home", "../../home.htm");
document.write("<a style=\"font-family: Verdana; font-size: 10pt; font-weight: 400; font-style:normal; color: rgb(0, 0, 255); text-decoration:none; text-align: right; background: #ffff99\" href=\"report_management.htm\">Report Management</a> > <a style=\"font-family: Verdana; font-size: 10pt; font-weight: 400; font-style:normal; color: rgb(0, 0, 255); text-decoration:none; text-align: right; background: #ffff99\" href=\"delivery_settings.htm\">Delivery Settings</a> > Using the Flex Web Service</p>");
        }
        if (window.setRelStartPage)
        {
        setRelStartPage("../../accountmanagement.htm");
                autoSync(1);
                sendSyncInfo();
                sendAveInfoOut();
        }
}
else
        if (window.gbIE4)
                document.location.reload();
//-->
</script>
<h1><a name="IX_Flex_queries"></a><a name="IX_Flex_Web_Service"></a><a name="XREF_87104_Using_the_Flex_Web"></a>Using the Flex Web Service</h1>
<p class="Body">The Flex Web Service lets you access your pre-configured flex queries via HTTPS protocol without logging into Account Management. This feature lets you write automated client software in your preferred language, which can request previously defined Flex queries in real-time.</p>
<h3>Who Can Access the Flex Web Service?</h3>
<p class="Body">You can access this page if you are a(n):</p>
<ul>
<li>
<p class="Bullet">Individual User</p>
</li>
<li>
<p class="Bullet">Advisor Master Users Individual</p>
</li>
<li>
<p class="Bullet">Advisor Master Users Organization</p>
</li>
<li>
<p class="Bullet">Advisor Client Users Individual</p>
</li>
<li>
<p class="Bullet">Advisor Client Users Organization</p>
</li>
<li>
<p class="Bullet">Proprietary Trading Group Master User</p>
</li>
<li>
<p class="Bullet">Proprietary Trading Group Sub User</p>
</li>
<li>
<p class="Bullet">Broker Master User<span style="letter-spacing : 0.00em; "> (master account only)</span></p>
</li>
<li>
<p class="Bullet">Broker Full Disclosed Client User</p>
</li>
<li>
<p class="Bullet">Broker Fully Disclosed Client User Organization</p>
</li>
</ul>
<p class="ProcedureHeading">To use the Flex Web Service</p>
<ol start="1">
<li class="whs1">
<p class="NumberedFirst">Click <span style="font-weight : bold; "><B>Report Management </B></span>in the left pane, then click <span style="font-style : italic; "><I>Delivery Settings</I></span>.</p>
</li>
<li class="whs1">
<p class="Numbered">Click the <span style="font-style : italic; "><I>Flex Webservice </I></span>link. </p>
<div align="center"><img id="15" src="flexwebservicedeliveryactivate.jpg" class="img_whs2">
</div>
<p class="Numbered"></p>
</li>
<li class="whs1">
<p class="Numbered">Activate the Flex Web Service by clicking the <span style="font-style : italic; "><I>Click Here to Activate</I></span> link.<br><br>The page refreshes, indicating a status of <span style="font-style : italic; "><I>ACTIVE</I></span> for the Flex Web Service, and lets you generate a token, which you will need to initiate Flex requests and retrieve Flex reports.</p>
</li>
<p class="BodyIndent"></p>
<div align="center"><img id="16" src="flexwebservicedelivery.jpg" class="img_whs3">
</div>
<p class="BodyIndent"> </p>
<li class="whs1">
<p class="Numbered">Generate a new token:</p>
</li>
</ol>
<ol start="1">
<li class="whs4">
<p class="NumberedSubFirst">In the Should Expire After list, select the amount of time before the token expires. The token is valid for a 6 hour period by default.</p>
</li>
<li class="whs4">
<p class="NumberedSub">In the Valid For IP Address field, enter an IP address to restrict the token to that IP address. If you leave this field blank, there will be no IP address restrictions.</p>
</li>
<li class="whs4">
<p class="NumberedSub">Click <span style="font-weight : bold; "><B>Generate New Token (Invalidate Current Token)</B></span>. <br><br>The page refreshes, updating the Current Token Details section with information about your newly-generated token. When you generate a new token, you invalidate the current token.</p>
</li>
<li class="whs1">
<p class="Numbered">Initiate an automated Flex Web Service request: </p>
</li>
</ol>
<ol start="1">
<li class="whs4">
<p class="NumberedSubFirst">Make sure you have the following information:<br><br>Your current token (displayed in the Current Token Details section of the page)<br>The Flex Query ID generated when you created the Flex query.</p>
</li>
<li class="whs4">
<p class="NumberedSub">Type the following URL in your browser’s Address field:<br><br><span style="font-weight : bold; "><B>https://www.interactivebrokers.com/Universal/servlet/FlexStatementService.SendRequest?t=<TOKEN>&q=<QUERY_ID><br><br></B></span>Where <TOKEN> is your current token and <QUERY_ID> is the Flex Query ID.</p>
</li>
<p class="FM_NumberedSubIndent">You will receive an XML response from IB containing the following information:</p>
<p class="FM_NumberedSubIndent"><span style="font-style : italic; "><I>Reference Code</I></span> - If the request was successful, the XML response will contain a numeric reference code. This code will be used to retrieve the generated Flex query. If the request was unsuccessful you will get back “INVALID REQUEST” (without the quoted) as the code.</p>
<p class="FM_NumberedSubIndent"><span style="font-style : italic; "><I>Response URL</I></span> - This is the URL to be used to retrieve the Flex report.</p>
<p class="FM_NumberedSubIndent">Here is a sample XML response:</p>
<div align="center"><img id="17" src="samplexmlresponse.jpg" class="img_whs5">
</div>
<p class="FM_NumberedSubIndent"></p>
<li class="whs1">
<p class="Numbered">Retrieve the Flex data:</p>
</li>
</ol>
<ol start="1">
<li class="whs4">
<p class="NumberedSubFirst">Be sure that you have your current token number, and the reference code you received as part of the response to your initial request.</p>
</li>
<li class="whs4">
<p class="NumberedSub">Type the following URL in your browser’s Address field:<br><br><span style="font-weight : bold; "><B>https://www.interactivebrokers.com/Universal/servlet/FlexStatement<br>Service.GetStatement?q=<REFERENCE_CODE>&t=<TOKEN>&v=<br><SERVICE_VERSION><br></B></span><br>Where:<br><REFERENCE_CODE> is the code you received as part of the response when you placed the request<br><TOKEN> is your current token and <br><SERVICE_VERSION> is set to <span style="font-weight : bold; "><B>2</B></span> for activity Flex or trade confirmation Flex, or <span style="font-weight : bold; "><B>1</B></span> or left blank for legacy Flex.</p>
</li>
</ol>
<p class="BodyIndent">You will receive the Flex data as the response if the request was successful. Otherwise, you will receive a XML based response informing you that the request was invalid.</p>
<p class="Body" style="font-weight : bold; letter-spacing : 0.00em;"><span class="FM_Bold">For more information...</span></p>
<ul>
<li>
<p class="Bullet"><span class="FM_Hyperlink"><a href="http://www.interactivebrokers.com/en/accounts/statements.php?p=f&ib_entity=llc">Statements and Reports - FlexTool</a></span></p>
</li>
<li>
<p class="Bullet"><span class="FM_Hyperlink"><a href="#XREF_87104_Using_the_Flex_Web">Using the Flex Web Service</a></span></p>
</li>
</ul>
<script type="text/javascript" language="javascript1.2">
<!--
highlightSearch();
if (window.writeIntopicBar)
        writeIntopicBar(0);
if(0)
{
document.write("<p style=\"font-family: Verdana; font-size: 10pt; font-weight: 400; font-style:normal; color: rgb(0, 0, 255); text-decoration:none; text-align: right; background: #ffff99\"> ");
AddMasterBreadcrumbs("../../accountmanagement.htm", "font-family: Verdana; font-size: 10pt; font-weight: 400; font-style:normal; color: rgb(0, 0, 255); text-decoration:none; text-align: right; background: #ffff99", ">", "Home", "../../home.htm");
document.write("<a style=\"font-family: Verdana; font-size: 10pt; font-weight: 400; font-style:normal; color: rgb(0, 0, 255); text-decoration:none; text-align: right; background: #ffff99\" href=\"report_management.htm\">Report Management</a> > <a style=\"font-family: Verdana; font-size: 10pt; font-weight: 400; font-style:normal; color: rgb(0, 0, 255); text-decoration:none; text-align: right; background: #ffff99\" href=\"delivery_settings.htm\">Delivery Settings</a> > Using the Flex Web Service</p>");
}
//-->
</script>
</body>
</html>