### Go Example - Create Lead Source: https://developer.instantly.ai/api/v2/lead/getlead Example Go code using the net/http package to create a lead via the Instantly AI API. It demonstrates setting headers and sending a JSON payload. ```go package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func createLead(leadData map[string]interface{}) error { url := "https://api.instantly.ai/api/v2/leads" jsonData, err := json.Marshal(leadData) if err != nil { return fmt.Errorf("failed to marshal JSON: %w", err) } req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { return fmt.Errorf("failed to create request: %w", err) } req.Header.Set("Authorization", "Bearer ") req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, err := client.Do(req) if err != nil { return fmt.Errorf("failed to send request: %w", err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { return fmt.Errorf("failed to read response body: %w", err) } if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated { return fmt.Errorf("request failed with status %d: %s", resp.StatusCode, string(body)) } fmt.Printf("Response: %s\n", string(body)) return nil } func main() { leads := map[string]interface{}{ "email": "example@example.com", "first_name": "John", "last_name": "Doe", "company_name": "Example Inc.", "lt_interest_status": 1, "campaign": "0198395a-e6da-74e5-bd47-a5cc88618ed1", } err := createLead(leads) if err != nil { fmt.Printf("Error creating lead: %v\n", err) } } ``` -------------------------------- ### Get Lead Request Example (cURL) Source: https://developer.instantly.ai/api/v2/lead/updateleadintereststatus Example of how to make a GET request to retrieve lead information using cURL, including authorization header. ```curl curl -i -X GET \ https://api.instantly.ai/api/v2/leads/0198395b-051f-7807-a275-52c042a1fce0 \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Get Lead Request Example (cURL) Source: https://developer.instantly.ai/api/v2/lead/removeleadfromsubsequence Example of how to make a GET request to retrieve lead information using cURL, including authorization header. ```curl curl -i -X GET \ https://api.instantly.ai/api/v2/leads/0198395b-051f-7807-a275-52c042a1fce0 \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Go Example - Create Lead Source: https://developer.instantly.ai/api/v2/lead/bulkassignleads Example Go code using the net/http package to create a lead via the Instantly AI API. It demonstrates setting headers and sending a JSON payload. ```go package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func createLead(leadData map[string]interface{}) error { url := "https://api.instantly.ai/api/v2/leads" jsonData, err := json.Marshal(leadData) if err != nil { return fmt.Errorf("failed to marshal JSON: %w", err) } req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { return fmt.Errorf("failed to create request: %w", err) } req.Header.Set("Authorization", "Bearer ") req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, err := client.Do(req) if err != nil { return fmt.Errorf("failed to send request: %w", err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { return fmt.Errorf("failed to read response body: %w", err) } if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated { return fmt.Errorf("request failed with status %d: %s", resp.StatusCode, string(body)) } fmt.Printf("Response: %s\n", string(body)) return nil } func main() { leads := map[string]interface{}{ "email": "example@example.com", "first_name": "John", "last_name": "Doe", "company_name": "Example Inc.", "lt_interest_status": 1, "campaign": "0198395a-e6da-74e5-bd47-a5cc88618ed1", } err := createLead(leads) if err != nil { fmt.Printf("Error creating lead: %v\n", err) } } ``` -------------------------------- ### Go Example - Create Lead Source: https://developer.instantly.ai/api/v2/lead/def-11 Example Go code using the net/http package to create a lead via the Instantly AI API. It demonstrates setting headers and sending a JSON payload. ```go package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func createLead(leadData map[string]interface{}) error { url := "https://api.instantly.ai/api/v2/leads" jsonData, err := json.Marshal(leadData) if err != nil { return fmt.Errorf("failed to marshal JSON: %w", err) } req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { return fmt.Errorf("failed to create request: %w", err) } req.Header.Set("Authorization", "Bearer ") req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, err := client.Do(req) if err != nil { return fmt.Errorf("failed to send request: %w", err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { return fmt.Errorf("failed to read response body: %w", err) } if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated { return fmt.Errorf("request failed with status %d: %s", resp.StatusCode, string(body)) } fmt.Printf("Response: %s\n", string(body)) return nil } func main() { leads := map[string]interface{}{ "email": "example@example.com", "first_name": "John", "last_name": "Doe", "company_name": "Example Inc.", "lt_interest_status": 1, "campaign": "0198395a-e6da-74e5-bd47-a5cc88618ed1", } err := createLead(leads) if err != nil { fmt.Printf("Error creating lead: %v\n", err) } } ``` -------------------------------- ### Get Lead Request Example (cURL) Source: https://developer.instantly.ai/api/v2/lead/moveleadtosubsequence Example of how to make a GET request to retrieve lead information using cURL, including authorization header. ```curl curl -i -X GET \ https://api.instantly.ai/api/v2/leads/0198395b-051f-7807-a275-52c042a1fce0 \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Go Example - Create Lead Source: https://developer.instantly.ai/api/v2/lead/moveleads Example Go code using the net/http package to create a lead via the Instantly AI API. It demonstrates setting headers and sending a JSON payload. ```go package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func createLead(leadData map[string]interface{}) error { url := "https://api.instantly.ai/api/v2/leads" jsonData, err := json.Marshal(leadData) if err != nil { return fmt.Errorf("failed to marshal JSON: %w", err) } req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { return fmt.Errorf("failed to create request: %w", err) } req.Header.Set("Authorization", "Bearer ") req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, err := client.Do(req) if err != nil { return fmt.Errorf("failed to send request: %w", err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { return fmt.Errorf("failed to read response body: %w", err) } if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated { return fmt.Errorf("request failed with status %d: %s", resp.StatusCode, string(body)) } fmt.Printf("Response: %s\n", string(body)) return nil } func main() { leads := map[string]interface{}{ "email": "example@example.com", "first_name": "John", "last_name": "Doe", "company_name": "Example Inc.", "lt_interest_status": 1, "campaign": "0198395a-e6da-74e5-bd47-a5cc88618ed1", } err := createLead(leads) if err != nil { fmt.Printf("Error creating lead: %v\n", err) } } ``` -------------------------------- ### Get Lead Request Example (cURL) Source: https://developer.instantly.ai/api/v2/lead/deletelead Example of how to make a GET request to retrieve lead information using cURL, including authorization header. ```curl curl -i -X GET \ https://api.instantly.ai/api/v2/leads/0198395b-051f-7807-a275-52c042a1fce0 \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Get Lead Request Example (cURL) Source: https://developer.instantly.ai/api/v2/lead/def-11 Example of how to make a GET request to retrieve lead information using cURL, including authorization header. ```curl curl -i -X GET \ https://api.instantly.ai/api/v2/leads/0198395b-051f-7807-a275-52c042a1fce0 \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Go Example - Create Lead Source: https://developer.instantly.ai/api/v2/lead/createlead Example Go code using the net/http package to create a lead via the Instantly AI API. It demonstrates setting headers and sending a JSON payload. ```go package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func createLead(leadData map[string]interface{}) error { url := "https://api.instantly.ai/api/v2/leads" jsonData, err := json.Marshal(leadData) if err != nil { return fmt.Errorf("failed to marshal JSON: %w", err) } req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { return fmt.Errorf("failed to create request: %w", err) } req.Header.Set("Authorization", "Bearer ") req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, err := client.Do(req) if err != nil { return fmt.Errorf("failed to send request: %w", err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { return fmt.Errorf("failed to read response body: %w", err) } if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated { return fmt.Errorf("request failed with status %d: %s", resp.StatusCode, string(body)) } fmt.Printf("Response: %s\n", string(body)) return nil } func main() { leads := map[string]interface{}{ "email": "example@example.com", "first_name": "John", "last_name": "Doe", "company_name": "Example Inc.", "lt_interest_status": 1, "campaign": "0198395a-e6da-74e5-bd47-a5cc88618ed1", } err := createLead(leads) if err != nil { fmt.Printf("Error creating lead: %v\n", err) } } ``` -------------------------------- ### Go Example - Create Lead Source: https://developer.instantly.ai/api/v2/lead/mergeleads Example Go code using the net/http package to create a lead via the Instantly AI API. It demonstrates setting headers and sending a JSON payload. ```go package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func createLead(leadData map[string]interface{}) error { url := "https://api.instantly.ai/api/v2/leads" jsonData, err := json.Marshal(leadData) if err != nil { return fmt.Errorf("failed to marshal JSON: %w", err) } req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { return fmt.Errorf("failed to create request: %w", err) } req.Header.Set("Authorization", "Bearer ") req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, err := client.Do(req) if err != nil { return fmt.Errorf("failed to send request: %w", err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { return fmt.Errorf("failed to read response body: %w", err) } if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated { return fmt.Errorf("request failed with status %d: %s", resp.StatusCode, string(body)) } fmt.Printf("Response: %s\n", string(body)) return nil } func main() { leads := map[string]interface{}{ "email": "example@example.com", "first_name": "John", "last_name": "Doe", "company_name": "Example Inc.", "lt_interest_status": 1, "campaign": "0198395a-e6da-74e5-bd47-a5cc88618ed1", } err := createLead(leads) if err != nil { fmt.Printf("Error creating lead: %v\n", err) } } ``` -------------------------------- ### Get Lead Request Example (cURL) Source: https://developer.instantly.ai/api/v2/lead/createlead Example of how to make a GET request to retrieve lead information using cURL, including authorization header. ```curl curl -i -X GET \ https://api.instantly.ai/api/v2/leads/0198395b-051f-7807-a275-52c042a1fce0 \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Get Lead Request Example (cURL) Source: https://developer.instantly.ai/api/v2/lead/bulkassignleads Example of how to make a GET request to retrieve lead information using cURL, including authorization header. ```curl curl -i -X GET \ https://api.instantly.ai/api/v2/leads/0198395b-051f-7807-a275-52c042a1fce0 \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Go Example - Create Lead Source: https://developer.instantly.ai/api/v2/lead/listleads Example Go code using the net/http package to create a lead via the Instantly AI API. It demonstrates setting headers and sending a JSON payload. ```go package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func createLead(leadData map[string]interface{}) error { url := "https://api.instantly.ai/api/v2/leads" jsonData, err := json.Marshal(leadData) if err != nil { return fmt.Errorf("failed to marshal JSON: %w", err) } req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { return fmt.Errorf("failed to create request: %w", err) } req.Header.Set("Authorization", "Bearer ") req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, err := client.Do(req) if err != nil { return fmt.Errorf("failed to send request: %w", err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { return fmt.Errorf("failed to read response body: %w", err) } if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated { return fmt.Errorf("request failed with status %d: %s", resp.StatusCode, string(body)) } fmt.Printf("Response: %s\n", string(body)) return nil } func main() { leads := map[string]interface{}{ "email": "example@example.com", "first_name": "John", "last_name": "Doe", "company_name": "Example Inc.", "lt_interest_status": 1, "campaign": "0198395a-e6da-74e5-bd47-a5cc88618ed1", } err := createLead(leads) if err != nil { fmt.Printf("Error creating lead: %v\n", err) } } ``` -------------------------------- ### Go Example - Create Lead Source: https://developer.instantly.ai/api/v2/lead/moveleadtosubsequence Example Go code using the net/http package to create a lead via the Instantly AI API. It demonstrates setting headers and sending a JSON payload. ```go package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func createLead(leadData map[string]interface{}) error { url := "https://api.instantly.ai/api/v2/leads" jsonData, err := json.Marshal(leadData) if err != nil { return fmt.Errorf("failed to marshal JSON: %w", err) } req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { return fmt.Errorf("failed to create request: %w", err) } req.Header.Set("Authorization", "Bearer ") req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, err := client.Do(req) if err != nil { return fmt.Errorf("failed to send request: %w", err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { return fmt.Errorf("failed to read response body: %w", err) } if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated { return fmt.Errorf("request failed with status %d: %s", resp.StatusCode, string(body)) } fmt.Printf("Response: %s\n", string(body)) return nil } func main() { leads := map[string]interface{}{ "email": "example@example.com", "first_name": "John", "last_name": "Doe", "company_name": "Example Inc.", "lt_interest_status": 1, "campaign": "0198395a-e6da-74e5-bd47-a5cc88618ed1", } err := createLead(leads) if err != nil { fmt.Printf("Error creating lead: %v\n", err) } } ``` -------------------------------- ### Get Lead Request Example (cURL) Source: https://developer.instantly.ai/api/v2/lead Example of how to make a GET request to retrieve lead information using cURL, including authorization header. ```curl curl -i -X GET \ https://api.instantly.ai/api/v2/leads/0198395b-051f-7807-a275-52c042a1fce0 \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Go Example - Create Lead Source: https://developer.instantly.ai/api/v2/lead/patchlead Example Go code using the net/http package to create a lead via the Instantly AI API. It demonstrates setting headers and sending a JSON payload. ```go package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func createLead(leadData map[string]interface{}) error { url := "https://api.instantly.ai/api/v2/leads" jsonData, err := json.Marshal(leadData) if err != nil { return fmt.Errorf("failed to marshal JSON: %w", err) } req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { return fmt.Errorf("failed to create request: %w", err) } req.Header.Set("Authorization", "Bearer ") req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, err := client.Do(req) if err != nil { return fmt.Errorf("failed to send request: %w", err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { return fmt.Errorf("failed to read response body: %w", err) } if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated { return fmt.Errorf("request failed with status %d: %s", resp.StatusCode, string(body)) } fmt.Printf("Response: %s\n", string(body)) return nil } func main() { leads := map[string]interface{}{ "email": "example@example.com", "first_name": "John", "last_name": "Doe", "company_name": "Example Inc.", "lt_interest_status": 1, "campaign": "0198395a-e6da-74e5-bd47-a5cc88618ed1", } err := createLead(leads) if err != nil { fmt.Printf("Error creating lead: %v\n", err) } } ``` -------------------------------- ### Get Lead Request Example (cURL) Source: https://developer.instantly.ai/api/v2/lead/patchlead Example of how to make a GET request to retrieve lead information using cURL, including authorization header. ```curl curl -i -X GET \ https://api.instantly.ai/api/v2/leads/0198395b-051f-7807-a275-52c042a1fce0 \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Get Lead Request Example (cURL) Source: https://developer.instantly.ai/api/v2/lead/moveleads Example of how to make a GET request to retrieve lead information using cURL, including authorization header. ```curl curl -i -X GET \ https://api.instantly.ai/api/v2/leads/0198395b-051f-7807-a275-52c042a1fce0 \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Go Example - Create Lead Source: https://developer.instantly.ai/api/v2/lead/updateleadintereststatus Example Go code using the net/http package to create a lead via the Instantly AI API. It demonstrates setting headers and sending a JSON payload. ```go package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func createLead(leadData map[string]interface{}) error { url := "https://api.instantly.ai/api/v2/leads" jsonData, err := json.Marshal(leadData) if err != nil { return fmt.Errorf("failed to marshal JSON: %w", err) } req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { return fmt.Errorf("failed to create request: %w", err) } req.Header.Set("Authorization", "Bearer ") req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, err := client.Do(req) if err != nil { return fmt.Errorf("failed to send request: %w", err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { return fmt.Errorf("failed to read response body: %w", err) } if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated { return fmt.Errorf("request failed with status %d: %s", resp.StatusCode, string(body)) } fmt.Printf("Response: %s\n", string(body)) return nil } func main() { leads := map[string]interface{}{ "email": "example@example.com", "first_name": "John", "last_name": "Doe", "company_name": "Example Inc.", "lt_interest_status": 1, "campaign": "0198395a-e6da-74e5-bd47-a5cc88618ed1", } err := createLead(leads) if err != nil { fmt.Printf("Error creating lead: %v\n", err) } } ``` -------------------------------- ### Get Lead Request Example (cURL) Source: https://developer.instantly.ai/api/v2/lead/mergeleads Example of how to make a GET request to retrieve lead information using cURL, including authorization header. ```curl curl -i -X GET \ https://api.instantly.ai/api/v2/leads/0198395b-051f-7807-a275-52c042a1fce0 \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Go Example - Create Lead Source: https://developer.instantly.ai/api/v2/lead Example Go code using the net/http package to create a lead via the Instantly AI API. It demonstrates setting headers and sending a JSON payload. ```go package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func createLead(leadData map[string]interface{}) error { url := "https://api.instantly.ai/api/v2/leads" jsonData, err := json.Marshal(leadData) if err != nil { return fmt.Errorf("failed to marshal JSON: %w", err) } req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { return fmt.Errorf("failed to create request: %w", err) } req.Header.Set("Authorization", "Bearer ") req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, err := client.Do(req) if err != nil { return fmt.Errorf("failed to send request: %w", err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { return fmt.Errorf("failed to read response body: %w", err) } if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated { return fmt.Errorf("request failed with status %d: %s", resp.StatusCode, string(body)) } fmt.Printf("Response: %s\n", string(body)) return nil } func main() { leads := map[string]interface{}{ "email": "example@example.com", "first_name": "John", "last_name": "Doe", "company_name": "Example Inc.", "lt_interest_status": 1, "campaign": "0198395a-e6da-74e5-bd47-a5cc88618ed1", } err := createLead(leads) if err != nil { fmt.Printf("Error creating lead: %v\n", err) } } ``` -------------------------------- ### Get Lead Request Example (cURL) Source: https://developer.instantly.ai/api/v2/lead/listleads Example of how to make a GET request to retrieve lead information using cURL, including authorization header. ```curl curl -i -X GET \ https://api.instantly.ai/api/v2/leads/0198395b-051f-7807-a275-52c042a1fce0 \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Go Example - Create Lead Source: https://developer.instantly.ai/api/v2/lead/removeleadfromsubsequence Example Go code using the net/http package to create a lead via the Instantly AI API. It demonstrates setting headers and sending a JSON payload. ```go package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func createLead(leadData map[string]interface{}) error { url := "https://api.instantly.ai/api/v2/leads" jsonData, err := json.Marshal(leadData) if err != nil { return fmt.Errorf("failed to marshal JSON: %w", err) } req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { return fmt.Errorf("failed to create request: %w", err) } req.Header.Set("Authorization", "Bearer ") req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, err := client.Do(req) if err != nil { return fmt.Errorf("failed to send request: %w", err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { return fmt.Errorf("failed to read response body: %w", err) } if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated { return fmt.Errorf("request failed with status %d: %s", resp.StatusCode, string(body)) } fmt.Printf("Response: %s\n", string(body)) return nil } func main() { leads := map[string]interface{}{ "email": "example@example.com", "first_name": "John", "last_name": "Doe", "company_name": "Example Inc.", "lt_interest_status": 1, "campaign": "0198395a-e6da-74e5-bd47-a5cc88618ed1", } err := createLead(leads) if err != nil { fmt.Printf("Error creating lead: %v\n", err) } } ``` -------------------------------- ### Go Example - Create Lead Source: https://developer.instantly.ai/api/v2/lead/deletelead Example Go code using the net/http package to create a lead via the Instantly AI API. It demonstrates setting headers and sending a JSON payload. ```go package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func createLead(leadData map[string]interface{}) error { url := "https://api.instantly.ai/api/v2/leads" jsonData, err := json.Marshal(leadData) if err != nil { return fmt.Errorf("failed to marshal JSON: %w", err) } req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { return fmt.Errorf("failed to create request: %w", err) } req.Header.Set("Authorization", "Bearer ") req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, err := client.Do(req) if err != nil { return fmt.Errorf("failed to send request: %w", err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { return fmt.Errorf("failed to read response body: %w", err) } if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated { return fmt.Errorf("request failed with status %d: %s", resp.StatusCode, string(body)) } fmt.Printf("Response: %s\n", string(body)) return nil } func main() { leads := map[string]interface{}{ "email": "example@example.com", "first_name": "John", "last_name": "Doe", "company_name": "Example Inc.", "lt_interest_status": 1, "campaign": "0198395a-e6da-74e5-bd47-a5cc88618ed1", } err := createLead(leads) if err != nil { fmt.Printf("Error creating lead: %v\n", err) } } ``` -------------------------------- ### Get Lead Request Example (cURL) Source: https://developer.instantly.ai/api/v2/lead/getlead Example of how to make a GET request to retrieve lead information using cURL, including authorization header. ```curl curl -i -X GET \ https://api.instantly.ai/api/v2/leads/0198395b-051f-7807-a275-52c042a1fce0 \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Ruby Example - Create Lead Source: https://developer.instantly.ai/api/v2/lead/getlead Example Ruby code using the 'net/http' library to create a lead via the Instantly AI API. It demonstrates setting headers and sending a JSON payload. ```ruby require 'net/http' require 'uri' require 'json' def create_lead(lead_data) uri = URI.parse('https://api.instantly.ai/api/v2/leads') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.request_uri) request['Authorization'] = 'Bearer ' request['Content-Type'] = 'application/json' request.body = lead_data.to_json response = http.request(request) puts "HTTP Status: #{response.code}" puts "Response Body: #{response.body}" JSON.parse(response.body) if response.is_a?(Net::HTTPSuccess) rescue StandardError => e puts "Error: #{e.message}" nil end lead = { "email" => "example@example.com", "first_name" => "John", "last_name" => "Doe", "company_name" => "Example Inc.", "lt_interest_status" => 1, "campaign" => "0198395a-e6da-74e5-bd47-a5cc88618ed1" } create_lead(lead) ``` -------------------------------- ### Get Custom Tag by ID - Curl Example Source: https://developer.instantly.ai/api/v2/customtag Example of how to fetch a specific custom tag by its ID using curl. ```curl curl -i -X GET \ https://api.instantly.ai/api/v2/custom-tags/0198395b-04d9-7287-a47f-45f5228b51f6 \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Ruby Example - Create Lead Source: https://developer.instantly.ai/api/v2/lead/bulkassignleads Example Ruby code using the 'net/http' library to create a lead via the Instantly AI API. It demonstrates setting headers and sending a JSON payload. ```ruby require 'net/http' require 'uri' require 'json' def create_lead(lead_data) uri = URI.parse('https://api.instantly.ai/api/v2/leads') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.request_uri) request['Authorization'] = 'Bearer ' request['Content-Type'] = 'application/json' request.body = lead_data.to_json response = http.request(request) puts "HTTP Status: #{response.code}" puts "Response Body: #{response.body}" JSON.parse(response.body) if response.is_a?(Net::HTTPSuccess) rescue StandardError => e puts "Error: #{e.message}" nil end lead = { "email" => "example@example.com", "first_name" => "John", "last_name" => "Doe", "company_name" => "Example Inc.", "lt_interest_status" => 1, "campaign" => "0198395a-e6da-74e5-bd47-a5cc88618ed1" } create_lead(lead) ``` -------------------------------- ### Get Custom Tag by ID - Curl Example Source: https://developer.instantly.ai/api/v2/customtag/listcustomtag Example of how to fetch a specific custom tag by its ID using curl. ```curl curl -i -X GET \ https://api.instantly.ai/api/v2/custom-tags/0198395b-04d9-7287-a47f-45f5228b51f6 \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Ruby Example - Create Lead Source: https://developer.instantly.ai/api/v2/lead/moveleads Example Ruby code using the 'net/http' library to create a lead via the Instantly AI API. It demonstrates setting headers and sending a JSON payload. ```ruby require 'net/http' require 'uri' require 'json' def create_lead(lead_data) uri = URI.parse('https://api.instantly.ai/api/v2/leads') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.request_uri) request['Authorization'] = 'Bearer ' request['Content-Type'] = 'application/json' request.body = lead_data.to_json response = http.request(request) puts "HTTP Status: #{response.code}" puts "Response Body: #{response.body}" JSON.parse(response.body) if response.is_a?(Net::HTTPSuccess) rescue StandardError => e puts "Error: #{e.message}" nil end lead = { "email" => "example@example.com", "first_name" => "John", "last_name" => "Doe", "company_name" => "Example Inc.", "lt_interest_status" => 1, "campaign" => "0198395a-e6da-74e5-bd47-a5cc88618ed1" } create_lead(lead) ``` -------------------------------- ### Get Custom Tag by ID - Curl Example Source: https://developer.instantly.ai/api/v2/customtag/deletecustomtag Example of how to fetch a specific custom tag by its ID using curl. ```curl curl -i -X GET \ https://api.instantly.ai/api/v2/custom-tags/0198395b-04d9-7287-a47f-45f5228b51f6 \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Get Custom Tag by ID - Curl Example Source: https://developer.instantly.ai/api/v2/customtag/createcustomtag Example of how to fetch a specific custom tag by its ID using curl. ```curl curl -i -X GET \ https://api.instantly.ai/api/v2/custom-tags/0198395b-04d9-7287-a47f-45f5228b51f6 \ -H 'Authorization: Bearer ' ``` -------------------------------- ### C# Example - Create Lead Source: https://developer.instantly.ai/api/v2/lead/getlead Example C# code using HttpClient to create a lead via the Instantly AI API. It demonstrates setting headers and sending a JSON payload. ```csharp using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; public class LeadCreator { public static async Task CreateLeadAsync(string jsonPayload) { using (var client = new HttpClient()) { client.DefaultRequestHeaders.Add("Authorization", "Bearer "); client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json"); var response = await client.PostAsync("https://api.instantly.ai/api/v2/leads", content); if (response.IsSuccessStatusCode) { var responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } else { Console.WriteLine($"Error: {response.StatusCode}"); var errorBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(errorBody); } } } public static async Task Main(string[] args) { string leadJson = @"{ \"email\": \"example@example.com\", \"first_name\": \"John\", \"last_name\": \"Doe\", \"company_name\": \"Example Inc.\", \"lt_interest_status\": 1, \"campaign\": \"0198395a-e6da-74e5-bd47-a5cc88618ed1\" }"; await CreateLeadAsync(leadJson); } } ``` -------------------------------- ### Ruby Example - Create Lead Source: https://developer.instantly.ai/api/v2/lead/createlead Example Ruby code using the 'net/http' library to create a lead via the Instantly AI API. It demonstrates setting headers and sending a JSON payload. ```ruby require 'net/http' require 'uri' require 'json' def create_lead(lead_data) uri = URI.parse('https://api.instantly.ai/api/v2/leads') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.request_uri) request['Authorization'] = 'Bearer ' request['Content-Type'] = 'application/json' request.body = lead_data.to_json response = http.request(request) puts "HTTP Status: #{response.code}" puts "Response Body: #{response.body}" JSON.parse(response.body) if response.is_a?(Net::HTTPSuccess) rescue StandardError => e puts "Error: #{e.message}" nil end lead = { "email" => "example@example.com", "first_name" => "John", "last_name" => "Doe", "company_name" => "Example Inc.", "lt_interest_status" => 1, "campaign" => "0198395a-e6da-74e5-bd47-a5cc88618ed1" } create_lead(lead) ``` -------------------------------- ### Curl Example: Get Lead Label Source: https://developer.instantly.ai/api/v2/leadlabel/listleadlabel Example using curl to fetch a specific lead label by its ID from the Instantly API. ```curl curl -i -X GET \ https://api.instantly.ai/api/v2/lead-labels/0198395b-050b-70bf-8231-6334c56df50e \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Ruby Example - Create Lead Source: https://developer.instantly.ai/api/v2/lead/mergeleads Example Ruby code using the 'net/http' library to create a lead via the Instantly AI API. It demonstrates setting headers and sending a JSON payload. ```ruby require 'net/http' require 'uri' require 'json' def create_lead(lead_data) uri = URI.parse('https://api.instantly.ai/api/v2/leads') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.request_uri) request['Authorization'] = 'Bearer ' request['Content-Type'] = 'application/json' request.body = lead_data.to_json response = http.request(request) puts "HTTP Status: #{response.code}" puts "Response Body: #{response.body}" JSON.parse(response.body) if response.is_a?(Net::HTTPSuccess) rescue StandardError => e puts "Error: #{e.message}" nil end lead = { "email" => "example@example.com", "first_name" => "John", "last_name" => "Doe", "company_name" => "Example Inc.", "lt_interest_status" => 1, "campaign" => "0198395a-e6da-74e5-bd47-a5cc88618ed1" } create_lead(lead) ``` -------------------------------- ### Curl Example: Get Lead Label Source: https://developer.instantly.ai/api/v2/leadlabel/deleteleadlabel Example using curl to fetch a specific lead label by its ID from the Instantly API. ```curl curl -i -X GET \ https://api.instantly.ai/api/v2/lead-labels/0198395b-050b-70bf-8231-6334c56df50e \ -H 'Authorization: Bearer ' ```