Overview
Code Detection API automatically identifies programming languages and detects code blocks within plain text or mixed content. It is useful for tools that process user-submitted text and need to highlight or categorize code snippets. Developers can use it to enrich data pipelines or build smarter editors.
Beginner Tip
Use OAuth 2.0 client credentials flow to obtain a Bearer token before calling any endpoint — the token is passed in the Authorization header on every request.
Available Data
Example Response
{
"status": "success",
"data": {
"result": "Data from Code Detection API",
"description": "Detect, label, format and enrich the code in your app or in your data pipeline",
"timestamp": "2025-01-15T10:00:00Z"
}
} Field Reference
language The detected programming language name (e.g., "Python", "JavaScript") confidence Confidence score between 0 and 1 indicating how certain the detection is code_blocks List of extracted code block objects found within the submitted text formatted_code The detected code reformatted with consistent indentation and style Implementation Example
const url = "https://codedetectionapi.runtime.dev/";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
headers: {
"Authorization": "Bearer YOUR_API_KEY"
}
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data); What Can You Build?
Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.
Common Errors & Troubleshooting
Matrix Score Breakdown
Partially tested on Apr 5, 2026
Technical Specifications
Related Tags
Similar APIs
View All →apilayer languagelayer
apilayer languagelayer is a language detection API that identifies the language of any text across 173 supported languages.
Semantria
Semantria is a powerful text analytics API by Lexalytics that provides sentiment analysis, entity extraction, and content categorization.
Tisane
Tisane is a text analytics API specialized in detecting abusive content, hate speech, and cybercrime in user-generated text.
Watson Natural Language Understanding
IBM Watson Natural Language Understanding (NLU) is a powerful AI-driven API that extracts semantic meaning from text, including sentiment, entities, keywords, categories, and emotion.
Aylien Text Analysis
Aylien Text Analysis provides programmatic access to a collection of information retrieval and natural language apis via REST API.