{
  "info": {
    "name": "IrnicReseller",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "description": "REST API of the OnlineServer .ir (IRNIC) domain reseller service.\n\n1. Order the free reseller service at https://onlineserver.ir/reseller-hosting/reseller-domain-iran-nic\n2. In the client area open the service, go to Access keys and create a key. The key is shown only once; you can limit it to your server IP addresses.\n3. Set the collection variable `bearerToken` to that key. Every request is sent with `Authorization: Bearer {{bearerToken}}`.\n\nRequests and responses are JSON. A missing, wrong or IP-restricted key returns HTTP 401.\n\nPersian guide: https://onlineserver.ir/reseller-hosting/reseller-domain-iran-nic/api\nQuestions: open a ticket in the Domain department at https://my.onlineserver.ir/submitticket.php?step=2&deptid=5"
  },
  "item": [
    {
      "name": "Account",
      "item": [
        {
          "name": "Fetch user information",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/account",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "account"
              ]
            },
            "description": "By using this method you can fetch information about the current authenticated user."
          },
          "response": [
            {
              "name": "Not authenticated",
              "originalRequest": {
                "method": "GET",
                "header": [
                  {
                    "key": "Accept",
                    "value": "application/json"
                  }
                ],
                "url": {
                  "raw": "{{baseUrl}}/account",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "account"
                  ]
                }
              },
              "status": "Unauthorized",
              "code": 401,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n    \"code\": \"unauthorized\",\n    \"message\": \"not authenticated\",\n    \"details\": []\n}"
            }
          ]
        }
      ],
      "description": "Use this endpoint to get information about account."
    },
    {
      "name": "Credits",
      "item": [
        {
          "name": "Get credit history",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/credits/history?page=1",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "credits",
                "history"
              ],
              "query": [
                {
                  "key": "page",
                  "value": "1",
                  "description": "Page number"
                },
                {
                  "key": "domain_id",
                  "value": "",
                  "description": "Domain id which transaction is relevant to",
                  "disabled": true
                },
                {
                  "key": "start_date",
                  "value": "",
                  "description": "Start date in YYYY-MM-DD format",
                  "disabled": true
                },
                {
                  "key": "end_date",
                  "value": "",
                  "description": "End date in YYYY-MM-DD format, if empty its until now",
                  "disabled": true
                }
              ]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Domains",
      "item": [
        {
          "name": "Fetch domains",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/domains?page=1&statuses[]=active&live=0",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "domains"
              ],
              "query": [
                {
                  "key": "page",
                  "value": "1",
                  "description": "Page number"
                },
                {
                  "key": "name",
                  "value": "",
                  "description": "Domain name to search for",
                  "disabled": true
                },
                {
                  "key": "statuses[]",
                  "value": "active",
                  "description": "One of active, inactive, refunded, pending_registration, pending_renew"
                },
                {
                  "key": "live",
                  "value": "0",
                  "description": "Get live information from nic.ir if possible"
                }
              ]
            },
            "description": "By using this method, all the user owned domains can be fetched"
          },
          "response": []
        },
        {
          "name": "Fetch domain info",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/domains/:id",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "domains",
                ":id"
              ],
              "variable": [
                {
                  "key": "id",
                  "value": "3",
                  "description": "Domain id"
                }
              ]
            },
            "description": "Get information about a domain"
          },
          "response": []
        },
        {
          "name": "Check existence",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"name\": \"example.ir\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/domains/check",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "domains",
                "check"
              ]
            },
            "description": "Sends requests to check availability of the domain, in case of unavailability it will also show the reason for it."
          },
          "response": []
        },
        {
          "name": "Register domain",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"name\": \"example.ir\",\n    \"period\": 1,\n    \"contacts\": {\n        \"holder\": \"ab1234-irnic\",\n        \"admin\": \"ab1234-irnic\",\n        \"tech\": \"ab1234-irnic\",\n        \"bill\": \"ab1234-irnic\"\n    },\n    \"nameservers\": [\n        {\"ns\": \"ns1.example.ir\", \"ips\": []},\n        {\"ns\": \"ns2.example.ir\", \"ips\": []},\n        {\"ns\": \"ns3.example.ir\", \"ips\": []},\n        {\"ns\": \"ns4.example.ir\", \"ips\": []}\n    ]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/domains",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "domains"
              ]
            },
            "description": "Registers a domain in the system"
          },
          "response": []
        },
        {
          "name": "Get renewal information and pre checks",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"name\": \"example.ir\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/domains/renewalInfo",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "domains",
                "renewalInfo"
              ]
            },
            "description": "Prechecks information domain renewal conditions and returns required stuff to do the renewal"
          },
          "response": []
        },
        {
          "name": "Renew domain",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"name\": \"example.ir\",\n    \"period\": 1,\n    \"unlock\": false\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/domains/renew",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "domains",
                "renew"
              ]
            },
            "description": "Renew the domain"
          },
          "response": []
        },
        {
          "name": "Request transfer pin code",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/domains/:id/pinCode",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "domains",
                ":id",
                "pinCode"
              ],
              "variable": [
                {
                  "key": "id",
                  "value": "3"
                }
              ]
            },
            "description": "Requests pin code for transfer for the specified domain which will be emailed to the domain holder."
          },
          "response": []
        },
        {
          "name": "Get information about the domain before transfer",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"name\": \"example.ir\",\n    \"holder\": \"ab1234-irnic\",\n    \"transfer_pin_code\": \"abcd88\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/domains/transferInfo",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "domains",
                "transferInfo"
              ]
            },
            "description": "Returns information and prechecks domain transfer conditions."
          },
          "response": []
        },
        {
          "name": "Pay for domain transfer",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"name\": \"example.ir\",\n    \"holder\": \"ab1234-irnic\",\n    \"transfer_pin_code\": \"abcd88\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/domains/transfer",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "domains",
                "transfer"
              ]
            },
            "description": "Pay for domain transfer and change holder."
          },
          "response": []
        },
        {
          "name": "Lock domain transferability",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/domains/:id/lock",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "domains",
                ":id",
                "lock"
              ],
              "variable": [
                {
                  "key": "id",
                  "value": "1"
                }
              ]
            },
            "description": "Locks domain for transfer so the old pin code will no longer work."
          },
          "response": []
        },
        {
          "name": "Update domain contacts",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"tech\": \"ab1234-irnic\",\n    \"bill\": \"ab1234-irnic\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/domains/:id/contacts",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "domains",
                ":id",
                "contacts"
              ],
              "variable": [
                {
                  "key": "id",
                  "value": "1"
                }
              ]
            },
            "description": "Update domain contacts."
          },
          "response": []
        },
        {
          "name": "Update nameservers",
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"nameservers\": [\n        {\"ns\": \"ns1.example.com\", \"ips\": []},\n        {\"ns\": \"ns2.example.com\", \"ips\": []},\n        {\"ns\": \"ns3.example.com\", \"ips\": []},\n        {\"ns\": \"ns4.example.com\", \"ips\": []}\n    ]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/domains/:id/nameservers",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "domains",
                ":id",
                "nameservers"
              ],
              "variable": [
                {
                  "key": "id",
                  "value": "3"
                }
              ]
            },
            "description": "Updates domain nameservers."
          },
          "response": []
        }
      ],
      "description": "To get information and operations of the domains use this endpoint."
    },
    {
      "name": "Contacts",
      "item": [
        {
          "name": "Fetch info about a contact",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/contacts/:contact_id",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "contacts",
                ":contact_id"
              ],
              "variable": [
                {
                  "key": "contact_id",
                  "value": "ab1234-irnic"
                }
              ]
            },
            "description": "Get contact information by roid or email address."
          },
          "response": [
            {
              "name": "Successful operation",
              "originalRequest": {
                "method": "GET",
                "header": [
                  {
                    "key": "Authorization",
                    "value": "Bearer <token>",
                    "description": "Added as a part of security scheme: bearer"
                  }
                ],
                "url": {
                  "raw": "{{baseUrl}}/contacts/:id",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "contacts",
                    ":id"
                  ],
                  "variable": [
                    {
                      "key": "id"
                    }
                  ]
                }
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"id\": \"<string>\"\n}"
            },
            {
              "name": "Not authenticated",
              "originalRequest": {
                "method": "GET",
                "header": [
                  {
                    "key": "Authorization",
                    "value": "Bearer <token>",
                    "description": "Added as a part of security scheme: bearer"
                  }
                ],
                "url": {
                  "raw": "{{baseUrl}}/contacts/:id",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "contacts",
                    ":id"
                  ],
                  "variable": [
                    {
                      "key": "id"
                    }
                  ]
                }
              },
              "status": "Unauthorized",
              "code": 401,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"isSuspended\": \"<boolean>\",\n  \"suspensionReason\": \"<string>\"\n}"
            },
            {
              "name": "The contact not found or invalid",
              "originalRequest": {
                "method": "GET",
                "header": [
                  {
                    "key": "Authorization",
                    "value": "Bearer <token>",
                    "description": "Added as a part of security scheme: bearer"
                  }
                ],
                "url": {
                  "raw": "{{baseUrl}}/contacts/:id",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "contacts",
                    ":id"
                  ],
                  "variable": [
                    {
                      "key": "id"
                    }
                  ]
                }
              },
              "status": "Not Found",
              "code": 404,
              "_postman_previewlanguage": "text",
              "header": [],
              "cookie": [],
              "body": ""
            }
          ]
        }
      ],
      "description": "To get information about the contacts use this endpoint."
    },
    {
      "name": "Pricing",
      "item": [
        {
          "name": "Get pricing",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/pricing",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "pricing"
              ]
            },
            "description": "Returns pricing information"
          },
          "response": [
            {
              "name": "Get pricing",
              "originalRequest": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{baseUrl}}/pricing",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "pricing"
                  ]
                }
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n    \"registration\": {\n        \"1\": \"2\",\n        \"5\": \"6\"\n    },\n    \"renewal\": {\n        \"1\": \"2\",\n        \"5\": \"6\"\n    },\n    \"transferFee\": \"3\",\n    \"pricePerUnit\": \"13350\",\n    \"maxAllowedUnits\": \"500\",\n    \"minUnits\": \"20\",\n    \"currency\": \"IRR\"\n}"
            }
          ]
        }
      ],
      "description": "To get pricing information use this endpoint."
    }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{bearerToken}}",
        "type": "string"
      }
    ]
  },
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "exec": [
          ""
        ]
      }
    },
    {
      "listen": "test",
      "script": {
        "type": "text/javascript",
        "exec": [
          ""
        ]
      }
    }
  ],
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://my.onlineserver.ir/modules/addons/IrnicReseller/api",
      "type": "string"
    },
    {
      "key": "bearerToken",
      "value": "",
      "type": "string"
    }
  ]
}
