> This page is for version 2024-10-01 (default).
> For other versions, use one of these documentation indexes:
> - 2024-10-01 (default): https://docs.getkard.com/2024-10-01/llms.txt
> - Legacy: https://docs.getkard.com/legacy/llms.txt

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

# Get Files

GET https://rewards-api.getkard.com/v2/issuers/{organizationId}/files/metadata

Retrieves metadata for files associated with a specific issuer/organization.
This endpoint supports pagination and sorting options to efficiently navigate
through potentially large sets of file metadata.
Required scopes: `files.read`

Reference: https://docs.getkard.com/api/files/get-metadata

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Servers

- `https://rewards-api.getkard.com` (Production, default)
- `https://test-rewards-api.getkard.com` (Sandbox)

## Request

### Path parameters

- `organizationId` (string, required) — Your issuer organization ID, provided by Kard

### Query parameters

- `filter[dateFrom]` (string, optional) — Start date for filtering files (format ISO8601). If not provided, defaults to current date minus 1 month.
- `filter[dateTo]` (string, optional) — End date for filtering files (format ISO8601). If not provided, defaults to current date.
- `filter[fileType]` (enum, optional) — The document file type.
  - Allowed values: `earnedRewardApprovedDailyReconciliationFile`, `earnedRewardSettledDailyReconciliationFile`, `monthlyReconciliationFile`
- `page[size]` (integer, optional) — Number of items per page. Defaults to 10 if not specified and maximum value allowed 100 items per page.
- `page[after]` (string, optional) — Cursor for forward pagination (next page).
- `page[before]` (string, optional) — Cursor for backward pagination (previous page).
- `sort` (enum, optional) — If provided, response will be sorted by the specified fields. Defaults to descending sentDate, equivalent to "-sentDate"
  - Allowed values: `sentDate`, `-sentDate`

## Response

### 200

- `data` (list of FileMetadataWithURL, required) — List of file metadata objects with their pre-signed URLs.
- `links` (Links, required) — Navigation links for paginated results.
- `meta` (PaginationMeta, required) — Metadata about the pagination status.

## Errors

### 403 Forbidden Error

- `errors` (list of ErrorObject, required)

### 500 Internal Server Error

- `errors` (list of ErrorObject, required)

### 400 Invalid Request

- `errors` (list of ErrorObject, required)

### 401 Unauthorized Error

- `errors` (list of ErrorObject, required)

## Types

### FileMetadataWithURL

- `type` (enum, required) — The type of the generated file.
  - Allowed values: `earnedRewardApprovedDailyReconciliationFile`, `earnedRewardSettledDailyReconciliationFile`, `monthlyReconciliationFile`
- `attributes` (FileMetadataAttribute, required) — Attributes of the filetype
- `id` (string, required) — The File ID in Kard’s system

### Links

Related links to the API call

- `self` (string, required)
- `prev` (string, optional)
- `next` (string, optional)

### PaginationMeta

- `pageSize` (integer, required) — Number of items per page.
- `hasNextPage` (boolean, required) — Indicates if there are more pages available after the current one.

### ErrorObject

- `status` (string, required) — Status code returned from the request
- `title` (string, required) — Name of error
- `detail` (string, required) — Description of the specific occurance of the error
- `source` (ErrorSource, optional) — An object containing a reference to the primary source of the error
- `id` (string, optional) — The id of the resource which caused the error. Always returned for multi-status errors.

### FileMetadataAttribute

- `fileName` (string, required) — The name of the file.
- `sentAt` (string, required) — ISO 8601 timestamp (ISO8601) when the file was originally sent/created.
- `lastModified` (string, required) — ISO 8601 timestamp (ISO8601) when the file was last modified.
- `downloadUrl` (string, required) — Temporary URL that provides direct access to download the file for 30 minutes.

### ErrorSource

- `pointer` (string, optional) — A JSON pointer to the value in the request document that caused the error
- `parameter` (string, optional) — A string indicating which URI query parameter caused the error
- `header` (string, optional) — A string indicating the name of a single request header which caused the error

## Examples

**Response**

