### Get SCIM Configuration Example Source: https://developers.frontegg.com/api/overview/scim/scim-configurations/scim2connectionconfigcontroller_create Example cURL command to retrieve a SCIM configuration by its ID. ```cURL curl -i -X GET \ 'https://api.frontegg.com/directory/resources/v1/configurations/scim2/{id}' ``` -------------------------------- ### Get SCIM Configuration Example Source: https://developers.frontegg.com/api/overview/scim/scim-configurations/scim2connectionconfigcontroller_fetchbyid Example cURL command to retrieve a SCIM configuration by its ID. ```cURL curl -i -X GET \ 'https://api.frontegg.com/directory/resources/v1/configurations/scim2/{id}' ``` -------------------------------- ### Get User's Tenants GO Example Source: https://developers.frontegg.com/api/overview/identity/user-management/userscontrollerv3_getuserprofile Example Go code demonstrating how to make a GET request to retrieve the list of tenants for the logged-in user, including setting the Authorization and Frontegg-User-ID headers. ```go package main import ( "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { jwtToken := "" userId := "string" url := "https://api.frontegg.com/identity/resources/users/v2/me/tenants" client := &http.Client{} req, err := http.NewRequest("GET", url, nil) if err != nil { fmt.Printf("Error creating request: %s\n", err) return } req.Header.Add("Authorization", "Bearer "+jwtToken) req.Header.Add("frontegg-user-id", userId) resp, err := client.Do(req) if err != nil { fmt.Printf("Error sending request: %s\n", err) return } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Printf("Error reading response body: %s\n", err) return } if resp.StatusCode != http.StatusOK { fmt.Printf("HTTP error! Status: %d, Body: %s\n", resp.StatusCode, string(body)) return } // Assuming the response is a JSON array of objects with tenantId and name var tenants []map[string]string err = json.Unmarshal(body, &tenants) if err != nil { fmt.Printf("Error unmarshalling response: %s\n", err) return } fmt.Println("User Tenants:") for _, tenant := range tenants { fmt.Printf(" ID: %s, Name: %s\n", tenant["tenantId"], tenant["name"]) } } ``` -------------------------------- ### Frontegg API - cURL Examples Source: https://developers.frontegg.com/api/overview/identity/email-configuration Provides cURL examples for interacting with Frontegg API endpoints, including GET for mail configuration and POST for creating/updating mail configurations. ```cURL curl -i -X GET \ https://api.frontegg.com/identity/resources/mail/v1/configurations \ -H 'Authorization: Bearer ' ``` ```cURL curl -i -X POST \ https://api.frontegg.com/identity/resources/mail/v2/configurations \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ -d '{ "payload": { "provider": "sendgrid", "secret": "string" } }' ``` -------------------------------- ### Get Audit Metrics cURL Example Source: https://developers.frontegg.com/api/overview/audits/metrics/metricscontroller_getmetrics Example of how to call the Get Audit Metrics API endpoint using cURL. It demonstrates the GET request method, the endpoint URL, and the required Authorization header. ```cURL curl -i -X GET \ https://api.frontegg.com/audits/resources/metrics/v1 \ -H "Authorization: Bearer " ``` -------------------------------- ### Install Frontegg TypeScript SDK Source: https://developers.frontegg.com/api/overview/overview Installs the Frontegg SDK from its OpenAPI specification URL using the `api` command-line tool. This generates a typed client library for easier integration with Frontegg APIs. ```shell npx api install https://github.com/frontegg/openapi-public/blob/master/apis-combined.json ``` -------------------------------- ### Get Audit Metrics - cURL Example Source: https://developers.frontegg.com/api/overview/audits/metrics Example of how to retrieve audit metrics using cURL, including the GET method, endpoint, and authorization header. ```cURL curl -i -X GET \ https://api.frontegg.com/audits/resources/metrics/v1 \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Retrieve All Routes - GO Example Source: https://developers.frontegg.com/api/overview/entitlements/api-access-control/routescontrollerv1_create Example using Go's 'net/http' package to fetch all configured routes from the Frontegg API. Demonstrates setting the Authorization header. ```GO package main import ( "encoding/json" "fmt" "io/ioutil" "log" "net/http" "strings" ) func getAllRoutes() { token := "" url := "https://api.frontegg.com/entitlements/resources/routes/v1" client := &http.Client{} req, err := http.NewRequest("GET", url, nil) if err != nil { log.Fatalf("Failed to create request: %v", err) } req.Header.Add("Authorization", "Bearer "+token) res, err := client.Do(req) if err != nil { log.Fatalf("Failed to execute request: %v", err) } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { log.Fatalf("Failed to read response body: %v", err) } if res.StatusCode != http.StatusOK { log.Fatalf("API request failed with status code %d: %s", res.StatusCode, string(body)) } var routes []map[string]interface{} if err := json.Unmarshal(body, &routes); err != nil { log.Fatalf("Failed to unmarshal response: %v", err) } fmt.Println(routes) } func main() { getAllRoutes() } ``` -------------------------------- ### GO Example: Create Plan Source: https://developers.frontegg.com/api/overview/entitlements/plans/planscontrollerv1_gettenantplans Example Go code snippet to create a new plan using the Frontegg API, demonstrating how to structure the request body and make the API call. ```go package main import ( "bytes" "encoding/json" "fmt" "net/http" ) type RuleConditionValue struct { List []string `json:"list"` } type RuleCondition struct { Attribute string `json:"attribute"` AttributeType string `json:"attributeType"` Negate bool `json:"negate"` Op string `json:"op"` Value RuleConditionValue `json:"value"` } type Rule struct { Description string `json:"description"` ConditionLogic string `json:"conditionLogic"` Conditions []RuleCondition `json:"conditions"` Treatment string `json:"treatment"` } type PlanRequest struct { Name string `json:"name"` DefaultTreatment string `json:"defaultTreatment,omitempty"` Rules []Rule `json:"rules,omitempty"` Description string `json:"description,omitempty"` Metadata string `json:"metadata,omitempty"` DefaultTimeLimitation int `json:"defaultTimeLimitation,omitempty"` AssignOnSignup bool `json:"assignOnSignup,omitempty"` FeatureKeys []string `json:"featureKeys,omitempty"` } func main() { planData := PlanRequest{ Name: "Test Plan", DefaultTreatment: "true", Rules: []Rule{ { Description: "This is the first rule", ConditionLogic: "and", Conditions: []RuleCondition{ { Attribute: "myCustomAttribute", AttributeType: "custom", Negate: false, Op: "in_list", Value: RuleConditionValue{ List: []string{"valueA", "valueB"}, }, }, }, Treatment: "true", }, }, Description: "This is a test plan", Metadata: `{ "some-key": "some-value" }`, DefaultTimeLimitation: 30, AssignOnSignup: true, FeatureKeys: []string{"my-cool-feature"}, } jsonData, err := json.Marshal(planData) if err != nil { fmt.Println("Error marshalling JSON:", err) return } url := "https://api.frontegg.com/entitlements/resources/plans/v1" req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { fmt.Println("Error creating request:", err) return } req.Header.Set("Authorization", "Bearer ") req.Header.Set("Content-Type", "application/json") client := &http.Client{} // resp, err := client.Do(req) // if err != nil { // fmt.Println("Error sending request:", err) // return // } // defer resp.Body.Close() // fmt.Println("Response Status:", resp.Status) // var result map[string]interface{} // json.NewDecoder(resp.Body).Decode(&result) // fmt.Println("Response Body:", result) fmt.Println("Request prepared. Uncomment client.Do to send.") } ``` -------------------------------- ### Get Audit Metrics Python Example Source: https://developers.frontegg.com/api/overview/audits/metrics/metricscontroller_getmetrics Example of how to call the Get Audit Metrics API endpoint using Python's requests library. It demonstrates making a GET request with the necessary authorization header. ```python import requests url = "https://api.frontegg.com/audits/resources/metrics/v1" headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } params = { "from": 1678886400, # Example timestamp "to": 1678972800 # Example timestamp } response = requests.get(url, headers=headers, params=params) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code}") ``` -------------------------------- ### Get MFA Strategies cURL Example Source: https://developers.frontegg.com/api/overview/identity/mfa-settings/securitypolicycontroller_getsecuritypolicy Example of how to retrieve MFA strategies using cURL, demonstrating the GET request with authorization. ```curl curl -i -X GET \ https://api.frontegg.com/identity/resources/configurations/v1/mfa/strategies \ -H 'Authorization: Bearer ' ``` -------------------------------- ### GO Example: Create Plan Source: https://developers.frontegg.com/api/overview/entitlements/plans/planscontrollerv1_getplans Example Go code snippet to create a new plan using the Frontegg API, demonstrating how to structure the request body and make the API call. ```go package main import ( "bytes" "encoding/json" "fmt" "net/http" ) type RuleConditionValue struct { List []string `json:"list"` } type RuleCondition struct { Attribute string `json:"attribute"` AttributeType string `json:"attributeType"` Negate bool `json:"negate"` Op string `json:"op"` Value RuleConditionValue `json:"value"` } type Rule struct { Description string `json:"description"` ConditionLogic string `json:"conditionLogic"` Conditions []RuleCondition `json:"conditions"` Treatment string `json:"treatment"` } type PlanRequest struct { Name string `json:"name"` DefaultTreatment string `json:"defaultTreatment,omitempty"` Rules []Rule `json:"rules,omitempty"` Description string `json:"description,omitempty"` Metadata string `json:"metadata,omitempty"` DefaultTimeLimitation int `json:"defaultTimeLimitation,omitempty"` AssignOnSignup bool `json:"assignOnSignup,omitempty"` FeatureKeys []string `json:"featureKeys,omitempty"` } func main() { planData := PlanRequest{ Name: "Test Plan", DefaultTreatment: "true", Rules: []Rule{ { Description: "This is the first rule", ConditionLogic: "and", Conditions: []RuleCondition{ { Attribute: "myCustomAttribute", AttributeType: "custom", Negate: false, Op: "in_list", Value: RuleConditionValue{ List: []string{"valueA", "valueB"}, }, }, }, Treatment: "true", }, }, Description: "This is a test plan", Metadata: `{ "some-key": "some-value" }`, DefaultTimeLimitation: 30, AssignOnSignup: true, FeatureKeys: []string{"my-cool-feature"}, } jsonData, err := json.Marshal(planData) if err != nil { fmt.Println("Error marshalling JSON:", err) return } url := "https://api.frontegg.com/entitlements/resources/plans/v1" req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { fmt.Println("Error creating request:", err) return } req.Header.Set("Authorization", "Bearer ") req.Header.Set("Content-Type", "application/json") client := &http.Client{} // resp, err := client.Do(req) // if err != nil { // fmt.Println("Error sending request:", err) // return // } // defer resp.Body.Close() // fmt.Println("Response Status:", resp.Status) // var result map[string]interface{} // json.NewDecoder(resp.Body).Decode(&result) // fmt.Println("Response Body:", result) fmt.Println("Request prepared. Uncomment client.Do to send.") } ``` -------------------------------- ### GO Example: Create Plan Source: https://developers.frontegg.com/api/overview/entitlements/plans Example Go code snippet to create a new plan using the Frontegg API, demonstrating how to structure the request body and make the API call. ```go package main import ( "bytes" "encoding/json" "fmt" "net/http" ) type RuleConditionValue struct { List []string `json:"list"` } type RuleCondition struct { Attribute string `json:"attribute"` AttributeType string `json:"attributeType"` Negate bool `json:"negate"` Op string `json:"op"` Value RuleConditionValue `json:"value"` } type Rule struct { Description string `json:"description"` ConditionLogic string `json:"conditionLogic"` Conditions []RuleCondition `json:"conditions"` Treatment string `json:"treatment"` } type PlanRequest struct { Name string `json:"name"` DefaultTreatment string `json:"defaultTreatment,omitempty"` Rules []Rule `json:"rules,omitempty"` Description string `json:"description,omitempty"` Metadata string `json:"metadata,omitempty"` DefaultTimeLimitation int `json:"defaultTimeLimitation,omitempty"` AssignOnSignup bool `json:"assignOnSignup,omitempty"` FeatureKeys []string `json:"featureKeys,omitempty"` } func main() { planData := PlanRequest{ Name: "Test Plan", DefaultTreatment: "true", Rules: []Rule{ { Description: "This is the first rule", ConditionLogic: "and", Conditions: []RuleCondition{ { Attribute: "myCustomAttribute", AttributeType: "custom", Negate: false, Op: "in_list", Value: RuleConditionValue{ List: []string{"valueA", "valueB"}, }, }, }, Treatment: "true", }, }, Description: "This is a test plan", Metadata: `{ "some-key": "some-value" }`, DefaultTimeLimitation: 30, AssignOnSignup: true, FeatureKeys: []string{"my-cool-feature"}, } jsonData, err := json.Marshal(planData) if err != nil { fmt.Println("Error marshalling JSON:", err) return } url := "https://api.frontegg.com/entitlements/resources/plans/v1" req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { fmt.Println("Error creating request:", err) return } req.Header.Set("Authorization", "Bearer ") req.Header.Set("Content-Type", "application/json") client := &http.Client{} // resp, err := client.Do(req) // if err != nil { // fmt.Println("Error sending request:", err) // return // } // defer resp.Body.Close() // fmt.Println("Response Status:", resp.Status) // var result map[string]interface{} // json.NewDecoder(resp.Body).Decode(&result) // fmt.Println("Response Body:", result) fmt.Println("Request prepared. Uncomment client.Do to send.") } ``` -------------------------------- ### Get MFA Policy cURL Example Source: https://developers.frontegg.com/api/overview/identity/mfa-settings/securitypolicycontroller_getsecuritypolicy Example of how to retrieve the MFA policy using cURL, demonstrating the GET request with authorization. ```curl curl -i -X GET \ https://api.frontegg.com/identity/resources/configurations/v1/mfa-policy \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Get Audit Metrics - GO Example Source: https://developers.frontegg.com/api/overview/audits/metrics Example of how to retrieve audit metrics using Go's net/http package, including the GET method, endpoint, and authorization header. ```GO package main import ( "fmt" "io/ioutil" "net/http" "strings" ) func getAuditMetrics(token string) ([]byte, error) { url := "https://api.frontegg.com/audits/resources/metrics/v1" req, err := http.NewRequest("GET", url, nil) if err != nil { return nil, fmt.Errorf("failed to create request: %w", err) } req.Header.Set("Authorization", "Bearer "+token) client := &http.Client{} resp, err := client.Do(req) if err != nil { return nil, fmt.Errorf("failed to execute request: %w", err) } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { bodyBytes, _ := ioutil.ReadAll(resp.Body) return nil, fmt.Errorf("request failed with status %d: %s", resp.StatusCode, string(bodyBytes)) } bodyBytes, err := ioutil.ReadAll(resp.Body) if err != nil { return nil, fmt.Errorf("failed to read response body: %w", err) } return bodyBytes, nil } // Example usage: // func main() { // userToken := "" // metricsData, err := getAuditMetrics(userToken) // if err != nil { // fmt.Printf("Error fetching audit metrics: %v\n", err) // return // } // fmt.Println(string(metricsData)) // } ``` -------------------------------- ### Retrieve All Routes - GO Example Source: https://developers.frontegg.com/api/overview/entitlements/api-access-control/routescontrollerv1_getmany Example using Go's 'net/http' package to fetch all configured routes from the Frontegg API. Demonstrates setting the Authorization header. ```GO package main import ( "encoding/json" "fmt" "io/ioutil" "log" "net/http" "strings" ) func getAllRoutes() { token := "" url := "https://api.frontegg.com/entitlements/resources/routes/v1" client := &http.Client{} req, err := http.NewRequest("GET", url, nil) if err != nil { log.Fatalf("Failed to create request: %v", err) } req.Header.Add("Authorization", "Bearer "+token) res, err := client.Do(req) if err != nil { log.Fatalf("Failed to execute request: %v", err) } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { log.Fatalf("Failed to read response body: %v", err) } if res.StatusCode != http.StatusOK { log.Fatalf("API request failed with status code %d: %s", res.StatusCode, string(body)) } var routes []map[string]interface{} if err := json.Unmarshal(body, &routes); err != nil { log.Fatalf("Failed to unmarshal response: %v", err) } fmt.Println(routes) } func main() { getAllRoutes() } ``` -------------------------------- ### Get Audit Metrics - Python Example Source: https://developers.frontegg.com/api/overview/audits/metrics Example of how to retrieve audit metrics using Python's requests library, including the GET method, endpoint, and authorization header. ```Python import requests def get_audit_metrics(token): url = 'https://api.frontegg.com/audits/resources/metrics/v1' headers = { 'Authorization': f'Bearer {token}' } response = requests.get(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes return response.json() # Example usage: # user_token = '' # try: # metrics_data = get_audit_metrics(user_token) # print(metrics_data) # except requests.exceptions.RequestException as e: # print(f'Error fetching audit metrics: {e}') ``` -------------------------------- ### Retrieve All Routes - GO Example Source: https://developers.frontegg.com/api/overview/entitlements/api-access-control Example using Go's 'net/http' package to fetch all configured routes from the Frontegg API. Demonstrates setting the Authorization header. ```GO package main import ( "encoding/json" "fmt" "io/ioutil" "log" "net/http" "strings" ) func getAllRoutes() { token := "" url := "https://api.frontegg.com/entitlements/resources/routes/v1" client := &http.Client{} req, err := http.NewRequest("GET", url, nil) if err != nil { log.Fatalf("Failed to create request: %v", err) } req.Header.Add("Authorization", "Bearer "+token) res, err := client.Do(req) if err != nil { log.Fatalf("Failed to execute request: %v", err) } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { log.Fatalf("Failed to read response body: %v", err) } if res.StatusCode != http.StatusOK { log.Fatalf("API request failed with status code %d: %s", res.StatusCode, string(body)) } var routes []map[string]interface{} if err := json.Unmarshal(body, &routes); err != nil { log.Fatalf("Failed to unmarshal response: %v", err) } fmt.Println(routes) } func main() { getAllRoutes() } ``` -------------------------------- ### Get Audit Metrics - JavaScript Example Source: https://developers.frontegg.com/api/overview/audits/metrics Example of how to retrieve audit metrics using JavaScript's fetch API, including the GET method, endpoint, and authorization header. ```JavaScript async function getAuditMetrics(token) { const url = 'https://api.frontegg.com/audits/resources/metrics/v1'; const response = await fetch(url, { method: 'GET', headers: { 'Authorization': `Bearer ${token}` } }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } return await response.json(); } // Example usage: // const userToken = ''; // getAuditMetrics(userToken) // .then(data => console.log(data)) // .catch(error => console.error('Error fetching audit metrics:', error)); ``` -------------------------------- ### Go Example for Environment Authentication Source: https://developers.frontegg.com/api/overview/vendor-service/other/authenticate_vendor Shows a Go example for authenticating with the Frontegg environment API, making a POST request with the client ID and secret. ```go package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) type AuthRequest struct { ClientID string `json:"clientId"` Secret string `json:"secret"` } type AuthResponse struct { Token string `json:"token"` ExpiresIn int `json:"expiresIn"` } func authenticateEnvironment(clientID, secret string) (*AuthResponse, error) { url := "https://api.frontegg.com/auth/vendor/" requestBody, err := json.Marshal(AuthRequest{ClientID: clientID, Secret: secret}) if err != nil { return nil, fmt.Errorf("failed to marshal request body: %w", err) } resp, err := http.Post(url, "application/json", bytes.NewBuffer(requestBody)) if err != nil { return nil, fmt.Errorf("authentication request failed: %w", err) } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { bodyBytes, _ := ioutil.ReadAll(resp.Body) return nil, fmt.Errorf("authentication failed with status %d: %s", resp.StatusCode, string(bodyBytes)) } var authResponse AuthResponse err = json.NewDecoder(resp.Body).Decode(&authResponse) if err != nil { return nil, fmt.Errorf("failed to decode response body: %w", err) } return &authResponse, nil } ``` -------------------------------- ### Get Current User Phone Numbers (cURL Example) Source: https://developers.frontegg.com/api/overview/identity/sms/userphonenumberscontrollerv1_getuserownphonenumbers Example using cURL to retrieve all phone numbers associated with the current authenticated user via a GET request. ```curl curl -i -X GET \ https://api.frontegg.com/identity/resources/users/phone-numbers/v1/me \ -H 'Authorization: Bearer ' \ -H 'frontegg-user-id: string' ``` -------------------------------- ### JavaScript Example: Create Plan Source: https://developers.frontegg.com/api/overview/entitlements/plans/planscontrollerv1_getplans Example JavaScript code snippet to create a new plan using the Frontegg API, demonstrating how to structure the request body. ```javascript const planData = { name: "Test Plan", defaultTreatment: "true", rules: [ { description: "This is the first rule", conditionLogic: "and", conditions: [ { attribute: "myCustomAttribute", attributeType: "custom", negate: false, op: "in_list", value: { list: [ "valueA", "valueB" ] } } ], treatment: "true" } ], description: "This is a test plan", metadata: '{ "some-key": "some-value" }', defaultTimeLimitation: 30, assignOnSignup: true, featureKeys: ["my-cool-feature"] }; // Example using fetch API (replace with your actual API client or library) /* fetch('https://api.frontegg.com/entitlements/resources/plans/v1', { method: 'POST', headers: { 'Authorization': 'Bearer ', 'Content-Type': 'application/json' }, body: JSON.stringify(planData) }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); */ ``` -------------------------------- ### Get Sub-Accounts (Tenants) - cURL Example Source: https://developers.frontegg.com/api/overview/tenants/sub-accounts/subtenantcontrollerv1_deletesubtenant Example cURL command to retrieve all sub-accounts. It sends a GET request to the hierarchy endpoint with authorization and tenant ID headers. ```cURL curl -i -X GET \ https://api.frontegg.com/tenants/resources/hierarchy/v1 \ -H 'Authorization: Bearer ' \ -H 'frontegg-tenant-id: string' ``` -------------------------------- ### JavaScript Example: Create Plan Source: https://developers.frontegg.com/api/overview/entitlements/plans/planscontrollerv1_gettenantplans Example JavaScript code snippet to create a new plan using the Frontegg API, demonstrating how to structure the request body. ```javascript const planData = { name: "Test Plan", defaultTreatment: "true", rules: [ { description: "This is the first rule", conditionLogic: "and", conditions: [ { attribute: "myCustomAttribute", attributeType: "custom", negate: false, op: "in_list", value: { list: [ "valueA", "valueB" ] } } ], treatment: "true" } ], description: "This is a test plan", metadata: '{ "some-key": "some-value" }', defaultTimeLimitation: 30, assignOnSignup: true, featureKeys: ["my-cool-feature"] }; // Example using fetch API (replace with your actual API client or library) /* fetch('https://api.frontegg.com/entitlements/resources/plans/v1', { method: 'POST', headers: { 'Authorization': 'Bearer ', 'Content-Type': 'application/json' }, body: JSON.stringify(planData) }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); */ ``` -------------------------------- ### cURL Example: Create Plan Source: https://developers.frontegg.com/api/overview/entitlements/plans/planscontrollerv1_getplans Example cURL command to create a new plan with specified details, including name, default treatment, rules, and feature keys. ```curl curl -i -X POST \ https://api.frontegg.com/entitlements/resources/plans/v1 \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ -d '{ \ "name": "Test Plan", \ "defaultTreatment": "true", \ "rules": [ \ { \ "description": "This is the first rule", \ "conditionLogic": "and", \ "conditions": [ \ { \ "attribute": "myCustomAttribute", \ "attributeType": "custom", \ "negate": false, \ "op": "in_list", \ "value": { \ "list": [ \ "valueA", \ "valueB" \ ] \ } \ } \ ], \ "treatment": "true" \ } \ ], \ "description": "This is a test plan", \ "metadata": "{ \"some-key\": \"some-value\" }", \ "defaultTimeLimitation": "30", \ "assignOnSignup": "true", \ "featureKeys": "[\"my-cool-feature\"]" \ }' ``` -------------------------------- ### cURL: Get User Access Tokens Example Source: https://developers.frontegg.com/api/overview/identity/personal-tokens Example cURL command to retrieve all access tokens for a specific user, showing the GET request method, endpoint, and required headers. ```curl curl -i -X GET \ https://api.frontegg.com/identity/resources/users/access-tokens/v1 \ -H 'Authorization: Bearer ' \ -H 'frontegg-tenant-id: string' \ -H 'frontegg-user-id: string' ``` -------------------------------- ### Get Parent Accounts cURL Example Source: https://developers.frontegg.com/api/overview/tenants/sub-accounts/tenanthierarchycontrollerv1_getsubtenants Example cURL command to retrieve parent accounts from the Frontegg hierarchy. It demonstrates the GET request, endpoint, and necessary authentication headers. ```curl curl -i -X GET \ https://api.frontegg.com/tenants/resources/hierarchy/v1/parents \ -H 'Authorization: Bearer ' \ -H 'frontegg-tenant-id: string' ``` -------------------------------- ### cURL Example: Create Plan Source: https://developers.frontegg.com/api/overview/entitlements/plans/planscontrollerv1_gettenantplans Example cURL command to create a new plan with specified details, including name, default treatment, rules, and feature keys. ```curl curl -i -X POST \ https://api.frontegg.com/entitlements/resources/plans/v1 \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ -d '{ \ "name": "Test Plan", \ "defaultTreatment": "true", \ "rules": [ \ { \ "description": "This is the first rule", \ "conditionLogic": "and", \ "conditions": [ \ { \ "attribute": "myCustomAttribute", \ "attributeType": "custom", \ "negate": false, \ "op": "in_list", \ "value": { \ "list": [ \ "valueA", \ "valueB" \ ] \ } \ } \ ], \ "treatment": "true" \ } \ ], \ "description": "This is a test plan", \ "metadata": "{ \"some-key\": \"some-value\" }", \ "defaultTimeLimitation": "30", \ "assignOnSignup": "true", \ "featureKeys": "[\"my-cool-feature\"]" \ }' ``` -------------------------------- ### Get Sub-accounts cURL Example Source: https://developers.frontegg.com/api/overview/tenants/sub-accounts/tenanthierarchycontrollerv1_getsubtenants Example cURL command to fetch all sub-accounts using the Frontegg API. It specifies the GET method, endpoint, and required authorization and tenant ID headers. ```curl curl -i -X GET \ https://api.frontegg.com/tenants/resources/hierarchy/v1 \ -H 'Authorization: Bearer ' \ -H 'frontegg-tenant-id: string' ``` -------------------------------- ### Python Example: Create Plan Source: https://developers.frontegg.com/api/overview/entitlements/plans/planscontrollerv1_gettenantplans Example Python code snippet to create a new plan using the Frontegg API, demonstrating how to structure the request body and make the API call. ```python import requests import json plan_data = { "name": "Test Plan", "defaultTreatment": "true", "rules": [ { "description": "This is the first rule", "conditionLogic": "and", "conditions": [ { "attribute": "myCustomAttribute", "attributeType": "custom", "negate": False, "op": "in_list", "value": { "list": [ "valueA", "valueB" ] } } ], "treatment": "true" } ], "description": "This is a test plan", "metadata": '{ "some-key": "some-value" }', "defaultTimeLimitation": 30, "assignOnSignup": True, "featureKeys": ["my-cool-feature"] } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } # Example using requests library (replace with your actual API client or library) # response = requests.post( # 'https://api.frontegg.com/entitlements/resources/plans/v1', # headers=headers, # data=json.dumps(plan_data) # ) # print(response.json()) ``` -------------------------------- ### Frontegg Module API Entry Points Source: https://developers.frontegg.com/api/overview/identity/user-management/userstenantscontrollerv1_enableusertenant Provides links to API documentation for various Frontegg modules, including Single Sign-On, SCIM Provisioning, Entitlements, Accounts, Applications, and Audits. These serve as entry points to more detailed API specifications. ```APIDOC Module API Entry Points: - User sessions: /api/identity/user-sessions - Applications: /api/applications - Users-applications management: /api/identity/users-applications-management - Single sign-on module: /api/team - SCIM provisioning module: /api/scim - Entitlements module: /api/entitlements - Entitlements agent: /api/agent - Accounts module: /api/tenants - Audits module: /api/audits - Users, auth and security module: /api/identity - User management: /api/identity/user-management ``` -------------------------------- ### cURL: Get User Access Tokens Example Source: https://developers.frontegg.com/api/overview/identity/personal-tokens/useraccesstokensv1controller_getuseraccesstokens Example cURL command to retrieve all access tokens for a specific user, showing the GET request method, endpoint, and required headers. ```curl curl -i -X GET \ https://api.frontegg.com/identity/resources/users/access-tokens/v1 \ -H 'Authorization: Bearer ' \ -H 'frontegg-tenant-id: string' \ -H 'frontegg-user-id: string' ``` -------------------------------- ### Frontegg API - GO Examples Source: https://developers.frontegg.com/api/overview/identity/email-configuration Provides GO examples for interacting with Frontegg API endpoints, demonstrating HTTP requests for mail configuration operations. ```GO package main import ( "fmt" "io/ioutil" "net/http" ) func main() { // Example for GET /resources/mail/v1/configurations client := &http.Client{} req, err := http.NewRequest("GET", "https://api.frontegg.com/identity/resources/mail/v1/configurations", nil) if err != nil { fmt.Println("Error creating request:", err) return } req.Header.Add("Authorization", "Bearer ") resp, err := client.Do(req) if err != nil { fmt.Println("Error sending request:", err) return } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println("Error reading response body:", err) return } fmt.Println("Response Status:", resp.Status) fmt.Println("Response Body:", string(body)) } ``` ```GO package main import ( "bytes" "fmt" "io/ioutil" "net/http" ) func main() { // Example for POST /resources/mail/v2/configurations client := &http.Client{} jsonBody := []byte(`{ "payload": { "provider": "sendgrid", "secret": "string" } }`) req, err := http.NewRequest("POST", "https://api.frontegg.com/identity/resources/mail/v2/configurations", bytes.NewBuffer(jsonBody)) if err != nil { fmt.Println("Error creating request:", err) return } req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { fmt.Println("Error sending request:", err) return } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println("Error reading response body:", err) return } fmt.Println("Response Status:", resp.Status) fmt.Println("Response Body:", string(body)) } ``` -------------------------------- ### cURL: Get User Access Tokens Example Source: https://developers.frontegg.com/api/overview/identity/personal-tokens/useraccesstokensv1controller_createuseraccesstoken Example cURL command to retrieve all access tokens for a specific user, showing the GET request method, endpoint, and required headers. ```curl curl -i -X GET \ https://api.frontegg.com/identity/resources/users/access-tokens/v1 \ -H 'Authorization: Bearer ' \ -H 'frontegg-tenant-id: string' \ -H 'frontegg-user-id: string' ``` -------------------------------- ### JavaScript Example: Create Plan Source: https://developers.frontegg.com/api/overview/entitlements/plans Example JavaScript code snippet to create a new plan using the Frontegg API, demonstrating how to structure the request body. ```javascript const planData = { name: "Test Plan", defaultTreatment: "true", rules: [ { description: "This is the first rule", conditionLogic: "and", conditions: [ { attribute: "myCustomAttribute", attributeType: "custom", negate: false, op: "in_list", value: { list: [ "valueA", "valueB" ] } } ], treatment: "true" } ], description: "This is a test plan", metadata: '{ "some-key": "some-value" }', defaultTimeLimitation: 30, assignOnSignup: true, featureKeys: ["my-cool-feature"] }; // Example using fetch API (replace with your actual API client or library) /* fetch('https://api.frontegg.com/entitlements/resources/plans/v1', { method: 'POST', headers: { 'Authorization': 'Bearer ', 'Content-Type': 'application/json' }, body: JSON.stringify(planData) }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); */ ``` -------------------------------- ### cURL Example for Get Feature Flag Source: https://developers.frontegg.com/api/overview/entitlements/feature-flags/featureflagscontrollerv1_updatefeatureflag Example of how to retrieve a feature flag using cURL. It demonstrates the GET request method, the endpoint URL, and the required Authorization header with a bearer token. ```curl curl -i -X GET \ 'https://api.frontegg.com/entitlements/resources/feature-flags/v1/{id}' \ -H 'Authorization: Bearer ' ``` -------------------------------- ### cURL Example: Activate User Source: https://developers.frontegg.com/api/overview/identity/user-management/usersactivationcontrollerv1_activateuserwithcode Example cURL command to activate a user via the Frontegg API. Demonstrates POST request with necessary headers and JSON payload. ```cURL curl -i -X POST \ https://api.frontegg.com/identity/resources/users/v1/activate \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ -H 'frontegg-vendor-host: string' \ -d '{ \ "userId": "string", \ "token": "string", \ "password": "string", \ "recaptchaToken": "string", \ "lastTermsCheck": "string" \ }' ``` -------------------------------- ### Make User Super-User Example (GO) Source: https://developers.frontegg.com/api/overview/identity/users/userscontrollerv1_updateusertenantforvendor Example of how to use Go (net/http) to make a user a super-user. ```go package main import ( "bytes" "encoding/json" "fmt" "net/http" ) func main() { userId := "your_user_id" token := "" url := fmt.Sprintf("https://api.frontegg.com/identity/resources/users/v1/%s/superuser", userId) requestBody, _ := json.Marshal(map[string]bool{ "superUser": true, }) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(requestBody)) if err != nil { fmt.Println("Error creating request:", err) return } req.Header.Set("Authorization", "Bearer "+token) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, err := client.Do(req) if err != nil { fmt.Println("Error sending request:", err) return } defer resp.Body.Close() var result map[string]interface{} json.NewDecoder(resp.Body).Decode(&result) fmt.Println(result) } ``` -------------------------------- ### cURL Example for Get Feature Flag Source: https://developers.frontegg.com/api/overview/entitlements/feature-flags/featureflagscontrollerv1_getsinglefeatureflag Example of how to retrieve a feature flag using cURL. It demonstrates the GET request method, the endpoint URL, and the required Authorization header with a bearer token. ```curl curl -i -X GET \ 'https://api.frontegg.com/entitlements/resources/feature-flags/v1/{id}' \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Python Example: Create Plan Source: https://developers.frontegg.com/api/overview/entitlements/plans/planscontrollerv1_getplans Example Python code snippet to create a new plan using the Frontegg API, demonstrating how to structure the request body and make the API call. ```python import requests import json plan_data = { "name": "Test Plan", "defaultTreatment": "true", "rules": [ { "description": "This is the first rule", "conditionLogic": "and", "conditions": [ { "attribute": "myCustomAttribute", "attributeType": "custom", "negate": False, "op": "in_list", "value": { "list": [ "valueA", "valueB" ] } } ], "treatment": "true" } ], "description": "This is a test plan", "metadata": '{ "some-key": "some-value" }', "defaultTimeLimitation": 30, "assignOnSignup": True, "featureKeys": ["my-cool-feature"] } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } # Example using requests library (replace with your actual API client or library) # response = requests.post( # 'https://api.frontegg.com/entitlements/resources/plans/v1', # headers=headers, # data=json.dumps(plan_data) # ) # print(response.json()) ``` -------------------------------- ### Get Usernames cURL Example Source: https://developers.frontegg.com/api/overview/identity/user-management/userscontrollerv1_searchusers Example cURL command to retrieve usernames for users. ```cURL curl -i -X GET \ https://api.frontegg.com/identity/resources/usernames/v1 \ -H "Authorization: Bearer " ``` -------------------------------- ### Get Account (Tenant) cURL Example Source: https://developers.frontegg.com/api/overview/tenants/accounts/tenantcontrollerv1_updatetenant Example cURL command to fetch account (tenant) details. It specifies the GET method, the resource path with a placeholder for tenantId, and includes the Authorization header with a bearer token. ```curl curl -i -X GET \ 'https://api.frontegg.com/tenants/resources/tenants/v1/{tenantId}' \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Frontegg API - GO Examples Source: https://developers.frontegg.com/api/overview/identity/email-configuration/mailconfigcontroller_getmailconfig Provides GO examples for interacting with Frontegg API endpoints, demonstrating HTTP requests for mail configuration operations. ```GO package main import ( "fmt" "io/ioutil" "net/http" ) func main() { // Example for GET /resources/mail/v1/configurations client := &http.Client{} req, err := http.NewRequest("GET", "https://api.frontegg.com/identity/resources/mail/v1/configurations", nil) if err != nil { fmt.Println("Error creating request:", err) return } req.Header.Add("Authorization", "Bearer ") resp, err := client.Do(req) if err != nil { fmt.Println("Error sending request:", err) return } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println("Error reading response body:", err) return } fmt.Println("Response Status:", resp.Status) fmt.Println("Response Body:", string(body)) } ``` ```GO package main import ( "bytes" "fmt" "io/ioutil" "net/http" ) func main() { // Example for POST /resources/mail/v2/configurations client := &http.Client{} jsonBody := []byte(`{ "payload": { "provider": "sendgrid", "secret": "string" } }`) req, err := http.NewRequest("POST", "https://api.frontegg.com/identity/resources/mail/v2/configurations", bytes.NewBuffer(jsonBody)) if err != nil { fmt.Println("Error creating request:", err) return } req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { fmt.Println("Error sending request:", err) return } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println("Error reading response body:", err) return } fmt.Println("Response Status:", resp.Status) fmt.Println("Response Body:", string(body)) } ```