Skip to main content
API Reference
Cards
Files

Files are objects that represent a file hosted on Increase’s servers. The file may have been uploaded by you (for example, when uploading a check image) or it may have been created by Increase (for example, an autogenerated statement PDF). If you need to download a File, create a File Link.

Events
Your application can listen to webhooks about this resource. All of the events about Files will have the category "file.created" .
The File object
{
  "created_at": "2020-01-31T23:59:59Z",
  "description": "2022-05 statement for checking account",
  "direction": "from_increase",
  "filename": "statement.pdf",
  "id": "file_makxrc67oh9l6sg7w9yc",
  "idempotency_key": null,
  "mime_type": "application/pdf",
  "purpose": "increase_statement",
  "type": "file"
}
Attributes
created_at
string

The time the File was created.

description
string
Nullable

A description of the File.

direction
enum

Whether the File was generated by Increase or by you and sent to Increase.

filename
string
Nullable

The filename that was provided upon upload or generated by Increase.

id
string

The File’s identifier.

idempotency_key
string
Nullable

The idempotency key you chose for this object. This value is unique across Increase and is used to ensure that a request is only processed once. Learn more about idempotency.

mime_type
string

The MIME type of the file.

purpose
enum

What the File will be used for. We may add additional possible values for this enum over time; your application should be able to handle such additions gracefully.

type
string

A constant representing the object’s type. For this resource it will always be file.

List Files
curl \
  --url "${INCREASE_URL}/files" \
  -H "Authorization: Bearer ${INCREASE_API_KEY}"
import Increase from 'increase';

const client = new Increase({
  apiKey: process.env['INCREASE_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const file of client.files.list()) {
  console.log(file.id);
}
import os
from increase import Increase

client = Increase(
    api_key=os.environ.get("INCREASE_API_KEY"),  # This is the default and can be omitted
)
page = client.files.list()
page = page.data[0]
print(page.id)
require "increase"

increase = Increase::Client.new(
  api_key: ENV["INCREASE_API_KEY"] # This is the default and can be omitted
)

page = increase.files.list

puts(page)
package main

import (
	"context"
	"fmt"
	"os"

	"github.com/Increase/increase-go"
	"github.com/Increase/increase-go/option"
)

func main() {
	client := increase.NewClient(
		option.WithAPIKey(os.Getenv("INCREASE_API_KEY")), // This is the default and can be omitted
	)
	page, err := client.Files.List(context.TODO(), increase.FileListParams{})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", page)
}
package com.increase.api.example;

import com.increase.api.client.IncreaseClient;
import com.increase.api.client.okhttp.IncreaseOkHttpClient;
import com.increase.api.models.files.FileListPage;
import com.increase.api.models.files.FileListParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        IncreaseClient client = IncreaseOkHttpClient.fromEnv();

        FileListPage page = client.files().list();
    }
}
package com.increase.api.example

import com.increase.api.client.IncreaseClient
import com.increase.api.client.okhttp.IncreaseOkHttpClient
import com.increase.api.models.files.FileListPage
import com.increase.api.models.files.FileListParams

fun main() {
    val client: IncreaseClient = IncreaseOkHttpClient.fromEnv()

    val page: FileListPage = client.files().list()
}
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Increase\Client;
use Increase\Core\Exceptions\APIException;

$client = new Client(apiKey: getenv('INCREASE_API_KEY'));

try {
  $page = $client->files->list(
    createdAt: [
      'after' => new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
      'before' => new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
      'onOrAfter' => new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
      'onOrBefore' => new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
    ],
    cursor: 'cursor',
    idempotencyKey: 'x',
    limit: 1,
    purpose: ['in' => ['card_dispute_attachment']],
  );

  var_dump($page);
} catch (APIException $e) {
  echo $e->getMessage();
}
using System;
using Increase.Api;
using Increase.Api.Models.Files;

IncreaseClient client = new();

FileListParams parameters = new();

