> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://uploadcare.com/docs/llms.txt.

# Create a file group

POST https://upload.uploadcare.com/group/
Content-Type: multipart/form-data

Create a file group from a set of already uploaded files.The most common use case for creating a file group is when a user uploads
multiple files at once and then wants to display them together.**Note:** A group itself and files within it MUST belong to the same project.**Note:** Groups are immutable and the only way to add/remove a file to a group
is to create a new one.**Note:** With [signed uploads](/docs/api/upload/authentication/#jwt-scope), the scope value of this endpoint is `/group/`.
A request does not consume the token's operations limit.

Reference: https://uploadcare.com/docs/api/upload/groups/create-files-group

## Authentication

- `Authorization` header (bearer token, required) — Signed uploads with a JSON Web Token ([RFC 7519](https://www.rfc-editor.org/rfc/rfc7519)), generated on your backend with the project Secret key and sent in the `Authorization` header: ``` Authorization: Bearer <jwt> ``` The token is checked only when [signed uploads](https://uploadcare.com/docs/security/secure-uploads/) are enabled for the project. Signing, claims, scope and operation limits, and error responses are specified in [Authentication](https://uploadcare.com/docs/api/upload/authentication/#jwt). The scope value of each endpoint, and how many operations a request spends, is listed in the endpoint description.

## Request

### Body (multipart/form-data)

This endpoint expects a multipart form.

- `pub_key` (string, required)
- `files[]` (list of string, required) — Set of files you want to add to the group. Each element can be a file UUID with or without the applied image processing operations.
- `signature` (string, optional)
- `expire` (integer, optional)

## Response

### 200

The group was created successfully.

- `id` (string, optional) — Group's unique ID.
- `datetime_created` (datetime, optional) — ISO-8601 date and time when the group was created.
- `files_count` (integer, optional) — Number of the files in the group.
- `cdn_url` (string, optional) — Group's CDN URL.
- `url` (string, optional) — Group's API resource URL. See the [REST API](/docs/api/rest/) documentation for details.
- `files` (list of any, optional, nullable) — The list of files in the group. An array may contain null values if a file has been removed.
- `datetime_stored` (datetime, optional, nullable, deprecated) — Deprecated. This field will be removed in a future version of the Upload API.

## Examples

**Request**

```json
{
  "files[]": [
    "d6d34fa9-addd-472c-868d-2e5c105f9fcd",
    "b1026315-8116-4632-8364-607e64fca723/-/resize/x800/"
  ],
  "pub_key": "YOUR_PUBLIC_KEY"
}
```

**Response**

```json
{
  "id": "0d712319-b970-4602-850c-bae1ced521a6~1",
  "datetime_created": "2018-09-12T10:03:38.686710Z",
  "files_count": 1,
  "cdn_url": "https://ucarecdn.com/0d712319-b970-4602-850c-bae1ced521a6~1/",
  "url": "https://api.uploadcare.com/groups/0d712319-b970-4602-850c-bae1ced521a6~1/",
  "files": [
    "string"
  ],
  "datetime_stored": null
}
```

**SDK Code**

```javascript JS
import { group } from '@uploadcare/upload-client'

const result = await group(
  [
    'd6d34fa9-addd-472c-868d-2e5c105f9fcd',
    'b1026315-8116-4632-8364-607e64fca723/-/resize/x800/'
  ],
  {
    publicKey: 'YOUR_PUBLIC_KEY'
  }
)

```

```php PHP
<?php
$configuration = Uploadcare\Configuration::create((string) $_ENV['UPLOADCARE_PUBLIC_KEY'], (string) $_ENV['UPLOADCARE_SECRET_KEY']);

$uploader = new Uploadcare\Uploader\Uploader($configuration);
$result = $uploader->groupFiles(['d6d34fa9-addd-472c-868d-2e5c105f9fcd', 'b1026315-8116-4632-8364-607e64fca723/-/resize/x800/']);
echo \sprintf('Response status is %s', $result->getStatusCode());

```

```python Python
from pyuploadcare import Uploadcare, File, FileGroup

uploadcare = Uploadcare(public_key='YOUR_PUBLIC_KEY', secret_key='YOUR_SECRET_KEY')
file_1 = uploadcare.file('d6d34fa9-addd-472c-868d-2e5c105f9fcd')
file_2 = uploadcare.file('b1026315-8116-4632-8364-607e64fca723/-/resize/x800/')
file_group = uploadcare.create_file_group([file_1, file_2])

```

```ruby Ruby
require 'uploadcare'
Uploadcare.config.public_key = 'YOUR_PUBLIC_KEY'
Uploadcare.config.secret_key = 'YOUR_SECRET_KEY'

uuids = [
  'd6d34fa9-addd-472c-868d-2e5c105f9fcd',
  'b1026315-8116-4632-8364-607e64fca723/-/resize/x800/'
]
Uploadcare::Group.create(uuids)

```

```swift Swift
import Uploadcare

let uploadcare = Uploadcare(withPublicKey: "YOUR_PUBLIC_KEY", secretKey: "YOUR_SECRET_KEY")

let filesIds = ["d6d34fa9-addd-472c-868d-2e5c105f9fcd", "b1026315-8116-4632-8364-607e64fca723/-/resize/x800/"]
let group = try await uploadAPI.createFilesGroup(fileIds: filesIds)
print(group)

```

```kotlin Kotlin
import com.uploadcare.android.library.api.UploadcareClient

val uploadcare = UploadcareClient(publicKey = "YOUR_PUBLIC_KEY", secretKey = "YOUR_SECRET_KEY")

val uuids = listOf(
    "d6d34fa9-addd-472c-868d-2e5c105f9fcd",
    "b1026315-8116-4632-8364-607e64fca723/-/resize/x800/"
)
val group = uploadcare.createGroup(fileIds = uuids)
Log.d("TAG", group.toString())

```

```go Create Group
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://upload.uploadcare.com/group/"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"expire\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files[]\"\r\n\r\n[\n  \"d6d34fa9-addd-472c-868d-2e5c105f9fcd\",\n  \"b1026315-8116-4632-8364-607e64fca723/-/resize/x800/\"\n]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"pub_key\"\r\n\r\nYOUR_PUBLIC_KEY\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"signature\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

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

HttpResponse<String> response = Unirest.post("https://upload.uploadcare.com/group/")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"expire\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files[]\"\r\n\r\n[\n  \"d6d34fa9-addd-472c-868d-2e5c105f9fcd\",\n  \"b1026315-8116-4632-8364-607e64fca723/-/resize/x800/\"\n]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"pub_key\"\r\n\r\nYOUR_PUBLIC_KEY\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"signature\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
  .asString();
```

```csharp Create Group
using RestSharp;

var client = new RestClient("https://upload.uploadcare.com/group/");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "multipart/form-data; boundary=---011000010111000001101001");
request.AddParameter("multipart/form-data; boundary=---011000010111000001101001", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"expire\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files[]\"\r\n\r\n[\n  \"d6d34fa9-addd-472c-868d-2e5c105f9fcd\",\n  \"b1026315-8116-4632-8364-607e64fca723/-/resize/x800/\"\n]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"pub_key\"\r\n\r\nYOUR_PUBLIC_KEY\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"signature\"\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```