{"uid":"cap_2z6v44QMg0ZKXq4Nv346E","slug":"judge0-execute-code-bc68dfe4","name":"Judge0 Execute Code","description":"Submit source code for synchronous execution. Returns stdout, stderr, compile output, execution time, and memory usage.","url":"https://judge0.mpp.paywithlocus.com/judge0/execute-code?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","required":["source_code","language_id"],"properties":{"stdin":{"type":"string","description":"Standard input for the program"},"language_id":{"type":"integer","description":"Language ID (e.g., 71 for Python 3, 63 for JavaScript, 54 for C++, 62 for Java). Use list-languages to find IDs."},"source_code":{"type":"string","description":"Program source code to execute"},"stack_limit":{"type":"number","description":"Stack size limit in kilobytes"},"memory_limit":{"type":"number","description":"Memory limit in kilobytes"},"cpu_time_limit":{"type":"number","description":"CPU time limit in seconds (default: instance-dependent)"},"enable_network":{"type":"boolean","description":"Allow network access inside the sandbox"},"expected_output":{"type":"string","description":"Expected output — if provided, status will indicate whether output matches"},"wall_time_limit":{"type":"number","description":"Wall clock time limit in seconds"},"compiler_options":{"type":"string","description":"Compiler flags (max 512 chars, e.g., \"-O2 -Wall\")"},"command_line_arguments":{"type":"string","description":"Command-line arguments passed to the program (max 512 chars)"},"redirect_stderr_to_stdout":{"type":"boolean","description":"Redirect stderr to stdout in the output"}},"additionalProperties":true},"responseSchema":null,"example":{"request":{"stdin":"","language_id":"71","source_code":"print('Hello, World!')\nprint('Testing code execution')\nresult = 2 + 2\nprint(f'2 + 2 = {result}')","expected_output":"Hello, World!\nTesting code execution\n2 + 2 = 4"},"response":{"data":{"time":"0.011","token":"f0f93a77-2cfb-48f5-8310-623f95f37768","memory":3212,"status":{"id":3,"description":"Accepted"},"stderr":null,"stdout":"Hello, World!\nTesting code execution\n2 + 2 = 4\n","message":null,"compile_output":null},"success":true}},"exampleRequest":{"stdin":"","language_id":"71","source_code":"print('Hello, World!')\nprint('Testing code execution')\nresult = 2 + 2\nprint(f'2 + 2 = {result}')","expected_output":"Hello, World!\nTesting code execution\n2 + 2 = 4"},"tags":["code-execution","sandbox","programming-languages","compute"],"displayCostAmount":"0.006","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"settled","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.006/call","primary":{"kind":"static","protocol":"mpp","network":"tempo","amountUsd":"0.006","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"mpp","network":"tempo","amountUsd":"0.006","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_nrKNPGW10UfH-A4c92EA1","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.006","costPer":"request","priority":0,"asset":"0x20c000000000000000000000b9537d11c60e8b50","unit":"request","depositMicros":null,"planRef":null}],"brandName":"Judge0","brandSlug":"judge0","brandBaseUrl":"https://judge0.com","brandDocsUrl":"https://ce.judge0.com","whatItDoes":"Synchronously executes source code in a sandboxed environment across 60+ programming languages and returns stdout, stderr, status, and runtime metrics.","exampleAgentPrompt":"Run this Python 3 code for me in a sandbox and tell me what it prints: 'nums = [1,2,3]; print(sum(nums))' — use language ID 71 and pass '5' as stdin.","exampleUseCases":null,"resultDescription":"Returns a JSON object with stdout (program output), stderr (error stream), compile_output (compiler messages), execution status (e.g. Accepted, Time Limit Exceeded, Runtime Error), wall time in seconds, memory usage in KB, and a submission token for reference.","failureModes":["Unsupported language_id returns an error or empty result","Time Limit Exceeded when cpu_time_limit is too low for the program","Runtime Error when the program crashes or throws an unhandled exception","Compilation Error when source_code has syntax errors, returned in compile_output","Memory Limit Exceeded when program exceeds memory_limit","Wrong Answer status when expected_output is provided but output does not match","Empty stdout when program produces no output or writes only to stderr"],"whenToPreferThis":"Use this endpoint when you need immediate, synchronous code execution results without polling — ideal for short-lived scripts, quick evaluations, or automated test checking. Prefer this over the async Submit Code endpoint when you want the result in a single request. Choose Judge0 when you need broad language support (60+ languages) with configurable resource limits and optional expected output matching.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-10T00:42:00.171Z","isFirstParty":false,"canonicalSlug":"judge0-execute-code-bc68dfe4"}