Skip to main content
POST
/
api
/
v1
/
code
/
execute
Execute code against test cases
curl --request POST \
  --url https://www.intervyo.ai/api/v1/code/execute \
  --header 'Content-Type: application/json' \
  --data '
{
  "code": "<string>",
  "language": "<string>",
  "functionName": "<string>",
  "testCases": [
    {}
  ],
  "functionNames": {},
  "pythonFunctionName": "<string>",
  "jsFunctionName": "<string>"
}
'
import requests

url = "https://www.intervyo.ai/api/v1/code/execute"

payload = {
"code": "<string>",
"language": "<string>",
"functionName": "<string>",
"testCases": [{}],
"functionNames": {},
"pythonFunctionName": "<string>",
"jsFunctionName": "<string>"
}
headers = {"Content-Type": "application/json"}

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

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
code: '<string>',
language: '<string>',
functionName: '<string>',
testCases: [{}],
functionNames: {},
pythonFunctionName: '<string>',
jsFunctionName: '<string>'
})
};

fetch('https://www.intervyo.ai/api/v1/code/execute', 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://www.intervyo.ai/api/v1/code/execute",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'code' => '<string>',
'language' => '<string>',
'functionName' => '<string>',
'testCases' => [
[

]
],
'functionNames' => [

],
'pythonFunctionName' => '<string>',
'jsFunctionName' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

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

curl_close($curl);

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

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

func main() {

url := "https://www.intervyo.ai/api/v1/code/execute"

payload := strings.NewReader("{\n \"code\": \"<string>\",\n \"language\": \"<string>\",\n \"functionName\": \"<string>\",\n \"testCases\": [\n {}\n ],\n \"functionNames\": {},\n \"pythonFunctionName\": \"<string>\",\n \"jsFunctionName\": \"<string>\"\n}")

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

req.Header.Add("Content-Type", "application/json")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://www.intervyo.ai/api/v1/code/execute")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"<string>\",\n \"language\": \"<string>\",\n \"functionName\": \"<string>\",\n \"testCases\": [\n {}\n ],\n \"functionNames\": {},\n \"pythonFunctionName\": \"<string>\",\n \"jsFunctionName\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://www.intervyo.ai/api/v1/code/execute")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"<string>\",\n \"language\": \"<string>\",\n \"functionName\": \"<string>\",\n \"testCases\": [\n {}\n ],\n \"functionNames\": {},\n \"pythonFunctionName\": \"<string>\",\n \"jsFunctionName\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "results": [
    {
      "input": {
        "nums": [
          2,
          7,
          11,
          15
        ],
        "target": 9
      },
      "expected": [
        0,
        1
      ],
      "actual": [
        0,
        1
      ],
      "passed": true,
      "runtime": "412ms"
    }
  ]
}
{
"error": "<string>",
"issues": [
{}
]
}
{
"error": "<string>",
"issues": [
{}
]
}
{
"error": "<string>",
"issues": [
{}
]
}
{
"error": "<string>",
"issues": [
{}
]
}

Body

application/json
code
string
required

Full source code to run.

language
string
required

python | javascript | typescript (others return 422).

functionName
string
required

Canonical snake_case identifier — used if extraction from source fails.

testCases
object[]
required

Each item: { args: {...}, expected: any }. At least one required.

functionNames
object

Per-language map, e.g. { python: "two_sum", javascript: "twoSum" }.

pythonFunctionName
string

Legacy scalar fallback for python.

jsFunctionName
string

Legacy scalar fallback for javascript / typescript.

Response

Success

The response is of type object.

Last modified on July 10, 2026