Sign in New API Help About

The dpaste.com HTTP API (Version 2)

Per Terms of Service, automated requests should include a User-Agent header and should not exceed a rate of one request per second.

Creating an item

  • HTTP POST to https://dpaste.com/api/v2/
  • Fields: content, syntax, title, expiry_days
  • Required field: content
  • Syntax: one of the supported syntax choices, or omit for plain-text.
  • Authenticating will establish you as the owner of the created item.

Response contents

  • Response code on success will be HTTP 201 Created
  • Location header will be the created item's URL
  • Response body will also be the item's URL
  • Expires header will be the item's expiry date

Usage Examples

Getting details of a single item

  • HTTP GET https://dpaste.com/api/item_detail/<ITEM_ID>/ » Try it

Response contents

  • JSON object with item details
  • Example: {"ABCD23457": {"title": "ReST", "syntax": "rst", "expiry": "2024-12-04T13:09:06.332", "size": 238, "poster_id": 1}}

Getting links to a user's items

  • HTTP GET https://dpaste.com/api/user_items/<USER_ID>/ » Try it

Response contents

  • JSON array of item URLs
  • Example: {"User 1 public items": ["https://dpaste.com/ABCD23456"]}
  • Request for another user's items will return their public items only
  • Authenticated requests for your own items will return your public and private items both

Getting details of a user's items

  • HTTP GET https://dpaste.com/api/user_items_detail/<USER_ID>/ » Try it

Response contents

  • JSON object with a label and an array of item entries
  • Example: {"User 2 public items": [{"id": "2SMEV9JDB", "title": "Hello", "syntax": "md", "expiry": "2024-12-04T13:01:52.861", "size": 1348}]}
  • Request for another user's items will return their public items only
  • Authenticated requests for your own items will return your public and private items both

Authentication

Authenticate via the HTTP Authorization header using an API token.

To create your API token: On your dashboard, press the "Generate" button under "API token".

Example header: Authorization: Bearer a1b2c3d4e5f6g7h8

To deactivate (delete) the current token and create a new one, press "Regenerate".

More

  • Official CLI client: dpaste-cli (downloads)
  • The default API version is 2; https://dpaste.com/api/ functions as https://dpaste.com/api/v2/