2PeekMe Documentation

HTTPS API and CLI documentation


Introduction


2PeekMe is a free subdomain service. You can use it via a HTTPS API or via a command line tool.
To get any support, please email [email protected].

API Routes

2PeekMe can be acced via https://api.2peek.me/. 2 differents types of routes are possible: key/ and subdomains/.

Keys routes

/key/get: Provides you an API key when fetched with a GET request. Each key has unlimited uses and need to be provided in the URL parameters of each other route (?api=).

#example curl request
$ curl -L -X GET https://api.2peek.me/key/get
{"success":true,"result":"e3f456aabd8d66e500571b875985e92c"}        
                                

/key/info: Provides informations about an API key when fetched with a GET request. Needs a key= parameter including an API key.

#example curl request
$ curl -L -X GET "https://api.2peek.me/key/info?key=e3f456aabd8d66e500571b875985e92c"
{"success":true,"result":{"key":"e3f456aabd8d66e500571b875985e92c","last_used":null,"times_used":0,"created_at":"2024-12-12 16:04:45"}}       
                                

/key/delete: Deletes the given API key and all associated subdomains when fetched with a POST request. THIS CANNOT BE REVOKED. Needs a key= parameter including an API key.

#example curl request
$ curl -L -X POST "https://api.2peek.me/key/delete?key=e3f456aabd8d66e500571b875985e92c"
{"success":true,"result":"API key [e3f456aabd8d66e500571b875985e92c] and all associated subdomains successfully deleted."}
                                

Subdomains routes

/subdomain/create: Create a new subdomain when fetched with a POST request. Needs a key= parameter including an API key, a subdomain= parameter including the subdomain name, a type= parameter including the record name (Supported records: 'A', 'AAAA', 'CNAME', 'MX', 'TXT', 'SRV', 'PTR', 'NS') and a value= parameter including the record value.

#example curl request
$ curl -L -X POST "https://api.2peek.me/subdomain/create?key=8cc99cd214f5a69c57d857e401f1537b&subdomain=helloworld&type=TXT&value=hey"
{"success":true,"result":"Subdomain [helloworld => hey | TXT] successfully created."}
                                

/subdomain/update: Updates a subdomain when fetched with a POST request. THIS CANNOT BE REVOKED. Needs a key= parameter including an API key, a subdomain= parameter including the subdomain name, a type= parameter including the record name (Supported records: 'A', 'AAAA', 'CNAME', 'TXT') and a value= parameter including the record value.

#example curl request
$ curl -L -X POST "https://api.2peek.me/subdomain/update?key=8cc99cd214f5a69c57d857e401f1537b&subdomain=helloworld&type=A&value=1.1.1.1"
{"success":true,"result":"Subdomain successfully updated to [helloworld => 1.1.1.1 | A]."}
                                

/subdomain/delete: Deletes a subdomain when fetched with a POST request. THIS CANNOT BE REVOKED. Needs a key= parameter including an API key and a subdomain= parameter including the subdomain name.

#example curl request
$ curl -L -X POST "https://api.2peek.me/subdomain/delete?key=8cc99cd214f5a69c57d857e401f1537b&subdomain=helloworld"
{"success":true,"result":"Subdomain [helloworld] successfully deleted."}
                                

/subdomain/list: List all subdomains of an API key when fetched with a GET request. Needs a key= parameter including an API key.

#example curl request
$ curl -L -X GET "https://api.2peek.me/subdomain/list?key=8cc99cd214f5a69c57d857e401f1537b"
{"success":true,"subdomains":[{"name":"helloworld","type":"A","value":"1.1.1.1","created_at":"2024-12-12 16:26:51"}]}
                                

Possible API Responses

Code 200

All API responses will be 200 status code and will include a JSON-formated response with a success boolean and a result string.

Possible responses for /key/get :

#Response 1: Success.
{
    "success": true,
    "result": "a80ef0eb3b941411a1017468d5ad7a01"
}
                        

Possible responses for /key/info :

#Response 1: No key parameter given
{
    "success": false,
    "result": "Missing required parameter: key."
}
                        
#Response 2: Invalid API key.
{
    "success": false,
    "result": "API key not found"
}
                        
#Response 3: Success.
{
    "success": true,
    "result": {
      "key": "977ccc00885207f1d1225f980758216a",
      "last_used": null,
      "times_used": 0,
      "created_at": "2024-12-12 16:51:18"
    }
}
                        

