# Get strategies that reference segment GET https://app.unleash-instance.example.com/api/admin/segments/{id}/strategies Retrieve all strategies that reference the specified segment. Reference: https://docs.getunleash.io/api/get-strategies-by-segment-id ## OpenAPI Specification ```yaml openapi: 3.1.0 info: title: admin-api version: 1.0.0 paths: /api/admin/segments/{id}/strategies: get: operationId: get-strategies-by-segment-id summary: Get strategies that reference segment description: Retrieve all strategies that reference the specified segment. tags: - subpackage_segments parameters: - name: id in: path description: a segment id required: true schema: type: integer - name: Authorization in: header description: API key needed to access this API required: true schema: type: string responses: '200': description: segmentStrategiesSchema content: application/json: schema: $ref: '#/components/schemas/segmentStrategiesSchema' servers: - url: https://app.unleash-instance.example.com components: schemas: SegmentStrategiesSchemaStrategiesItems: type: object properties: id: type: string description: The ID of the strategy featureName: type: string description: The name of the feature flag that this strategy belongs to. projectId: type: string description: The ID of the project that the strategy belongs to. environment: type: string description: The ID of the environment that the strategy belongs to. strategyName: type: string description: The name of the strategy's type. required: - id - featureName - projectId - environment - strategyName title: SegmentStrategiesSchemaStrategiesItems SegmentStrategiesSchemaChangeRequestStrategiesItems: type: object properties: id: type: string description: >- The ID of the strategy. Not present on new strategies that haven't been added to the feature flag yet. featureName: type: string description: The name of the feature flag that this strategy belongs to. projectId: type: string description: The ID of the project that the strategy belongs to. environment: type: string description: The ID of the environment that the strategy belongs to. strategyName: type: string description: The name of the strategy's type. required: - featureName - projectId - environment - strategyName title: SegmentStrategiesSchemaChangeRequestStrategiesItems segmentStrategiesSchema: type: object properties: strategies: type: array items: $ref: '#/components/schemas/SegmentStrategiesSchemaStrategiesItems' description: The list of strategies changeRequestStrategies: type: array items: $ref: >- #/components/schemas/SegmentStrategiesSchemaChangeRequestStrategiesItems description: >- A list of strategies that use this segment in active change requests. required: - strategies description: A collection of strategies belonging to a specified segment. title: segmentStrategiesSchema securitySchemes: apiKey: type: apiKey in: header name: Authorization description: API key needed to access this API bearerToken: type: http scheme: bearer description: API key needed to access this API, in Bearer token format ``` ## SDK Code Examples ```python import requests url = "https://app.unleash-instance.example.com/api/admin/segments/1/strategies" headers = {"Authorization": ""} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript const url = 'https://app.unleash-instance.example.com/api/admin/segments/1/strategies'; const options = {method: 'GET', headers: {Authorization: ''}}; 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" "net/http" "io" ) func main() { url := "https://app.unleash-instance.example.com/api/admin/segments/1/strategies" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "") 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://app.unleash-instance.example.com/api/admin/segments/1/strategies") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = '' response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://app.unleash-instance.example.com/api/admin/segments/1/strategies") .header("Authorization", "") .asString(); ``` ```php request('GET', 'https://app.unleash-instance.example.com/api/admin/segments/1/strategies', [ 'headers' => [ 'Authorization' => '', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://app.unleash-instance.example.com/api/admin/segments/1/strategies"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", ""); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Authorization": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://app.unleash-instance.example.com/api/admin/segments/1/strategies")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers 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() ```