var page = await client.Files.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
Returns a list response :
{
  "data": [
    { /* File object */ },
    { /* File object */ }
    /* ... */
  ],
  "next_cursor": "v57w5d",
}
Parameters
purpose.in
array of strings

Filter Files for those with the specified purpose or purposes. For GET requests, this should be encoded as a comma-delimited string, such as ?in=one,two,three.

idempotency_key
string

Filter records to the one with the specified idempotency_key you chose for that object. This value is unique across Increase and is used to ensure that a request is only processed once. Learn more about idempotency.

Between 1 and 200 characters
More
cursor
string
limit
integer
created_at.after
string
created_at.before
string
created_at.on_or_after
string
created_at.on_or_before
string
Create a File

To upload a file to Increase, you’ll need to send a request of Content-Type multipart/form-data. The request should contain the file you would like to upload, as well as the parameters for creating a file.

curl -X "POST" \
  --url "${INCREASE_URL}/files" \
  -H "Authorization: Bearer ${INCREASE_API_KEY}" \
  -H "Content-Type: multipart/form-data" \
  -F file="@tax_form.pdf" \
  -F purpose=check_image_front
import fs from 'fs';
import Increase from 'increase';

const client = new Increase({
  apiKey: process.env['INCREASE_API_KEY'], // This is the default and can be omitted
});

const file = await client.files.create({
  file: fs.createReadStream('path/to/file'),
  purpose: 'check_image_front',
});

console.log(file.id);
import os
from increase import Increase

client = Increase(
    api_key=os.environ.get("INCREASE_API_KEY"),  # This is the default and can be omitted
)
file = client.files.create(
    file=b"Example data",
    purpose="check_image_front",
)
print(file.id)
require "increase"

increase = Increase::Client.new(
  api_key: ENV["INCREASE_API_KEY"] # This is the default and can be omitted
)

file = increase.files.create(file: StringIO.new("Example data"), purpose: :check_image_front)

puts(file)
package main

import (
	"bytes"
	"context"
	"fmt"
	"io"
	"os"

	"github.com/Increase/increase-go"
	"github.com/Increase/increase-go/option"
)

func main() {
	client := increase.NewClient(
		option.WithAPIKey(os.Getenv("INCREASE_API_KEY")), // This is the default and can be omitted
	)
	file, err := client.Files.New(context.TODO(), increase.FileNewParams{
		File:    increase.F(io.Reader(bytes.NewBuffer([]byte("Example data")))),
		Purpose: increase.F(increase.FileNewParamsPurposeCheckImageFront),
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", file.ID)
}
package com.increase.api.example;

import com.increase.api.client.IncreaseClient;
import com.increase.api.client.okhttp.IncreaseOkHttpClient;
import com.increase.api.models.files.File;
import com.increase.api.models.files.FileCreateParams;
import java.io.ByteArrayInputStream;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        IncreaseClient client = IncreaseOkHttpClient.fromEnv();

        FileCreateParams params = FileCreateParams.builder()
            .file(new ByteArrayInputStream("Example data".getBytes()))
            .purpose(FileCreateParams.Purpose.CHECK_IMAGE_FRONT)
            .build();
        File file = client.files().create(params);
    }
}
package com.increase.api.example

import com.increase.api.client.IncreaseClient
import com.increase.api.client.okhttp.IncreaseOkHttpClient
import com.increase.api.models.files.File
import com.increase.api.models.files.FileCreateParams
import java.io.ByteArrayInputStream

fun main() {
    val client: IncreaseClient = IncreaseOkHttpClient.fromEnv()

    val params: FileCreateParams = FileCreateParams.builder()
        .file("Example data".byteInputStream())
        .purpose(FileCreateParams.Purpose.CHECK_IMAGE_FRONT)
        .build()
    val file: File = client.files().create(params)
}
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Increase\Client;
use Increase\Core\FileParam;
use Increase\Core\Exceptions\APIException;

