# Get and set all file metadata

Every command on this page needs a [bearer token](/help/rest-api/reference/authentication/) and counts towards your [hourly limit](/help/rest-api/reference/rate-limits-and-errors/).

## Get all file meta

**GET**`https://api.sirv.com/v2/files/meta`

Get all the meta for a file, in a single request.

Unlike the API methods for getting meta title, description, tags and product data, this API method will return all meta data, making it the fastest and easiest way to get meta via the API. (You can also get file meta simply by requesting a file URL with ?info appended - [example](https://demo.sirv.com/example.jpg?info)).

Query parameters

| Name | Type | Required | Example | Description |
| --- | --- | --- | --- | --- |
| `filename` | string | Yes | `/REST API Examples/blue-lake.jpg` | Path of the file in your account, starting with /. |

Example request

-   [Node.js](#tab-panel-0-0)
-   [Python](#tab-panel-0-1)
-   [cURL](#tab-panel-0-2)
-   [Java](#tab-panel-0-3)
-   [C#](#tab-panel-0-4)
-   [PHP](#tab-panel-0-5)
-   [Go](#tab-panel-0-6)
-   [Ruby](#tab-panel-0-7)
-   [Swift](#tab-panel-0-8)

```js
// Your bearer token, from POST /v2/token, in the SIRV_TOKEN environment variable
const res = await fetch('https://api.sirv.com/v2/files/meta?filename=%2FREST%20API%20Examples%2Fblue-lake.jpg', {
  method: 'GET',
  headers: { authorization: `Bearer ${process.env.SIRV_TOKEN}` },
});
console.log(res.status, await res.text());
```

```python
import requests

res = requests.get(
    'https://api.sirv.com/v2/files/meta?filename=%2FREST%20API%20Examples%2Fblue-lake.jpg',
    headers={'authorization': 'Bearer BEARER_TOKEN'},
)
print(res.status_code, res.text)
```

```bash
curl --request GET \
  --url 'https://api.sirv.com/v2/files/meta?filename=%2FREST%20API%20Examples%2Fblue-lake.jpg' \
  --header 'authorization: Bearer BEARER_TOKEN'
```

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.sirv.com/v2/files/meta?filename=%2FREST%20API%20Examples%2Fblue-lake.jpg"))
    .header("authorization", "Bearer BEARER_TOKEN")
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
```

```csharp
using System.Net.Http.Headers;

using var client = new HttpClient();
var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.sirv.com/v2/files/meta?filename=%2FREST%20API%20Examples%2Fblue-lake.jpg");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "BEARER_TOKEN");
var response = await client.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");
```

```php
<?php
$ch = curl_init('https://api.sirv.com/v2/files/meta?filename=%2FREST%20API%20Examples%2Fblue-lake.jpg');
curl_setopt_array($ch, [
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => ['authorization: Bearer BEARER_TOKEN'],
  CURLOPT_RETURNTRANSFER => true,
]);
echo curl_exec($ch);
```

```go
package main

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

func main() {
  req, _ := http.NewRequest("GET", "https://api.sirv.com/v2/files/meta?filename=%2FREST%20API%20Examples%2Fblue-lake.jpg", nil)
  req.Header.Set("authorization", "Bearer BEARER_TOKEN")
  res, err := http.DefaultClient.Do(req)
  if err != nil {
    panic(err)
  }
  defer res.Body.Close()
  out, _ := io.ReadAll(res.Body)
  fmt.Println(res.Status, string(out))
}
```

```ruby
require 'net/http'

uri = URI('https://api.sirv.com/v2/files/meta?filename=%2FREST%20API%20Examples%2Fblue-lake.jpg')
req = Net::HTTP::Get.new(uri)
req['authorization'] = 'Bearer BEARER_TOKEN'
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
puts res.code, res.body
```

```swift
import Foundation

var request = URLRequest(url: URL(string: "https://api.sirv.com/v2/files/meta?filename=%2FREST%20API%20Examples%2Fblue-lake.jpg")!)
request.httpMethod = "GET"
request.setValue("Bearer BEARER_TOKEN", forHTTPHeaderField: "authorization")
let (data, response) = try await URLSession.shared.data(for: request)
print((response as! HTTPURLResponse).statusCode, String(decoding: data, as: UTF8.self))
```

Example response

```json
{
  "tags": [
    "lake",
    "water"
  ],
  "title": "Blue Lake",
  "description": "Blue Lake in the Winter",
  "product": {
    "id": "LLBB77",
    "name": "Blue Lake Card",
    "brand": "BLUE LAKE LLC",
    "category1": "Cards",
    "category2": "Lakes"
  },
  "approval": {
    "datetime": "2026-02-23T14:08:00.165Z",
    "approved": false,
    "comment": "It looks too cold!"
  }
}
```

## Set all file meta

**POST**`https://api.sirv.com/v2/files/meta`

Add multiple meta fields in a single request. Any of the 10 types of meta can be added or changed with this API method.

If you’re adding a lot of meta, this is the fastest and lowest load way to add meta data.

Query parameters

| Name | Type | Required | Example | Description |
| --- | --- | --- | --- | --- |
| `filename` | string | Yes | `/REST API Examples/blue-lake.jpg` | Path of the file in your account, starting with /. |

Request body (JSON)

| Field | Type | Required | Example | Description |
| --- | --- | --- | --- | --- |
| `tags` | array of string | No | `["lake","water"]` | Tags of the file. |
| `title` | string | No | `Blue Lake` | Title of the file. |
| `description` | string | No | `Blue Lake in the Winter` | Description of the file. |
| `product` | object | No |  | Product details of the file. |
| `product.id` | string | No | `LLBB77` | Product ID or SKU. |
| `product.name` | string | No | `Blue Lake Card` | Product name. |
| `product.brand` | string | No | `BLUE LAKE LLC` | Brand of the product. |
| `product.category1` | string | No | `Cards` | Main product category. |
| `product.category2` | string | No | `Lakes` | Second product category. |
| `approval` | object | No |  | Approval status of the file. |
| `approval.approved` | boolean | Yes | `false` | true to approve the file, false to reject it. |
| `approval.comment` | string | Yes | `It looks too cold!` | A note on the decision. |

Example request

-   [Node.js](#tab-panel-1-0)
-   [Python](#tab-panel-1-1)
-   [cURL](#tab-panel-1-2)
-   [Java](#tab-panel-1-3)
-   [C#](#tab-panel-1-4)
-   [PHP](#tab-panel-1-5)
-   [Go](#tab-panel-1-6)
-   [Ruby](#tab-panel-1-7)
-   [Swift](#tab-panel-1-8)

```js
// Your bearer token, from POST /v2/token, in the SIRV_TOKEN environment variable
const res = await fetch('https://api.sirv.com/v2/files/meta?filename=%2FREST%20API%20Examples%2Fblue-lake.jpg', {
  method: 'POST',
  headers: { authorization: `Bearer ${process.env.SIRV_TOKEN}`, 'content-type': 'application/json' },
  body: JSON.stringify({
    "tags": [
      "lake",
      "water"
    ],
    "title": "Blue Lake",
    "description": "Blue Lake in the Winter",
    "product": {
      "id": "LLBB77",
      "name": "Blue Lake Card",
      "brand": "BLUE LAKE LLC",
      "category1": "Cards",
      "category2": "Lakes"
    },
    "approval": {
      "approved": false,
      "comment": "It looks too cold!"
    }
  }),
});
console.log(res.status, await res.text());
```

```python
import requests

res = requests.post(
    'https://api.sirv.com/v2/files/meta?filename=%2FREST%20API%20Examples%2Fblue-lake.jpg',
    headers={'authorization': 'Bearer BEARER_TOKEN', 'content-type': 'application/json'},
    json={
      "tags": [
        "lake",
        "water"
      ],
      "title": "Blue Lake",
      "description": "Blue Lake in the Winter",
      "product": {
        "id": "LLBB77",
        "name": "Blue Lake Card",
        "brand": "BLUE LAKE LLC",
        "category1": "Cards",
        "category2": "Lakes"
      },
      "approval": {
        "approved": False,
        "comment": "It looks too cold!"
      }
    },
)
print(res.status_code, res.text)
```

```bash
curl --request POST \
  --url 'https://api.sirv.com/v2/files/meta?filename=%2FREST%20API%20Examples%2Fblue-lake.jpg' \
  --header 'authorization: Bearer BEARER_TOKEN' \
  --header 'content-type: application/json' \
  --data '{"tags":["lake","water"],"title":"Blue Lake","description":"Blue Lake in the Winter","product":{"id":"LLBB77","name":"Blue Lake Card","brand":"BLUE LAKE LLC","category1":"Cards","category2":"Lakes"},"approval":{"approved":false,"comment":"It looks too cold!"}}'
```

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.sirv.com/v2/files/meta?filename=%2FREST%20API%20Examples%2Fblue-lake.jpg"))
    .header("authorization", "Bearer BEARER_TOKEN")
    .header("content-type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("""
        {
          "tags": [
            "lake",
            "water"
          ],
          "title": "Blue Lake",
          "description": "Blue Lake in the Winter",
          "product": {
            "id": "LLBB77",
            "name": "Blue Lake Card",
            "brand": "BLUE LAKE LLC",
            "category1": "Cards",
            "category2": "Lakes"
          },
          "approval": {
            "approved": false,
            "comment": "It looks too cold!"
          }
        }
        """))
    .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
```

```csharp
using System.Net.Http.Headers;

using var client = new HttpClient();
var request = new HttpRequestMessage(new HttpMethod("POST"), "https://api.sirv.com/v2/files/meta?filename=%2FREST%20API%20Examples%2Fblue-lake.jpg");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "BEARER_TOKEN");
request.Content = new StringContent("""
{
  "tags": [
    "lake",
    "water"
  ],
  "title": "Blue Lake",
  "description": "Blue Lake in the Winter",
  "product": {
    "id": "LLBB77",
    "name": "Blue Lake Card",
    "brand": "BLUE LAKE LLC",
    "category1": "Cards",
    "category2": "Lakes"
  },
  "approval": {
    "approved": false,
    "comment": "It looks too cold!"
  }
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");
```

```php
<?php
$ch = curl_init('https://api.sirv.com/v2/files/meta?filename=%2FREST%20API%20Examples%2Fblue-lake.jpg');
curl_setopt_array($ch, [
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => ['authorization: Bearer BEARER_TOKEN', 'content-type: application/json'],
  CURLOPT_POSTFIELDS => json_encode([
    'tags' => [
      'lake',
      'water'
    ],
    'title' => 'Blue Lake',
    'description' => 'Blue Lake in the Winter',
    'product' => [
      'id' => 'LLBB77',
      'name' => 'Blue Lake Card',
      'brand' => 'BLUE LAKE LLC',
      'category1' => 'Cards',
      'category2' => 'Lakes'
    ],
    'approval' => [
      'approved' => false,
      'comment' => 'It looks too cold!'
    ]
  ]),
  CURLOPT_RETURNTRANSFER => true,
]);
echo curl_exec($ch);
```

```go
package main

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

func main() {
  body := strings.NewReader(`{
    "tags": [
      "lake",
      "water"
    ],
    "title": "Blue Lake",
    "description": "Blue Lake in the Winter",
    "product": {
      "id": "LLBB77",
      "name": "Blue Lake Card",
      "brand": "BLUE LAKE LLC",
      "category1": "Cards",
      "category2": "Lakes"
    },
    "approval": {
      "approved": false,
      "comment": "It looks too cold!"
    }
  }`)
  req, _ := http.NewRequest("POST", "https://api.sirv.com/v2/files/meta?filename=%2FREST%20API%20Examples%2Fblue-lake.jpg", body)
  req.Header.Set("authorization", "Bearer BEARER_TOKEN")
  req.Header.Set("content-type", "application/json")
  res, err := http.DefaultClient.Do(req)
  if err != nil {
    panic(err)
  }
  defer res.Body.Close()
  out, _ := io.ReadAll(res.Body)
  fmt.Println(res.Status, string(out))
}
```

```ruby
require 'net/http'

uri = URI('https://api.sirv.com/v2/files/meta?filename=%2FREST%20API%20Examples%2Fblue-lake.jpg')
req = Net::HTTP::Post.new(uri)
req['authorization'] = 'Bearer BEARER_TOKEN'
req['content-type'] = 'application/json'
req.body = <<~'JSON'
  {
    "tags": [
      "lake",
      "water"
    ],
    "title": "Blue Lake",
    "description": "Blue Lake in the Winter",
    "product": {
      "id": "LLBB77",
      "name": "Blue Lake Card",
      "brand": "BLUE LAKE LLC",
      "category1": "Cards",
      "category2": "Lakes"
    },
    "approval": {
      "approved": false,
      "comment": "It looks too cold!"
    }
  }
JSON
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
puts res.code, res.body
```

```swift
import Foundation

var request = URLRequest(url: URL(string: "https://api.sirv.com/v2/files/meta?filename=%2FREST%20API%20Examples%2Fblue-lake.jpg")!)
request.httpMethod = "POST"
request.setValue("Bearer BEARER_TOKEN", forHTTPHeaderField: "authorization")
request.setValue("application/json", forHTTPHeaderField: "content-type")
request.httpBody = #"""
{
  "tags": [
    "lake",
    "water"
  ],
  "title": "Blue Lake",
  "description": "Blue Lake in the Winter",
  "product": {
    "id": "LLBB77",
    "name": "Blue Lake Card",
    "brand": "BLUE LAKE LLC",
    "category1": "Cards",
    "category2": "Lakes"
  },
  "approval": {
    "approved": false,
    "comment": "It looks too cold!"
  }
}
"""#.data(using: .utf8)
let (data, response) = try await URLSession.shared.data(for: request)
print((response as! HTTPURLResponse).statusCode, String(decoding: data, as: UTF8.self))
```

Response

HTTP 200 with an empty body when the command succeeds.
