# Gets configured context fields GET https://app.unleash-instance.example.com/api/admin/context Returns all configured [Context fields](https://docs.getunleash.io/concepts/unleash-context) that have been created. Reference: https://docs.getunleash.io/api/get-context-fields ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Gets configured context fields version: endpoint_context.getContextFields paths: /api/admin/context: get: operationId: get-context-fields summary: Gets configured context fields description: >- Returns all configured [Context fields](https://docs.getunleash.io/concepts/unleash-context) that have been created. tags: - - subpackage_context parameters: - name: include in: query description: >- Whether the response should include project-specific or root context fields in addition to the fields in the default response. When querying the root context API, `include=project` will yield a response that includes all project-specific context fields in addition to all root context fields. Conversely, when querying a project-specific context API, using `include=root` will yield a response that includes all root context fields in addition to the project-specific context fields. The other combinations have no effect, because the responses already include those fields. When including project-specific context fields via the root-level API, context fields in private projects the user does not have access to will be omitted. required: false schema: type: string - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '200': description: contextFieldsSchema content: application/json: schema: $ref: '#/components/schemas/contextFieldsSchema' components: schemas: legalValueSchema: type: object properties: value: type: string description: The valid value description: type: string description: Describes this specific legal value required: - value contextFieldSchema: type: object properties: name: type: string description: The name of the context field description: type: - string - 'null' description: The description of the context field. stickiness: type: boolean description: >- Does this context field support being used for [stickiness](https://docs.getunleash.io/concepts/stickiness) calculations sortOrder: type: integer description: >- Used when sorting a list of context fields. Is also used as a tiebreaker if a list of context fields is sorted alphabetically. createdAt: type: - string - 'null' format: date-time description: When this context field was created usedInFeatures: type: - integer - 'null' description: Number of projects where this context field is used in usedInProjects: type: - integer - 'null' description: Number of projects where this context field is used in legalValues: type: array items: $ref: '#/components/schemas/legalValueSchema' description: >- Allowed values for this context field schema. Can be used to narrow down accepted input project: type: string description: >- The project this context field belongs to (if it is project-specific) required: - name contextFieldsSchema: type: array items: $ref: '#/components/schemas/contextFieldSchema' ``` ## SDK Code Examples ```python import requests url = "https://app.unleash-instance.example.com/api/admin/context" headers = {"Authorization": ""} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript const url = 'https://app.unleash-instance.example.com/api/admin/context'; 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/context" 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/context") 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/context") .header("Authorization", "") .asString(); ``` ```php request('GET', 'https://app.unleash-instance.example.com/api/admin/context', [ 'headers' => [ 'Authorization' => '', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://app.unleash-instance.example.com/api/admin/context"); 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/context")! 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() ```