# Register a client SDK POST https://app.unleash-instance.example.com/api/client/register Content-Type: application/json Register a client SDK with Unleash. SDKs call this endpoint on startup to tell Unleash about their existence. Used to track custom strategies in use as well as SDK versions. Reference: https://docs.getunleash.io/api/register-client-application ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Register a client SDK version: endpoint_client.registerClientApplication paths: /api/client/register: post: operationId: register-client-application summary: Register a client SDK description: >- Register a client SDK with Unleash. SDKs call this endpoint on startup to tell Unleash about their existence. Used to track custom strategies in use as well as SDK versions. tags: - - subpackage_client parameters: - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '202': description: This response has no body. content: application/json: schema: $ref: >- #/components/schemas/Client_registerClientApplication_Response_202 requestBody: description: clientApplicationSchema content: application/json: schema: $ref: '#/components/schemas/clientApplicationSchema' components: schemas: ClientApplicationSchemaStarted: oneOf: - type: string format: date-time - type: number format: double clientApplicationSchema: type: object properties: appName: type: string description: >- An identifier for the app that uses the sdk, should be static across SDK restarts instanceId: type: string description: >- A unique identifier identifying the instance of the application running the SDK. Often changes based on execution environment. For instance: two pods in Kubernetes will have two different instanceIds sdkVersion: type: string description: >- An SDK version identifier. Usually formatted as "unleash-client-:" environment: type: string description: >- The SDK's configured 'environment' property. This property was deprecated in v5. This property does **not** control which Unleash environment the SDK gets toggles for. To control Unleash environments, use the SDKs API key. platformName: type: string description: >- The platform the application is running on. For languages that compile to binaries, this can be omitted platformVersion: type: string description: >- The version of the platform the application is running on. Languages that compile to binaries, this is expected to be the compiler version used to assemble the binary. yggdrasilVersion: type: string description: >- The semantic version of the Yggdrasil engine used by the client. If the client is using a native engine this can be omitted. specVersion: type: string description: The version of the Unleash client specification the client supports interval: type: number format: double description: How often (in seconds) does the client refresh its toggles started: $ref: '#/components/schemas/ClientApplicationSchemaStarted' description: Either an RFC-3339 timestamp or a unix timestamp in seconds strategies: type: array items: type: string description: Which strategies the SDKs runtime knows about required: - appName - interval - started - strategies Client_registerClientApplication_Response_202: type: object properties: {} ``` ## SDK Code Examples ```python import requests url = "https://app.unleash-instance.example.com/api/client/register" payload = { "appName": "example-app", "interval": 10, "started": "2023-06-13T16:35:00.000Z", "strategies": ["default", "gradualRollout", "remoteAddress"] } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://app.unleash-instance.example.com/api/client/register'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"appName":"example-app","interval":10,"started":"2023-06-13T16:35:00.000Z","strategies":["default","gradualRollout","remoteAddress"]}' }; 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://app.unleash-instance.example.com/api/client/register" payload := strings.NewReader("{\n \"appName\": \"example-app\",\n \"interval\": 10,\n \"started\": \"2023-06-13T16:35:00.000Z\",\n \"strategies\": [\n \"default\",\n \"gradualRollout\",\n \"remoteAddress\"\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "") 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://app.unleash-instance.example.com/api/client/register") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"appName\": \"example-app\",\n \"interval\": 10,\n \"started\": \"2023-06-13T16:35:00.000Z\",\n \"strategies\": [\n \"default\",\n \"gradualRollout\",\n \"remoteAddress\"\n ]\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://app.unleash-instance.example.com/api/client/register") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"appName\": \"example-app\",\n \"interval\": 10,\n \"started\": \"2023-06-13T16:35:00.000Z\",\n \"strategies\": [\n \"default\",\n \"gradualRollout\",\n \"remoteAddress\"\n ]\n}") .asString(); ``` ```php request('POST', 'https://app.unleash-instance.example.com/api/client/register', [ 'body' => '{ "appName": "example-app", "interval": 10, "started": "2023-06-13T16:35:00.000Z", "strategies": [ "default", "gradualRollout", "remoteAddress" ] }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://app.unleash-instance.example.com/api/client/register"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"appName\": \"example-app\",\n \"interval\": 10,\n \"started\": \"2023-06-13T16:35:00.000Z\",\n \"strategies\": [\n \"default\",\n \"gradualRollout\",\n \"remoteAddress\"\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "appName": "example-app", "interval": 10, "started": "2023-06-13T16:35:00.000Z", "strategies": ["default", "gradualRollout", "remoteAddress"] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://app.unleash-instance.example.com/api/client/register")! 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() ```