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.
- Confirm the email address entered during registration by following the link in the mail.
- 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.
Account management:
When you register, you get 100 free calls to the service.
Requests are debited for:
- creating a new mailbox (per API call with action equal to new);
- getting a list of emails (per API call with action equal to getlist);
- getting the text of an individual email (for API call with action parameter equal to getmail);
- extension of email a lifetime (for API call with action parameter equal to update).
Write-off does not occur when calling other functions of the service!
1.1. New user registration
Call API with action parameter equal to reg and email parameter equal to your_real_mail. You will need it to confirm your account!
Example:
https://post-shift.ru/api.php?action=reg&email=name@domain.ru
We receive a response from the server:
{"hash":"d6be5cce6245b61552cdc5201e0488b2"}
Where hash is the hash required to access the service.
1.2. Email confirmation after registration
After registration, you will receive an email with a link to confirm your email. You need to follow this link to confirm the email you entered during registration!
Example:
https://post-shift.ru/api.php?action=verify&code=000a6a06599e6a88877337821fe61444
The answer will be "OK" if there are no errors, or an error message.
{"verify":"ok"}
Where verify message about successful confirmation of the mailbox.
Be sure to check the Spam folder!
1.3. How do I get an email confirmation link?
Calling the API with the action parameter equal to getverify and the email parameter equal to the user's email specified during registration:
https://post-shift.ru/api.php?action=getverify&email=name@domain.ru
The answer will be "OK" if there are no errors, or an error message.
{"send":"ok"}
Where send a message about the successful sending of an email with a confirmation link to the mail.
Be sure to check the Spam folder!
1.4. How to restore a user's hash?
Calling the API with the action parameter equal to hash and the email parameter equal to the user's email specified during registration:
https://post-shift.ru/api.php?action=hash&email=name@domain.ru
The answer will be "OK" if there are no errors, or an error message.
{"send":"ok"}
Where send a message about the successful sending of a hash message to the mail.
Be sure to check the Spam folder!
2. Check remaining cases / check balance
Call the API with the action parameter equal to balance and the hash parameter equal to the_resulting_hash_registration:
Example:
https://post-shift.ru/api.php?action=balance&hash=d6be5cce6245b61552cdc5201e0488b2
Получаем ответ от сервера:
{"limit":100}
Where limit - the number of available calls to the function "Receiving the text of the letter".
Usage:
3. 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&hash=d6be5cce6245b61552cdc5201e0488b2
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&hash=d6be5cce6245b61552cdc5201e0488b2&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":"bjlokwva72@post-shift.ru","key":"faf3f53538d0b5a52222ad7ef5040068"}
Where email is our address and key is the key needed for further access to the mailbox.
4. Getting a list of emails
Call API with action parameter equal to getlist and key key:
https://post-shift.ru/api.php?action=getlist&hash=d6be5cce6245b61552cdc5201e0488b2&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"}]
Where id - the number of our letters in the box, date - date of letter, subject - subject, from - address of the sender.
5. 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&hash=d6be5cce6245b61552cdc5201e0488b2&key=faf3f53538d0b5a52222ad7ef5040068&id=1
In response, we receive the text of the message, in the form in which it came.
{"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.
6. 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.
{"livetime":"479"}
Where key is the key of email, and livetime is the lifetime of email.
7. 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&hash=d6be5cce6245b61552cdc5201e0488b2&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!
{"livetime":"600"}
Where key is the email key, and livetime is the new email lifetime.
8. 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.
{"delete":"ok"}
Where key is the email key that was deleted, and delete contains the successful deletion.
9. 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.
{"clear":"ok"}
Where key is the email key that was deleted, and clear contains the successful clear.
10. To obtain a list of active keys from boxes
Call the API with the action parameter equal to getkeys and the hash parameter equal to the user hash obtained during registration:
https://post-shift.ru/api.php?action=getkeys&hash=faf3f53538d0b5a52222ad7ef5040068
In response, we get a list of active keys, if there are no errors, or a message that no active keys were found.
[{"key":"faf3f53538d0b5a52222ad7ef5040068","mail":"bjlokwva72@post-shift.ru"}]
Where key is the email key that was deleted, and mail is the mailbox itself.
11. Delete all active emails by IP
Calling the API with the action parameter equal to deleteall:
https://post-shift.ru/api.php?action=deleteall
The answer will be "OK" if there are no errors, or an error message.
{"delete":"ok"}
Where delete message about successful deletion.
Questions and suggestions:
If you have any questions or suggestions, please email us via feedback form.