# Register an inbox POST https://api2.freecustom.email/v1/inboxes Content-Type: application/json Registers an inbox for API use. **Platform domain inbox:** The domain must appear in `GET /v1/domains` for your plan. **Custom domain inbox:** The domain must be added and verified via `POST /v1/custom-domains` + `POST /v1/custom-domains/{domain}/verify` before registering inboxes at it. Requires Growth+ plan. Reference: https://docs.freecustom.email/free-custom-email-api/v-1/inboxes/register-an-inbox ## OpenAPI Specification ```yaml openapi: 3.1.0 info: title: collection version: 1.0.0 paths: /v1/inboxes: post: operationId: register-an-inbox summary: Register an inbox description: > Registers an inbox for API use. **Platform domain inbox:** The domain must appear in `GET /v1/domains` for your plan. **Custom domain inbox:** The domain must be added and verified via `POST /v1/custom-domains` + `POST /v1/custom-domains/{domain}/verify` before registering inboxes at it. Requires Growth+ plan. tags: - subpackage_v1.subpackage_v1/inboxes parameters: - name: Authorization in: header description: Bearer authentication required: true schema: type: string responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/v1_inboxes_Register an inbox_Response_200' '400': description: Bad Request content: application/json: schema: $ref: '#/components/schemas/PostV1InboxesRequestBadRequestError' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/PostV1InboxesRequestUnauthorizedError' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/PostV1InboxesRequestForbiddenError' '429': description: Too Many Requests content: application/json: schema: $ref: '#/components/schemas/PostV1InboxesRequestTooManyRequestsError' requestBody: content: application/json: schema: type: object properties: inbox: type: string format: email required: - inbox servers: - url: https://api2.freecustom.email components: schemas: v1_inboxes_Register an inbox_Response_200: type: object properties: inbox: type: string message: type: string success: type: boolean required: - inbox - message - success title: v1_inboxes_Register an inbox_Response_200 PostV1InboxesRequestBadRequestError: type: object properties: error: type: string message: type: string success: type: boolean required: - error - message - success title: PostV1InboxesRequestBadRequestError PostV1InboxesRequestUnauthorizedError: type: object properties: error: type: string message: type: string success: type: boolean required: - error - message - success title: PostV1InboxesRequestUnauthorizedError PostV1InboxesRequestForbiddenError: type: object properties: error: type: string message: type: string success: type: boolean upgrade_url: type: string format: uri required: - error - message - success - upgrade_url title: PostV1InboxesRequestForbiddenError PostV1InboxesRequestTooManyRequestsError: type: object properties: hint: type: string error: type: string message: type: string success: type: boolean credits_url: type: string format: uri upgrade_url: type: string format: uri required: - hint - error - message - success - credits_url - upgrade_url title: PostV1InboxesRequestTooManyRequestsError securitySchemes: bearerAuth: type: http scheme: bearer ``` ## SDK Code Examples ```python v1_inboxes_Register an inbox_example import requests url = "https://api2.freecustom.email/v1/inboxes" payload = { "inbox": "test@ditube.info" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript v1_inboxes_Register an inbox_example const url = 'https://api2.freecustom.email/v1/inboxes'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"inbox":"test@ditube.info"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go v1_inboxes_Register an inbox_example package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api2.freecustom.email/v1/inboxes" payload := strings.NewReader("{\n \"inbox\": \"test@ditube.info\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby v1_inboxes_Register an inbox_example require 'uri' require 'net/http' url = URI("https://api2.freecustom.email/v1/inboxes") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"inbox\": \"test@ditube.info\"\n}" response = http.request(request) puts response.read_body ``` ```java v1_inboxes_Register an inbox_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api2.freecustom.email/v1/inboxes") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"inbox\": \"test@ditube.info\"\n}") .asString(); ``` ```php v1_inboxes_Register an inbox_example request('POST', 'https://api2.freecustom.email/v1/inboxes', [ 'body' => '{ "inbox": "test@ditube.info" }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp v1_inboxes_Register an inbox_example using RestSharp; var client = new RestClient("https://api2.freecustom.email/v1/inboxes"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"inbox\": \"test@ditube.info\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift v1_inboxes_Register an inbox_example import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = ["inbox": "test@ditube.info"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api2.freecustom.email/v1/inboxes")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ```python v1_inboxes_Register an inbox_example import requests url = "https://api2.freecustom.email/v1/inboxes" payload = { "inbox": "test@ditube.info" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript v1_inboxes_Register an inbox_example const url = 'https://api2.freecustom.email/v1/inboxes'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"inbox":"test@ditube.info"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go v1_inboxes_Register an inbox_example package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api2.freecustom.email/v1/inboxes" payload := strings.NewReader("{\n \"inbox\": \"test@ditube.info\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby v1_inboxes_Register an inbox_example require 'uri' require 'net/http' url = URI("https://api2.freecustom.email/v1/inboxes") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"inbox\": \"test@ditube.info\"\n}" response = http.request(request) puts response.read_body ``` ```java v1_inboxes_Register an inbox_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api2.freecustom.email/v1/inboxes") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"inbox\": \"test@ditube.info\"\n}") .asString(); ``` ```php v1_inboxes_Register an inbox_example request('POST', 'https://api2.freecustom.email/v1/inboxes', [ 'body' => '{ "inbox": "test@ditube.info" }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp v1_inboxes_Register an inbox_example using RestSharp; var client = new RestClient("https://api2.freecustom.email/v1/inboxes"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"inbox\": \"test@ditube.info\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift v1_inboxes_Register an inbox_example import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = ["inbox": "test@ditube.info"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api2.freecustom.email/v1/inboxes")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```