$client = new Client(apiKey: getenv('INCREASE_API_KEY'));

try {
  $file = $client->files->create(
    file: FileParam::fromString('Example data', filename: uniqid('file-upload-', true)),
    purpose: 'check_image_front',
    description: 'x',
  );

  var_dump($file);
} catch (APIException $e) {
  echo $e->getMessage();
}
using System;
using System.Text;
using Increase.Api;
using Increase.Api.Models.Files;

IncreaseClient client = new();

FileCreateParams parameters = new()
{
    File = Encoding.UTF8.GetBytes("Example data"),
    Purpose = Purpose.CheckImageFront,
};

var file = await client.Files.Create(parameters);

Console.WriteLine(file);
Parameters
description
string

The description you choose to give the File.

Between 1 and 200 characters
file
string
Required

The file contents. This should follow the specifications of RFC 7578 which defines file transfers for the multipart/form-data protocol.

purpose
enum
Required

What the File will be used for in Increase’s systems.

Retrieve a File
curl \
  --url "${INCREASE_URL}/files/file_makxrc67oh9l6sg7w9yc" \
  -H "Authorization: Bearer ${INCREASE_API_KEY}"
import Increase from 'increase';

const client = new Increase({
  apiKey: process.env['INCREASE_API_KEY'], // This is the default and can be omitted
});

const file = await client.files.retrieve('file_makxrc67oh9l6sg7w9yc');

console.log(file.id);
import os
from increase import Increase

client = Increase(
    api_key=os.environ.get("INCREASE_API_KEY"),  # This is the default and can be omitted
)
file = client.files.retrieve(
    "file_makxrc67oh9l6sg7w9yc",
)
print(file.id)
require "increase"

increase = Increase::Client.new(
  api_key: ENV["INCREASE_API_KEY"] # This is the default and can be omitted
)

file = increase.files.retrieve("file_makxrc67oh9l6sg7w9yc")

puts(file)
package main

import (
	"context"
	"fmt"
	"os"

	"github.com/Increase/increase-go"
	"github.com/Increase/increase-go/option"
)

func main() {
	client := increase.NewClient(
		option.WithAPIKey(os.Getenv("INCREASE_API_KEY")), // This is the default and can be omitted
	)
	file, err := client.Files.Get(context.TODO(), "file_makxrc67oh9l6sg7w9yc")
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", file.ID)
}
package com.increase.api.example;

import com.increase.api.client.IncreaseClient;
import com.increase.api.client.okhttp.IncreaseOkHttpClient;
import com.increase.api.models.files.File;
import com.increase.api.models.files.FileRetrieveParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        IncreaseClient client = IncreaseOkHttpClient.fromEnv();

        File file = client.files().retrieve("file_makxrc67oh9l6sg7w9yc");
    }
}
package com.increase.api.example

import com.increase.api.client.IncreaseClient
import com.increase.api.client.okhttp.IncreaseOkHttpClient
import com.increase.api.models.files.File
import com.increase.api.models.files.FileRetrieveParams

fun main() {
    val client: IncreaseClient = IncreaseOkHttpClient.fromEnv()

    val file: File = client.files().retrieve("file_makxrc67oh9l6sg7w9yc")
}
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Increase\Client;
use Increase\Core\Exceptions\APIException;

$client = new Client(apiKey: getenv('INCREASE_API_KEY'));

try {
  $file = $client->files->retrieve('file_makxrc67oh9l6sg7w9yc');

  var_dump($file);
} catch (APIException $e) {
  echo $e->getMessage();
}
using System;
using Increase.Api;
using Increase.Api.Models.Files;

IncreaseClient client = new();

FileRetrieveParams parameters = new() { FileID = "file_makxrc67oh9l6sg7w9yc" };

var file = await client.Files.Retrieve(parameters);

Console.WriteLine(file);
Parameters
file_id
string
Required

The identifier of the File.

More about Files.