> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://typeform.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://typeform.ferndocs.com/_mcp/server.

# Retrieve background by size

GET https://api.typeform.com/images/{image_id}/background/{size}

Retrieve the JSON description or the binary of the requested background format.

Use the `Accept` header to specify the response format. If you use `application/json`, the JSON representation of the resource will be returned. Otherwise, the image as a binary will be returned (if the MIME type matches with the stored one).

Reference: https://typeform.ferndocs.com/documentation/create-api/api-reference/images/background

## Authentication

- `Authorization` header (bearer token, required) — Bearer token authentication. Tokens can be generated from the user account. Privileges needed may vary.
- `Authorization` header (required) — A string representation of JWT containing at least two parameters: `ctx.user_id` — user's id `ctx.account_id` — user's default account id `ctx.account_uid` — user's default account uid The usage of account_(u)id from JWT is discouraged, user can have access to multiple accounts, every endpoint has to be account aware if it's needed. This JWT must be signed by the appropriate authority.

## Request

### Path parameters

- `image_id` (string, required) — Unique ID for the image to retrieve.
- `size` (enum, required) — Image size to retrieve. `default` is scaled to fit within a width of 1680px and a height of 1050px. `tablet` is scaled to fit within a width of 1024px and a height of 768px. `mobile` is scaled to fit within a width of 460px and a height of 320px. `thumbnail` is scaled to fit within a width of 80px and a height of 50px. **NOTE:** Images used for typeform backgrounds are scaled and cropped from a top-left alignment to make sure they fill the screen properly.
  - Allowed values: `default`, `tablet`, `mobile`, `thumbnail`

## Response

### 200

OK

- `id` (string, optional) — Unique ID for the image.
- `src` (string, optional) — URL for the image.
- `file_name` (string, optional) — File name for the image (specified when image is created).
- `width` (integer, optional) — Width of the image in pixels.
- `height` (integer, optional) — Height of the image in pixels.
- `media_type` (enum, optional) — The MIME type of the image.
  - Allowed values: `image/gif`, `image/jpeg`, `image/png`
- `has_alpha` (boolean, optional) — True if image has alpha channel (some degree of transparency). Otherwise, false.
- `avg_color` (string, optional) — Average color of the image in hexadecimal format.

## Examples

**Response**

```json
{
  "id": "XcXx",
  "src": "https://api.typeform.com/images/{image_id}/background/{size}",
  "file_name": "newimage.gif",
  "width": 100,
  "height": 100,
  "media_type": "image/gif",
  "has_alpha": true,
  "avg_color": "ff00ff"
}
```

**SDK Code**

```python
import requests

url = "https://api.typeform.com/images/Ypdq3CDUGVue/background/default"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.typeform.com/images/Ypdq3CDUGVue/background/default';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

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://api.typeform.com/images/Ypdq3CDUGVue/background/default"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	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://api.typeform.com/images/Ypdq3CDUGVue/background/default")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.typeform.com/images/Ypdq3CDUGVue/background/default")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.typeform.com/images/Ypdq3CDUGVue/background/default', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.typeform.com/images/Ypdq3CDUGVue/background/default");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.typeform.com/images/Ypdq3CDUGVue/background/default")! 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()
```