πŸ“˜ ITCPR API Documentation

Welcome to the official ITCPR API documentation. This API powers various internal and external services including LaTeX document generation, GitHub integration, Discord automation, ZeroTier management, email utilities, WSL command syncing, and server operations.


πŸ”— Base URL

All endpoints are available under:

https://api.itcpr.org

All requests and responses are in JSON format unless otherwise noted.


πŸš€ Quickstart


πŸ“‚ Endpoints

πŸ“„ LaTeX Services

POST /latex/compile

Description:
Compile LaTeX documents, including support for BibTeX and embedded figures (as base64).

Payload:

{
  "content": "<LaTeX code>",
  "bibliography": "<optional .bib content>",
  "figures": [
    {
      "name": "fig1.png",
      "data": "data:image/png;base64,..."
    }
  ]
}

Response: Returns a compiled PDF document as binary.


πŸ’¬ Discord Bot Integration

POST /discord/message

Send a plain text message to a specific Discord channel.

{
  "channelId": "DISCORD_CHANNEL_ID",
  "message": "Hello from ITCPR API"
}

POST /discord/add_user

Add a user to the guild (server) using OAuth2 access_token.

{
  "userId": "DISCORD_USER_ID",
  "accessToken": "OAUTH_ACCESS_TOKEN"
}

POST /discord/assign_role

Assign an existing role to a user within a guild.

{
  "userId": "DISCORD_USER_ID",
  "roleId": "DISCORD_ROLE_ID"
}

πŸ“§ Email Delivery

POST /email/unigurubd

Send emails via UniGuruBD SMTP credentials.

POST /email/itcpr

Send emails via ITCPR’s dedicated SMTP gateway.

Shared Payload:

{
  "to": "recipient@example.com",
  "subject": "Hello from ITCPR",
  "message": "<p>This is an HTML or plain text email body</p>"
}

🌐 ZeroTier Network Access

POST /zerotier/authenticate

Authorize a device in the ZeroTier network.

{
  "member_id": "ZT_MEMBER_ID",
  "ip": "192.168.195.10"
}

POST /zerotier/deauthenticate

Remove a member from the ZeroTier network.

{
  "member_id": "ZT_MEMBER_ID"
}

πŸ“ GitHub File Services

GET /github/get_files?path=...

List files in a specified GitHub repository path.

POST /github/upload_file?path=...

Upload a file to a GitHub repository.

Form Data:
- file: file input
- path: destination folder under /files/

POST /github/webhook

Trigger a Discord message when someone pushes to the repo.


🐧 WSL Command Sync

POST /wsl/upload

Upload a .txt file to WSL for logging or syncing purposes.

GET /wsl/download

Download the current log file stored on WSL.


πŸ“Š Server Operations

POST /server/webhook

Update internal server metrics via a JSON POST.

GET /server/stats

Retrieve latest saved system stats.

POST /server/access

Upload access_codes.json to the server.

POST /server/download

Download a specific file (e.g., access_codes.json) from the server.


πŸ“¦ Headers & Content-Type

All endpoints (unless file upload) expect:

Content-Type: application/json

Use appropriate headers for file uploads via multipart/form-data.


πŸ§ͺ Example Request (cURL)

curl -X POST https://api.itcpr.org/email/itcpr \
  -H "Content-Type: application/json" \
  -d '{
    "to": "you@example.com",
    "subject": "Welcome!",
    "message": "Hello from ITCPR API."
  }'

πŸ§‘β€πŸ’» Developer Notes


πŸ“ž Support


βš–οΈ License & Acknowledgement

This service is part of the ITCPR nonprofit platform and intended for internal and collaborative use.
All rights reserved Β© 2025 ITCPR.