Futures Expiration API
getFuturesExpirations
The getFuturesExpiration API from Barchart OnDemand provides first notice and last trade dates for futures contracts. Contract, exchange, expiration date, first notice date, last trading day and symbol are provided.
View All APIsContact Us to Get Access
Inputs
rootsoptional
A symbol or code that identifies a futures root.
Type
list (A comma or semi-colon delimited string.)
Example
ZC,ZS
contractsoptional
A symbol or code that identifies a futures contract.
Type
list (A comma or semi-colon delimited string.)
Example
ZCN25,ZCU69
fieldsoptional
The fields requested.
Type
list (A comma or semi-colon delimited string.)
Example
lastTradingDay
Outputs
symbol
always returned
always returned
A symbol or code that identifies the futures contract.
string
A sequence of characters. (example: GOOG)
A sequence of characters. (example: GOOG)
exchange
always returned
always returned
The name of the exchange the instrument belongs to.
string
A sequence of characters. (example: GOOG)
A sequence of characters. (example: GOOG)
contract
always returned
always returned
The expiration month and year of the futures contract.
string
A sequence of characters. (example: GOOG)
A sequence of characters. (example: GOOG)
firstNoticeDate
always returned
always returned
The first notice date of the futures contract.
date
A date in the format of YYYY-MM-DD.
A date in the format of YYYY-MM-DD.
expirationDate
always returned
always returned
The expiration date.
date
A date in the format of YYYY-MM-DD.
A date in the format of YYYY-MM-DD.
lastTradingDay
as requested
as requested
The last trade day of the futures contract.
string
A sequence of characters. (example: GOOG)
A sequence of characters. (example: GOOG)
Status Code Responses
200
OK
Success
400
Bad Request
The request was invalid, please see the message for more information.
500
Internal Server Error
Something is not working correctly, please contact support.
JSON
GET
GET https://ondemand.websol.barchart.com/getFuturesExpirations.json?apikey=YOUR_API_KEY&roots=ZC%2CZS&contracts=ZCN25%2CZCU69&fields=lastTradingDay
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getFuturesExpirations.json
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&roots=ZC%2CZS&contracts=ZCN25%2CZCU69&fields=lastTradingDay
Response
{
"status": {
"code": 200,
"message": "Success."
},
"results": [
{
"symbol": "ZCN25",
"exchange": "CBOT",
"contract": "Jul 25",
"firstNoticeDate": "2025-06-30",
"expirationDate": "2025-07-14",
"lastTradingDay": "The business day prior to the 15th calendar day of the contract month"
}
]
}
XML
GET
GET https://ondemand.websol.barchart.com/getFuturesExpirations.xml?apikey=YOUR_API_KEY&roots=ZC%2CZS&contracts=ZCN25%2CZCU69&fields=lastTradingDay
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getFuturesExpirations.xml
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&roots=ZC%2CZS&contracts=ZCN25%2CZCU69&fields=lastTradingDay
Response
<?xml version="1.0" encoding="utf-8"?>
<getFuturesExpirations>
<status>
<code>200</code>
<message>Success.</message>
</status>
<item>
<symbol>ZCN25</symbol>
<exchange>CBOT</exchange>
<contract>Jul 25</contract>
<firstNoticeDate>2025-06-30</firstNoticeDate>
<expirationDate>2025-07-14</expirationDate>
<lastTradingDay>The business day prior to the 15th calendar day of the contract month</lastTradingDay>
</item>
</getFuturesExpirations>
CSV
GET
GET https://ondemand.websol.barchart.com/getFuturesExpirations.csv?apikey=YOUR_API_KEY&roots=ZC%2CZS&contracts=ZCN25%2CZCU69&fields=lastTradingDay
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getFuturesExpirations.csv
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&roots=ZC%2CZS&contracts=ZCN25%2CZCU69&fields=lastTradingDay
Response
symbol,exchange,contract,firstNoticeDate,expirationDate,lastTradingDay
"ZCN25","CBOT","Jul 25","2025-06-30","2025-07-14","The business day prior to the 15th calendar day of the contract month"
PHP
<?php
$ondemand = new SoapClient('https://ondemand.websol.barchart.com/service?wsdl');
$params = [
'apikey' => 'YOUR_API_KEY',
'roots' => 'ZC,ZS',
'contracts' => 'ZCN25,ZCU69',
'fields' => 'lastTradingDay',
];
$result = $ondemand->getFuturesExpirations($params);
var_dump($result);
Classic ASP
Dim ondemand
Dim result
Set ondemand = Server.CreateObject("MSSOAP.SoapClient30")
ondemand.ClientProperty("ServerHTTPRequest") = True
ondemand.MSSoapInit("https://ondemand.websol.barchart.com/service?wsdl")
Set result = ondemand.getFuturesExpirations("YOUR_API_KEY", "ZC,ZS", "ZCN25,ZCU69", "lastTradingDay")
Perl
use SOAP::Lite;
use SOAP::WSDL;
my $ondemand = SOAP::Lite
-> service('https://ondemand.websol.barchart.com/service?wsdl');
my $result = $ondemand->getFuturesExpirations('YOUR_API_KEY', 'ZC,ZS', 'ZCN25,ZCU69', 'lastTradingDay');
print $result;
Python
from suds.client import Client
ondemand = Client('https://ondemand.websol.barchart.com/service?wsdl')
result = ondemand.service.getFuturesExpirations('YOUR_API_KEY', 'ZC,ZS', 'ZCN25,ZCU69', 'lastTradingDay')
print(result)
Ruby
require 'savon'
ondemand = Savon.client(wsdl: 'https://ondemand.websol.barchart.com/service?wsdl')
response = ondemand.call(
:getFuturesExpirations,
message: {
apikey: 'YOUR_API_KEY',
roots: 'ZC,ZS',
contracts: 'ZCN25,ZCU69',
fields: 'lastTradingDay',
}
)
response.body