---
title: "Code as an image"
method: GET
path: "/v1/code-image"
tags: ["Generated images"]
---

# Code as an image

`GET /v1/code-image`

## Request

- Base URL: `https://api.dharun.dev`
- URL: `https://api.dharun.dev/v1/code-image`
- Auth: none declared

A code snippet as a window with syntax colouring. Up to 150 lines of 140 characters. PNGs are drawn at twice the pixel density for sharp text (very large ones at single). The language is guessed from the title's file extension or the code when not given, and reported in the X-Code-Language header.

## Query parameters

- `code` string
- `language` string
- `title` string
- `theme` 'dark' | 'light'
- `lineNumbers` 'true'
- `format` 'png' | 'svg'

## Response `200`

Success

## Other responses

- `400`: Error
- `404`: Error
- `429`: Error

---

[API](https://skmtc.dev/dharun/apis/india-api-free-open-source-apis-for-indian-data.md) · [All operations](https://skmtc.dev/dharun/apis/india-api-free-open-source-apis-for-indian-data/llms.txt) · [OpenAPI document](https://skmtc.dev/dharun/apis/india-api-free-open-source-apis-for-indian-data/revisions/ecd8b0ec7863?raw)
