Code Detector API

POST

Identify the programming language behind any code snippet.

Code Detector identifies the programming language of any submitted code snippet. It returns the canonical language name, readable title, and standard file extension for the detected code.

Try it — live request, no key required

Request
POSTapi.apiverve.com/v1/codedetector
Body
Verification
Format

No key required to try it. Get a key to use it in your app.

Example
{
  "status": "ok",
  "error": null,
  "data": {
    "likelihood": 0.99,
    "family": "PYTHON",
    "current": "python",
    "readable": "Python Code",
    "extension": ".py",
    "paradigm": "multi-paradigm",
    "isCompiled": false
  }
}

About the Code Detector API

Send a raw code snippet in a POST request. The service inspects the syntax to identify the language and returns its standard file extension and display name. Paid plans add detection confidence scores, language family, programming paradigms, and execution classification.

What people use it for

Syntax Highlighting Setup
Developer forums inspect unformatted user pastes to pick the right code fence tag before rendering highlighted code blocks.
File Download Naming
When users export generated snippets from a web interface, editors apply the returned extension to name and save files accurately.
Documentation Snippet Tagging
Knowledge base platforms assign language labels to community-submitted examples without forcing authors to pick options from a manual dropdown.
Support Ticket Routing
To triage incoming developer issues containing raw scripts or stack traces, ticketing systems route requests based on the detected language.

Ways to call it

One endpoint, many ways in — REST with JSON, XML, YAML and CSV, plus GraphQL and an MCP interface for AI agents.

JSON
Default REST response
XML
Markup format
YAML
Human-readable
CSV
Tabular export
Beta
GraphQL
Query language
New
MCP
For AI agents

Other ways to use Code Detector

Same data, same APIVerve account, same credit balance — one key works on all of them.

Questions.

Common questions about the Code Detector API.

Read the docs →
What information does the API return for a code snippet?
The API identifies the programming language in both machine-friendly lowercase and human-readable formats, alongside its standard file extension. Paid plans also return the language family, programming paradigm, compilation model, and a detection confidence score between 0.0 and 1.0.
Do I get confidence scores and language family details on the Free plan?
No. The Free plan returns the base language name and file extension. Premium fields—including the likelihood confidence score, language family, programming paradigm, and compiled status—are unlocked on every paid plan starting with Starter.
Can I use the output to configure syntax highlighters or save files?
Yes. Every detection returns a standard file extension and a lowercase language identifier. These can be passed directly into front-end syntax highlighters or used to name files when saving code submissions.
Does it classify languages by paradigm and execution model?
Yes, on paid plans. Code Detector categorizes the language by programming paradigm—such as object-oriented, functional, procedural, or multi-paradigm—and reports whether the language is compiled or interpreted.
Is it cheap enough to detect the language of every snippet users submit?
Yes. Each detection costs 20 credits, which works out to about $0.003 per call on the Starter plan, or $3.00 per 1,000 snippets. The Starter plan covers 10,000 snippet detections each month. The Free plan provides 10 calls per month for testing.

Ready to build with Code Detector? Start with 200 free credits — one key unlocks all 300+ APIs.

Explore the catalog

300+ APIs on the same key and the same response shape.

Browse all APIs