PasteJustit.com API Documentation

Introduction

The PasteJustit.com API allows developers to create, retrieve, update, and delete text and code snippets (pastes) programmatically. It provides an easy and flexible way to integrate snippet sharing into your applications. You can customize paste visibility and manage pastes with ease.

Base URL

https://pastejustit.com/api

Authentication

No authentication is required for public pastes. However, an API key is required to manage or create private pastes.

API Key Authentication

Include the following header in all authenticated requests:

x-api-key: your_api_key_here

You can generate an API key in your PasteJustit.com account dashboard.

Endpoints

1. Create a Paste

Create a new paste with options for public, unlisted, or private visibility.

Endpoint:

POST https://pastejustit.com/api/paste

Request Body:

Parameter Type Description
title string (Optional) Title of the paste
content string The text or code snippet content
visibility string public, unlisted, or private
expires_in string (Optional) Expiration time in minutes

Example Request:

{
  "title": "Sample Paste",
  "content": "console.log('Hello World!');",
  "visibility": "public",
  "expires_in": "1440"
}

Response:

{
  "id": "abc123",
  "url": "https://pastejustit.com/abc123",
  "created_at": "2024-10-19T12:34:56Z",
  "expires_in": "1440",
  "visibility": "public"
}

2. Get a Paste

Retrieve a paste by its unique ID.

Endpoint:

GET https://pastejustit.com/api/paste/{paste_id}

Example Request:

GET https://pastejustit.com/api/paste/abc123

Response:

{
  "id": "abc123",
  "title": "Sample Paste",
  "content": "console.log('Hello World!');",
  "visibility": "public",
  "created_at": "2024-10-19T12:34:56Z",
  "expires_in": "1440"
}

3. Delete a Paste

Delete a specific paste using its ID. This action requires authentication.

Endpoint:

DELETE https://pastejustit.com/api/paste/{paste_id}

Example Request:

DELETE https://pastejustit.com/api/paste/abc123

Response:

{
  "message": "Paste successfully deleted."
}

4. List Pastes (User)

Retrieve a list of all pastes created by the authenticated user.

Endpoint:

GET https://pastejustit.com/api/pastes

Example Request:

GET https://pastejustit.com/api/pastes

Response:

[
  {
    "id": "abc123",
    "title": "Sample Paste 1",
    "url": "https://pastejustit.com/abc123",
    "visibility": "public",
    "created_at": "2024-10-19T12:34:56Z"
  },
  {
    "id": "def456",
    "title": "Sample Paste 2",
    "url": "https://pastejustit.com/def456",
    "visibility": "private",
    "created_at": "2024-10-18T10:20:30Z"
  }
]

5. Update a Paste

Update an existing paste by its ID. Requires authentication.

Endpoint:

PUT https://pastejustit.com/api/paste/{paste_id}

Request Body:

Parameter Type Description
title string (Optional) New title of the paste
content string New text or code snippet content
visibility string public, unlisted, or private
expires_in string (Optional) New expiration time in minutes

Example Request:

{
  "title": "Updated Sample Paste",
  "content": "console.log('Updated Hello World!');",
  "visibility": "unlisted",
  "expires_in": "2880"
}

Response:

{
  "id": "abc123",
  "url": "https://pastejustit.com/abc123",
  "updated_at": "2024-10-19T13:45:23Z"
}

6. Search Public Pastes

Search through public pastes using keywords or filter by programming language.

Endpoint:

GET https://pastejustit.com/api/search

Query Parameters:

Parameter Type Description
query string The search term (required)
language string Filter results by programming language (optional)

Example Request:

GET https://pastejustit.com/api/search?query=console&language=javascript

Response:

[
  {
    "id": "ghi789",
    "title": "Console Example",
    "content": "console.log('Example');",
    "language": "javascript",
    "url": "https://pastejustit.com/ghi789"
  }
]

7. Retrieve API Rate Limits

Check the current rate limits for your API key to prevent exceeding the quota.

Endpoint:

GET https://pastejustit.com/api/rate_limit

Example Request:

GET https://pastejustit.com/api/rate_limit

Response:

{
  "rate_limit": 200,
  "rate_limit_remaining": 150,
  "rate_limit_reset": "2024-10-19T12:00:00Z"
}

Error Handling

The API will return standard HTTP status codes for errors:

Example Error Response:

{
  "error": "Paste not found",
  "status": 404
}

Rate Limits

The PasteJustit.com API imposes rate limits to prevent abuse:

Rate limits reset every hour. If you exceed the limit, you will receive a 429 Too Many Requests response.

Conclusion

With the PasteJustit.com API, you can seamlessly integrate snippet-sharing capabilities into your applications. Manage pastes programmatically with ease and enjoy features like customizable visibility, syntax highlighting, and more!