CDN API · Distributions
Check for a new Distribution Release
curl --request POST \ --url https://cdn.lingohub.com/v1/distributions/check \ --header 'Authorization: Bearer lh-cdn_eyJhbGciOiJIUz...' \ --header 'Content-Type: application/json' \ --data '{ "clientVersion": "2.1.0", "clientRelease": "rel_019f9d57-d0ec-7fa2-99f2-4ac2eb20e671", "distributionEnvironment": "DEVELOPMENT", "distributionType": "NATIVE_FORMAT"}'import requests
url = "https://cdn.lingohub.com/v1/distributions/check"
payload = { "clientVersion": "2.1.0", "clientRelease": "rel_019f9d57-d0ec-7fa2-99f2-4ac2eb20e671", "distributionEnvironment": "DEVELOPMENT", "distributionType": "NATIVE_FORMAT"}headers = { "Authorization": "Bearer lh-cdn_eyJhbGciOiJIUz...", "Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())const url = 'https://cdn.lingohub.com/v1/distributions/check';const options = { method: 'POST', headers: { Authorization: 'Bearer lh-cdn_eyJhbGciOiJIUz...', 'Content-Type': 'application/json' }, body: '{"clientVersion":"2.1.0","clientRelease":"rel_019f9d57-d0ec-7fa2-99f2-4ac2eb20e671","distributionEnvironment":"DEVELOPMENT","distributionType":"NATIVE_FORMAT"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://cdn.lingohub.com/v1/distributions/check"
payload := strings.NewReader("{\n \"clientVersion\": \"2.1.0\",\n \"clientRelease\": \"rel_019f9d57-d0ec-7fa2-99f2-4ac2eb20e671\",\n \"distributionEnvironment\": \"DEVELOPMENT\",\n \"distributionType\": \"NATIVE_FORMAT\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer lh-cdn_eyJhbGciOiJIUz...") 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))
}OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");RequestBody body = RequestBody.create(mediaType, "{\n \"clientVersion\": \"2.1.0\",\n \"clientRelease\": \"rel_019f9d57-d0ec-7fa2-99f2-4ac2eb20e671\",\n \"distributionEnvironment\": \"DEVELOPMENT\",\n \"distributionType\": \"NATIVE_FORMAT\"\n}");Request request = new Request.Builder() .url("https://cdn.lingohub.com/v1/distributions/check") .post(body) .addHeader("Authorization", "Bearer lh-cdn_eyJhbGciOiJIUz...") .addHeader("Content-Type", "application/json") .build();
Response response = client.newCall(request).execute();<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://cdn.lingohub.com/v1/distributions/check', [ 'body' => '{ "clientVersion": "2.1.0", "clientRelease": "rel_019f9d57-d0ec-7fa2-99f2-4ac2eb20e671", "distributionEnvironment": "DEVELOPMENT", "distributionType": "NATIVE_FORMAT"}', 'headers' => [ 'Authorization' => 'Bearer lh-cdn_eyJhbGciOiJIUz...', 'Content-Type' => 'application/json', ],]);
echo $response->getBody();require 'uri'require 'net/http'
url = URI("https://cdn.lingohub.com/v1/distributions/check")
http = Net::HTTP.new(url.host, url.port)http.use_ssl = true
request = Net::HTTP::Post.new(url)request["Authorization"] = 'Bearer lh-cdn_eyJhbGciOiJIUz...'request["Content-Type"] = 'application/json'request.body = "{\n \"clientVersion\": \"2.1.0\",\n \"clientRelease\": \"rel_019f9d57-d0ec-7fa2-99f2-4ac2eb20e671\",\n \"distributionEnvironment\": \"DEVELOPMENT\",\n \"distributionType\": \"NATIVE_FORMAT\"\n}"
response = http.request(request)puts response.read_bodyusing System.Net.Http.Headers;var client = new HttpClient();var request = new HttpRequestMessage{ Method = HttpMethod.Post, RequestUri = new Uri("https://cdn.lingohub.com/v1/distributions/check"), Headers = { { "Authorization", "Bearer lh-cdn_eyJhbGciOiJIUz..." }, }, Content = new StringContent("{\n \"clientVersion\": \"2.1.0\",\n \"clientRelease\": \"rel_019f9d57-d0ec-7fa2-99f2-4ac2eb20e671\",\n \"distributionEnvironment\": \"DEVELOPMENT\",\n \"distributionType\": \"NATIVE_FORMAT\"\n}") { Headers = { ContentType = new MediaTypeHeaderValue("application/json") } }};using (var response = await client.SendAsync(request)){ response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);}Checks whether the app should download the active release of its distribution. Send the distributionReleaseId of the release the app already has as clientRelease: the check answers 204 while that release is still the active one, and 200 with the active release otherwise, including on the first check, without clientRelease. distributionEnvironment, distributionType and clientVersion select the distribution. Requires a CDN key as a Bearer token in the Authorization header.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Request body for checking for a new Distribution Release. The distribution environment and type are required and, with the optional client version, select the distribution. The client release names the release the app already has.
object
The version of the app. Selects the distribution whose version range contains it; without it, or when no range contains it, the fallback distribution is used.
Example
2.1.0The distributionReleaseId of the release the app already has, from the response of its previous check. The check answers 204 while it is still the active release. Omit it on the first check.
Example
rel_019f9d57-d0ec-7fa2-99f2-4ac2eb20e671The target distribution environment. This is a mandatory filter.
Example
PRODUCTIONThe target distribution type. This is a mandatory filter.
Example
MOBILE_SDK_IOSResponses
Section titled “Responses”The active release is not the one named in clientRelease, or clientRelease was not sent. Download it from filesUrl and send its distributionReleaseId as clientRelease on the next check.
Response containing details of a matching Distribution Release, including its identifier, name, creation timestamp, and a pre-signed download URL.
object
The unique identifier of the Distribution Release.
The human-readable name of the Distribution Release.
The timestamp when the Distribution Release was created.
A pre-signed S3 URL to download the Distribution Release files. Valid for 24 hours.
Examples
The active release, which the app does not have yet
New release
{ "distributionReleaseId": "rel_019f9d57-d0ec-7fa2-99f2-4ac2eb20e671", "name": "your project release", "createdAt": "2025-02-24T13:11:30.909+00:00", "filesUrl": "https://lingohub-exports.s3.amazonaws.com/distributions/rel_019f9d57-d0ec-7fa2-99f2-4ac2eb20e671.zip"}The release named in clientRelease is still the active one: the app is up to date. The response has no body.
The request body is not a JSON object, distributionEnvironment or distributionType is missing or not one of their values, or clientVersion or clientRelease is not a string of at most 50 characters.
An error in the problem detail format of RFC 9457. errors names the area and the cause.
object
The HTTP status code.
The reason phrase of the status.
The area and the cause of the error. Empty for an invalid request body and for server errors.
A structured error detail indicating which field caused the error and the specific error codes.
object
The field or area that caused the error.
The list of error codes describing what went wrong for this field.
Example
{ "type": "about:blank", "status": 401, "detail": "Unauthorized", "errors": [ { "field": "AUTHORIZATION", "infos": [ "HEADER_INVALID" ] } ]}The Authorization header is missing or malformed, or the CDN key is invalid, deleted, rotated or revoked. errors names the cause.
An error in the problem detail format of RFC 9457. errors names the area and the cause.
object
The HTTP status code.
The reason phrase of the status.
The area and the cause of the error. Empty for an invalid request body and for server errors.
A structured error detail indicating which field caused the error and the specific error codes.
object
The field or area that caused the error.
The list of error codes describing what went wrong for this field.
Examples
The CDN key does not exist
Unknown CDN key
{ "type": "about:blank", "status": 401, "detail": "Unauthorized", "errors": [ { "field": "AUTHORIZATION", "infos": [ "CDN_KEY_NOT_FOUND" ] } ]}No distribution matches: the project of the CDN key has no distribution for distributionEnvironment and distributionType whose version range contains clientVersion, and no fallback distribution for them. Also answered when the matching distribution has no active release.
An error in the problem detail format of RFC 9457. errors names the area and the cause.
object
The HTTP status code.
The reason phrase of the status.
The area and the cause of the error. Empty for an invalid request body and for server errors.
A structured error detail indicating which field caused the error and the specific error codes.
object
The field or area that caused the error.
The list of error codes describing what went wrong for this field.
Examples
No matching distribution exists
Distribution not found
{ "type": "about:blank", "status": 404, "detail": "Not Found", "errors": [ { "field": "DISTRIBUTION", "infos": [ "DISTRIBUTION_NOT_FOUND" ] } ]}The workspace has used up its CDN budget. Checks are answered again once more budget is available; wait the number of seconds in the Retry-After header.
An error in the problem detail format of RFC 9457. errors names the area and the cause.
object
The HTTP status code.
The reason phrase of the status.
The area and the cause of the error. Empty for an invalid request body and for server errors.
A structured error detail indicating which field caused the error and the specific error codes.
object
The field or area that caused the error.
The list of error codes describing what went wrong for this field.
Examples
CDN budget exhausted
Usage limit exceeded
{ "type": "about:blank", "status": 429, "detail": "Too Many Requests", "errors": [ { "field": "USAGE", "infos": [ "USAGE_LIMIT_EXCEEDED" ] } ]}Headers
Section titled “Headers”Seconds to wait before checking again.
An unexpected error occurred. Retry after the number of seconds in the Retry-After header.
An error in the problem detail format of RFC 9457. errors names the area and the cause.
object
The HTTP status code.
The reason phrase of the status.
The area and the cause of the error. Empty for an invalid request body and for server errors.
A structured error detail indicating which field caused the error and the specific error codes.
object
The field or area that caused the error.
The list of error codes describing what went wrong for this field.
Example
{ "type": "about:blank", "status": 401, "detail": "Unauthorized", "errors": [ { "field": "AUTHORIZATION", "infos": [ "HEADER_INVALID" ] } ]}Headers
Section titled “Headers”Seconds to wait before retrying.
The CDN is temporarily unavailable. Retry after the number of seconds in the Retry-After header.
An error in the problem detail format of RFC 9457. errors names the area and the cause.
object
The HTTP status code.
The reason phrase of the status.
The area and the cause of the error. Empty for an invalid request body and for server errors.
A structured error detail indicating which field caused the error and the specific error codes.
object
The field or area that caused the error.
The list of error codes describing what went wrong for this field.
Example
{ "type": "about:blank", "status": 401, "detail": "Unauthorized", "errors": [ { "field": "AUTHORIZATION", "infos": [ "HEADER_INVALID" ] } ]}Headers
Section titled “Headers”Seconds to wait before retrying.