# Create a new contact list. POST https://host.com/v1/contact_lists Content-Type: application/json Reference: https://docs.meetgail.com/api-reference/api-reference/contact-lists/create ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Create a new contact list. version: endpoint_contactLists.create paths: /v1/contact_lists: post: operationId: create summary: Create a new contact list. tags: - - subpackage_contactLists parameters: - name: X-API-Key in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/GetContactListResponse' '400': description: Bad Request content: {} requestBody: description: The contact list details. content: application/json: schema: $ref: '#/components/schemas/ContactListRequest' components: schemas: ContactListRequest: type: object properties: name: type: - string - 'null' description: type: - string - 'null' required: - name - description ContactListStatus: type: string enum: - value: active - value: archived - value: deleting GetContactListResponse: type: object properties: id: type: string format: uuid name: type: - string - 'null' description: type: - string - 'null' status: $ref: '#/components/schemas/ContactListStatus' contactCount: type: - integer - 'null' required: - name - description - status ``` ## SDK Code Examples ```python import requests url = "https://host.com/v1/contact_lists" payload = { "name": "string", "description": "string" } headers = { "X-API-Key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://host.com/v1/contact_lists'; const options = { method: 'POST', headers: {'X-API-Key': '', 'Content-Type': 'application/json'}, body: '{"name":"string","description":"string"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://host.com/v1/contact_lists" payload := strings.NewReader("{\n \"name\": \"string\",\n \"description\": \"string\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-API-Key", "") 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 require 'uri' require 'net/http' url = URI("https://host.com/v1/contact_lists") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["X-API-Key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"name\": \"string\",\n \"description\": \"string\"\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://host.com/v1/contact_lists") .header("X-API-Key", "") .header("Content-Type", "application/json") .body("{\n \"name\": \"string\",\n \"description\": \"string\"\n}") .asString(); ``` ```php request('POST', 'https://host.com/v1/contact_lists', [ 'body' => '{ "name": "string", "description": "string" }', 'headers' => [ 'Content-Type' => 'application/json', 'X-API-Key' => '', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://host.com/v1/contact_lists"); var request = new RestRequest(Method.POST); request.AddHeader("X-API-Key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"name\": \"string\",\n \"description\": \"string\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "X-API-Key": "", "Content-Type": "application/json" ] let parameters = [ "name": "string", "description": "string" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://host.com/v1/contact_lists")! 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() ```