Possible responses for /key/delete :

#Response 1: No key parameter given
{
    "success": false,
    "result": "Missing required parameter: key."
}
                        
#Response 2: Failed to delete DNS records, please contact support.
{
    "success": false,
    "result": "Failed to delete DNS record on Cloudflare."
}
                        
#Response 3: Database error, please contact support.
{
    "success": false,
    "result": "Failed to delete API key."
}
                        
#Response 4: Success.
{
    "success": true,
    "result": "API key [977ccc00885207f1d1225f980758216a] and all associated subdomains successfully deleted."
}
                        

Possible responses for /subdomain/create :

#Response 1: Missing parameters.
{
    "success":false,
    "result":"Missing required parameters: key, subdomain, type, or value."
}
                        
#Response 2: Invalid DNS type (not in 'A', 'AAAA', 'CNAME', 'TXT').
{
    "success": false,
    "result": "Invalid DNS type."
}
                        
#Response 3: Invalid subdomain format, check if the subdomain doesn't have illegal rules.
{
    "success": false,
    "result": "Invalid subdomain format."
}
                        
#Response 4: Invalid IP address (for A and AAAA types).
{
    "success": false,
    "result": "Invalid IP address."
}
                        
#Response 5: Invalid CNAME domain (for CNAME types).
{
    "success": false,
    "result": "Invalid CNAME value."
}
                        
#Response 6: Invalid API key.
{
    "success": false,
    "result": "API key not found"
}
                        
#Response 7: Subdomain already exists, choose another one.
{
    "success": false,
    "result": "API key not found"
}
                        
#Response 8: Failed to create DNS record, please contact support.
{
    "success": false,
    "result": "Failed to create DNS record on Cloudflare."
}
                        
#Response 9: Success.
{
    "success": true,
    "result": "Subdomain [helloworld => 2peek.me | CNAME] successfully created."
}
                        

Possible responses for /subdomain/update :

#Response 1 -9: Same as /subdomain/create responses.
                        

Possible responses for /subdomain/delete :

#Response 1: Missing parameters.
{
    "success": false,
    "result": "Missing required parameters: key or subdomain."
}
                        
#Response 2: Invalid subdomain.
{
    "success": false,
    "result": "Subdomain does not exist."
}
                        
#Response 3: Wrong API key.
{
    "success": false,
    "result": "API key does not match the subdomain."
}
                        
#Response 4: Failed to delete DNS record of Cloudflare, please contact support.
{
    "success": false,
    "result": "Failed to delete DNS record on Cloudflare."
}
                        
#Response 5: Success.
{
    "success": true,
    "result": "Subdomain [helloworld] successfully deleted."
}
                        

Possible responses for /subdomain/list :

#Response 1: No key parameter given
{
    "success": false,
    "result": "Missing required parameter: key."
}
                        
#Response 2: Invalid API key.
{
    "success": false,
    "result": "API key not found"
}
                        
#Response 3: Success.
{
    "success": true,
    "subdomains": [
      {
        "name": "helloworld",
        "type": "CNAME",
        "value": "2peek.me",
        "created_at": "2024-12-12 18:01:55"
      },
      {
        "name": "helloworld2",
        "type": "A",
        "value": "1.1.1.1",
        "created_at": "2024-12-12 18:02:29"
      }
    ]
}
                        

Command Line Tool

Installation

To install the command line tool, you need to first have NodeJs and NPM installed on your system.
You can then install the tool:

$ npm install -g 2pme
                        

Usage

After installation, you can use the tool with the following command:

$ 2pme [command]
                        

Commands

Here are the commands provided by the command line tool.

- key - Manage your API key.
  - Options:
    - --create - Generate a new API key.
    - --set !key! - Set your API key.
    - --info - Get information about your API key.
    - --delete - Deletes your API key.
  
- create - Create a new subdomain.
  - Options:
    - --name !name! - Subdomain name.
    - --type !type! - DNS record type (A, CNAME, TXT, etc.).
    - --value !value! - Record value.

- update - Update an existing subdomain.
  - Options:
    - --name !name! - Subdomain name.
    - --type !type! - New DNS record type.
    - --value !value! - New record value.

- delete - Delete a subdomain.
  - Options:
    - --name !name! - Subdomain name.

- list - List all subdomains.