```json
{
  "data": [
    {
      "type": "earnedRewardApprovedDailyReconciliationFile",
      "attributes": {
        "fileName": "test-file-10.jsonl",
        "sentAt": "2025-03-09T21:56:23Z",
        "lastModified": "2025-03-19T21:56:23Z",
        "downloadUrl": "https://default-bucket.s3.us-east-1.amazonaws.com/test-file-10.jsonl?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Checksum-Mode=ENABLED&X-Amz-Credential=test%2F20250320%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250320T172109Z&X-Amz-Expires=1800&X-Amz-SignedHeaders=host&x-id=GetObject&X-Amz-Signature=c2a7dc6d14d0465b9ba9c24d47574a6bbcfa57856529319f25424c6bb1cf5204"
      },
      "id": "67db3d87cb70469be876c852049"
    }
  ],
  "links": {
    "self": "/v2/files/issuers/0004321/metadata?page%5Bafter%5D=MjAyNS0wMy0xMFQyMTo1NjoyMy40OTY4ODda&page%5Bsize%5D=5&sort%5Bsent_at%5D=DESC",
    "prev": "/v2/files/issuers/0004321/metadata?page%5Bbefore%5D=MjAyNS0wMy0wOVQyMTo1NjoyMy40OTY4ODda&page%5Bsize%5D=5&sort%5Bsent_at%5D=DESC",
    "next": "/v2/files/issuers/0004321/metadata?page%5Bafter%5D=MjAyNS0wMy0wNVQyMTo1NjoyMy40OTY4ODda&page%5Bsize%5D=5&sort%5Bsent_at%5D=DESC"
  },
  "meta": {
    "pageSize": 5,
    "hasNextPage": true
  }
}
```

**SDK Code**

```python
import requests

url = "https://rewards-api.getkard.com/v2/issuers/organization-123/files/metadata"

querystring = {"page[size]":"5","filter[dateFrom]":"2025-02-20T21:56:23Z","filter[dateTo]":"2025-03-20T21:56:23Z","filter[fileType]":"earnedRewardApprovedDailyReconciliationFile","sort":"-sentDate"}

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

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

print(response.json())
```

```javascript
const url = 'https://rewards-api.getkard.com/v2/issuers/organization-123/files/metadata?page%5Bsize%5D=5&filter%5BdateFrom%5D=2025-02-20T21%3A56%3A23Z&filter%5BdateTo%5D=2025-03-20T21%3A56%3A23Z&filter%5BfileType%5D=earnedRewardApprovedDailyReconciliationFile&sort=-sentDate';
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://rewards-api.getkard.com/v2/issuers/organization-123/files/metadata?page%5Bsize%5D=5&filter%5BdateFrom%5D=2025-02-20T21%3A56%3A23Z&filter%5BdateTo%5D=2025-03-20T21%3A56%3A23Z&filter%5BfileType%5D=earnedRewardApprovedDailyReconciliationFile&sort=-sentDate"

	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://rewards-api.getkard.com/v2/issuers/organization-123/files/metadata?page%5Bsize%5D=5&filter%5BdateFrom%5D=2025-02-20T21%3A56%3A23Z&filter%5BdateTo%5D=2025-03-20T21%3A56%3A23Z&filter%5BfileType%5D=earnedRewardApprovedDailyReconciliationFile&sort=-sentDate")

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://rewards-api.getkard.com/v2/issuers/organization-123/files/metadata?page%5Bsize%5D=5&filter%5BdateFrom%5D=2025-02-20T21%3A56%3A23Z&filter%5BdateTo%5D=2025-03-20T21%3A56%3A23Z&filter%5BfileType%5D=earnedRewardApprovedDailyReconciliationFile&sort=-sentDate")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://rewards-api.getkard.com/v2/issuers/organization-123/files/metadata?page%5Bsize%5D=5&filter%5BdateFrom%5D=2025-02-20T21%3A56%3A23Z&filter%5BdateTo%5D=2025-03-20T21%3A56%3A23Z&filter%5BfileType%5D=earnedRewardApprovedDailyReconciliationFile&sort=-sentDate', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://rewards-api.getkard.com/v2/issuers/organization-123/files/metadata?page%5Bsize%5D=5&filter%5BdateFrom%5D=2025-02-20T21%3A56%3A23Z&filter%5BdateTo%5D=2025-03-20T21%3A56%3A23Z&filter%5BfileType%5D=earnedRewardApprovedDailyReconciliationFile&sort=-sentDate");
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://rewards-api.getkard.com/v2/issuers/organization-123/files/metadata?page%5Bsize%5D=5&filter%5BdateFrom%5D=2025-02-20T21%3A56%3A23Z&filter%5BdateTo%5D=2025-03-20T21%3A56%3A23Z&filter%5BfileType%5D=earnedRewardApprovedDailyReconciliationFile&sort=-sentDate")! 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()
```