Getting started with the subset sum web API

To use the subset sum web API, you'll first need to get an API key. You can request an API key on our website here:

There are two parts to using the web API. First, you will post your problem to the API, then if that is successful, you will query for the result.

To post your problem to be solved, simply issue an HTTP post to The payload of that post is your input sum as a string in standard sum format using surrounding brackets and commas between entries. For example, your input sum might be "[1]" or "[42, 36]". You'll need to pass your API key in the header as the x-api-key.

Input Limitations: We currently support at least 1 and up to 120 positive integers in the input. The maximum integer supported is 2^31 - 1 and the total sum cannot exceed 17,180,000,000.

Here is an example of what posting a problem looks like. In this shell command, the API key is saved to the environment as IR_API_KEY

curl -s -X POST -H "x-api-key: $IR_API_KEY" -H "Content-Type: application/json" -d '[1, 3]'

Upon success, this will result return a json dictionary with an entry for "requestId". This requestId will be used to fetch the result. Here is an example of what that might look like:

{"requestId": "946e2544-b665-4cad-b87a-9a5c11c738d3"}

Now, you will fetch the result of that problem. To do this, you'll issue a get to Where is the request ID given when you posted the problem. You'll need to pass your API key in the header as the x-api-key.

Here is an example of fetching a result:

curl -v -s -o out.gz -L -X GET -H "x-api-key: $IR_API_KEY"

This will create the file 'out.gz'. This is a zipped binary object representing the result. You can unzip this using the following command:

gzip -d out.gz

Now, you have your resulting file. This is a binary encoding of all the possible subsets of the input sum.

In the binary encoding, Bit X of the byte at index Y is the answer for whether a subset of the input can sum to (8 *Y+X). So, if the result has one byte which is 0x5 (0b101), then we know that the possible sums are 0 and 2. In order to determine if there's a subset that sums to 131, we'd check bit 3 of byte 16, because (8*16 + 3) is 131.