API Documentation

Simple API for creating snippets and short links

Base URL

https://2-app.cc/api/v1

Authentication

All endpoints require Bearer token authentication.

Authorization: Bearer YOUR_API_SECRET_TOKEN

Endpoints

POST /api/v1/snippets

Create a new code snippet

curl -X POST https://2-app.cc/api/v1/snippets \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "My Snippet",
    "items": [{
      "language": "javascript",
      "label": "app.js",
      "content": "const x = 1;",
      "order": 0,
      "parseMarkdown": true
    }]
  }'
POST /api/v1/links

Create a short link with optional expiration

Markdown Parsing

Enable parseMarkdown: true to automatically convert markdown to plain text.

• Headers (#), lists (-), bold (**) → plain text

• Code blocks (```) → extracted code only

• Links, tables → removed

Rate Limits

Per minute 60
Per hour 1,000
Per day 10,000

Error Codes

400 - Bad Request
401 - Unauthorized
429 - Too Many Requests
500 - Internal Server Error