Back to Tool
💻
Code Snippet Share API
Create shareable code snippets with syntax highlighting via API
Endpoint
POST
/api/v1/code-snippet-shareAuthentication
Include your API key in the request header:
X-API-Key: your_api_key_hereGet your API key from the Dashboard
Request Body
Content-Type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | Code content to share (max 100,000 characters) |
| language | string | Yes | Programming language (javascript, python, java, etc.) |
| title | string | No | Title for the snippet (max 100 characters) |
| expiry | string | No | Expiry time: "1h", "24h", "7d", "30d", "never" (default: "24h") |
Response
| Field | Type | Description |
|---|---|---|
| success | boolean | Whether the operation was successful |
| id | string | Unique share ID |
| url | string | Relative URL to the share |
| fullUrl | string | Full URL to the share |
| language | string | Detected/specified programming language |
| expiresAt | string | ISO timestamp when the share expires (null if never) |
Code Examples
curl -X POST https://tools.shubhambadgujar.com/api/v1/code-snippet-share \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"code": "function hello() {\n console.log("Hello World");\n}",
"language": "javascript",
"title": "Hello World Example",
"expiry": "7d"
}'Rate Limits
- • 100 requests per minute
- • 10,000 requests per day
- • Max request size: 10MB
Need Help?
Contact us at support@shubhambadgujar.com