# Multimedia create

{% hint style="info" %}
To create multimedia via API you need to send the data by a multipart request with `upload` and `query` headers.
{% endhint %}

{% hint style="info" %}
The folder to which multimedia will be uploaded must already exist.
{% endhint %}

{% hint style="info" %}
folderPath parameter is optional, if not included multimedia will be uploaded to the main folder.
{% endhint %}

{% hint style="info" %}
Max allowed file size is 100 MB
{% endhint %}

```graphql
mutation {
  multimediaCreate(
    input: { name: "file_name.extension", folderPath: "folder_path" }
  ) {
    __typename
  }
}
```

#### Example in PHP8

```php
$client = new \GuzzleHttp\Client(); // Guzzle version 6

$resp = $client->post(
    $url,
    [
        'multipart' => [
            [
                'name' => 'upload',
                'contents' => fopen(__DIR__ . '/test.png', 'r'),
            ],
            [
                'name' => 'query',
                'contents' => '
                    mutation {
                        multimediaCreate(input: {name: "new.png", folderPath: null}) {__typename}
                    }
                ',
            ],
        ],
        'headers' => [
            'X-API-KEY' => $apiKey,
        ],
    ],
);
```

#### Example in Python3

```python
from urllib import response
import requests

url = "https://marcin.ergonode.app/api/graphql/"

data = {
    'upload': open('C:\\temp\\temp.png', 'rb'),
    'query': (None, 'mutation{multimediaCreate(input:{name:"<choose_a_name>",folderPath: "<some_folder_path>"}){__typename}}')
}

headers = {
    'X-API-KEY': '<some_api_key>',
}

response = requests.post(url, files=data, headers=headers)

print (response.text)

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ergonode.com/graphql/query-examples/multimedia-create.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
