Instructions for using the API service

This API purpose is to automate QA tasks of the registration process and help to independent developers to create own apps and services that require temporary email functionality.

How it works:

  • Register on the service.
  • Generate email address by using our domain names.
  • Sign up on sites that require confirmation by mail.
  • The site sends email to the address you specify.
  • Message comes to our SMTP server, processed and added to the database.
  • You make a request to the API with md5 hash of mail address.
  • You get a list of emails.

Usage:

1. Creating a new mail with a life of 10 minutes

Call API with action parameter equal to new:

https://post-shift.ru/api.php?action=new
If the parameter name is not empty, the mail will be created with the given name, and will live 1 hour!

Example:

https://post-shift.ru/api.php?action=new&name=ghfdh5rhd4
The value of name must not exceed 10 characters! if you specify more, the parameter value will be truncated to 10 characters!

If we specify an additional parameter domain, we can choose the domain ourselves. You can transfer 2 values: "&domain=post-shift.ru" or "&domain=postshift.ru". If this parameter is not specified, the domain for mail will be selected randomly.

We receive a response from the server:

Email: pbrqvjxw90@post-shift.ru
Key: d6be5cce6245b61552cdc5201e0488b2
Reload

Where Reload is a link to get a new box.

If we specify an additional parameter type=json, the answer will return as JSON:

{"email":"bjlokwva72@post-shift.ru","key":"faf3f53538d0b5a52222ad7ef5040068"}

Where email is our address and key is the key needed for further access to the mailbox.


2. Getting a list of emails

Call API with action parameter equal to getlist and key key:

https://post-shift.ru/api.php?action=getlist&key=faf3f53538d0b5a52222ad7ef5040068

We receive a response from the server with a list of letters on the mailbox:

ID: 1
Date: Thu, 09 Mar 2017 11:06:11 +0300
Subject: Подтверждение регистрации в ICQ?
From: noreply@icq.com
___________

If we specify an additional parameter type=json, the answer will return as JSON:

[{"id":1,"date":"Thu, 09 Mar 2017 11:06:11 +0300","subject":" Подтверждение регистрации в ICQ?","from":"noreply@icq.com"}]

Where id - the number of our letters in the box, date - date of letter, subject - subject, from - address of the sender.

If we specify an additional parameter type=array, the answer will return as an Array! Available only when you receive a list of emails in your mailbox.


3. Receiving the text of the letter

Call API with parameter action equal to getmail, key key and letter number (id):

https://post-shift.ru/api.php?action=getmail&key=faf3f53538d0b5a52222ad7ef5040068&id=1

In response, we receive the text of the message, in the form in which it came.

If we specify an additional parameter type=json, the answer will return as JSON:

{"message":"test"}

Where message - the contents of the letter in the box with the specified id.

If we specify an additional parameter cut=html, then all HTML tags except links will be cut in the email. Available only when you receive the contents of the email.

If we specify an additional parameter base64=decode, the letter will be decoded, if it came as a set of characters. Available only when you receive the contents of the email.

If we specify an additional parameter forced=1, the message will be returned in the form in which it comes to the server, without post-processing. This option fixes the "Letter not found.", if the request via getlist letter is, and the request getmail returns an error. Available only when you receive the contents of the email.


4. Find out the remaining time of email's life

Call API with action parameter equal to livetime and key key:

https://post-shift.ru/api.php?action=livetime&key=faf3f53538d0b5a52222ad7ef5040068

In response, we get the number of seconds or an error message, if the box does not exist:

{"error":"key_not_found"}

Where error is the error text.

If we specify an additional parameter type=json, the answer will return as JSON:

{"key":"faf3f53538d0b5a52222ad7ef5040068","livetime":"479"}

Where key is the key of email, and livetime is the lifetime of email.


5. Extend life time up to 10 minutes

Call API with parameter action equal to update and key key:

https://post-shift.ru/api.php?action=update&key=faf3f53538d0b5a52222ad7ef5040068

In response, we get the number of remaining seconds (600) or an error message, if the box does not exist.

Use this function carefully, because this function does not add time, but returns it to the mark of 10 minutes!
If you have generated a mailbox name, use this function only if the lifetime of your mailbox is less than 10 minutes, because it will reset from 1 hour to 10 minutes!


If we specify an additional parameter type=json, the answer will return as JSON:

{"key":"faf3f53538d0b5a52222ad7ef5040068","livetime":"600"}

Where key is the email key, and livetime is the new email lifetime.


6. Delete used email

Call API with action parameter equal to delete and key key:

https://post-shift.ru/api.php?action=delete&key=faf3f53538d0b5a52222ad7ef5040068

The answer will be "OK" if there are no errors, or an error message.

If we specify an additional parameter type=json, the answer will return as JSON:

{"key":"faf3f53538d0b5a52222ad7ef5040068","delete":"ok"}

Where key is the email key that was deleted, and delete contains the successful deletion.


7. Clear email

Call API with action parameter equal to clear and key key:

https://post-shift.ru/api.php?action=clear&key=faf3f53538d0b5a52222ad7ef5040068

The answer will be "OK" if there are no errors, or an error message.

If we specify an additional parameter type=json, the answer will return as JSON:

{"key":"faf3f53538d0b5a52222ad7ef5040068","clear":"ok"}

Where key is the email key that was deleted, and clear contains the successful clear.


API response format:

The API supports the output format of responses, it is enough to specify at the end of the request:

Format Request Status
XML &type=xml In the development
JSON &type=json Supports
HTML &type=html In the development
Text nothing to indicate Supports

Questions and suggestions:

If you have any questions or suggestions, please email us via feedback form.