The Password Pusher JSON API is a RESTful API that allows developers to interact with the Password Pusher service programmatically. The API provides a simple and intuitive way to manage, create and expire pushes making it easy to integrate with your existing applications and workflows.

API Endpoints

The main endpoint for JSON requests is:

  • /p.json: manages text based pushes

Note: Previous endpoints /f.json and /r.json still work but have been merged into the /p.json endpoint for simplicity. Please use /p.json for all new API calls going forward.

API Parameters

The Password Pusher JSON API uses standard HTTP parameters, such as Authorization: Bearer <token> headers and query parameters, to pass data between the client and server.

API Responses

The Password Pusher JSON API returns data in JSON format, with each response containing a status field indicating the success or failure of the request.

Self-Hosted

If you are running your own private instance of Password Pusher, these API calls are available on your instance too.

Just point these calls to your own instance. by changing

https://pwpush.com

to where you host your private instance such as

https://pwpush.mycompany.org

Getting Started

To get started with the Password Pusher JSON API, simply visit the API documentation at https://pwpush.com/api. From there, you can explore the available endpoints, methods, and parameters, and start building your own applications using the Password Pusher JSON API.

Example

Curl

To create an anonymous push:

curl -X POST
  --data "password[payload]=mypassword&password[expire_after_days]=2&password[expire_after_views]=10"
  https://pwpush.com/p.json

To retrieve a push:

curl -X GET https://pwpush.com/p/<ID>.json

To expire a push:

curl -X DELETE https://pwpush.com/p/<ID>.json

Javascript

Pushes can be created using Javascript as well.

To try it out, go to pwpush.com and paste this into your browser console:

fetch(
  "https://pwpush.com/p.json", {
    method: "POST",
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      password: {
        payload: "mypassword",
        expire_after_days: 2,
        expire_after_views: 10
      }
    })
  })
  .then(response => response.json())
  .then(data => { console.log("Share this secret URL: https://pwpush.com/p/" + data.url_token); });

Swift

See this issue where @broadwaycodez provides a Swift example for accessing the JSON API.

Premium & Pro Users

To create a push using your API token, create and/or retrieve your API token from here and then you can make requests such as:

curl -X POST
    -H "Authorization: Bearer <YOUR-API-TOKEN>"
    -H "Accept: application/json"
    -F "password[payload]=my_secure_payload"
    -F "password[note]=For New Employee ID 12345" https://pwpush.com/p.json

Note: For Premium & Pro accounts, pushes created with the JSON API will also contain the branding configured for your account.

Pro Users: Push creation will respond with your custom domains (if configured):

curl -X POST
    -H "Authorization: Bearer <YOUR-API-TOKEN>"
    -H "Accept: application/json"
    -F "password[payload]=my_secure_payload"
    -F "password[note]=For New Employee ID 12345" https://pwpush.com/p.json

will return:

{
   "account_id":1,
   "expire_after_duration":8,
   "expire_after_views":5,
   "url_token":"wbjm73kig9kv4gbe_q",
   ..snipped...
   "html_url":"https://pwp.mycompany.com/p/wbjm73kig9kv4gbe_q/r",
   "note":"For New Employee ID 12345"
}

Multiple Accounts

pwpush.com allows a single login to have multiple accounts. When making API calls, it’s possible to specify which account you would like to make the request against.

Tip: If you have multiple accounts, it’s suggested that you also specify an account ID in your API requests.

To do this, first get the list of accounts for for your API token:

curl https://pwpush.com/api/v1/accounts
    -H "Accept: application/json"
    -H "Authorization: Bearer YOURAPITOKEN"

which will return details for each of your accounts:

[
   {
      "id":12992, # <------ The Account ID for "MyCompany"
      "name":"MyCompany",
      "account_users":[
         {
            "id":1,
            "user_id":4
         },
         {
            "id":23098,
            "user_id":23712
         }
      ]
   },
   {
      "id":22923, # <------ The Account ID for "Law Frim"
      "name":"Law Frim",
      "account_users":[
         {
            "id":22913,
            "user_id":4
         }
      ]
   }
]

Then when making an API request, you can specify the account ID using the account_id parameter:

curl -X POST
    -H "Authorization: Bearer YOURAPITOKEN"
    -H "Accept: application/json"
    -F "password[payload]=my_secure_payload"
    -F "password[note]=JSON API created push"
    -F "account_id=22923"  <----- Specify the account ID here
    https://pwpush.com/p.json

Full JSON API Documentation

For full documentation on the Password Pusher JSON API, including detailed endpoint descriptions, method parameters, and response formats, please visit the API documentation at https://pwpush.com/api.

See Also

Updated: