Skip to content

Work with files

Choose the right file workflow, upload files safely, share revocable links, and attach stable file IDs to your Inttegro resources.

Files in Inttegro are durable assets with stable file_… IDs. Instead of scattering raw storage URLs across your products and support flows, you upload bytes once, keep the returned file ID, and let Inttegro control access, sharing, and lifecycle. This guide shows you when to upload directly, when to delegate uploads, how to share files safely, and which file-specific failures you should plan for.

Prerequisites

  • A file purpose chosen before upload:
    • "product_download" for downloadable product assets.
    • "product_image" for product images.
    • "product_video" for product videos.
    • "products_import" for product-catalog CSV imports with the required import schema and no more than 10,000 data rows.
    • "support_document" for support attachments and evidence.
  • A plan for where the resulting file ID will live. Product media should store returned file IDs via Create a product or Update a product, not raw third-party URLs.

Choose the right workflow

Need Use Why
Your backend already has the bytes Upload a file Multipart upload from your server.
A customer, supplier, or reviewer should send the file themselves Create an upload request Inttegro returns a purpose-bound upload URL for one delegated upload.
You need revocable public access to a stored file Create a file link Inttegro gives you a time-boxed or access-limited public URL.

Use Download file contents when delivery should stay behind your own server. Stream delivery returns the bytes in the authenticated response; redirect delivery returns a short-lived download URL in the Location header. This is the right delivery path for "product_download", "products_import", and "support_document", because file links only support "product_image" and "product_video".

Send bytes to Inttegro

Choose the upload path that matches who is actually holding the file.

Use direct upload when your backend already has the bytes—for example, when an internal admin tool uploads product artwork or when your own service is syncing downloadable assets.

Upload from your server

POST/files/create
cURLbash
curl https://api.inttegro.com/files/create \
  -H "Authorization: Bearer $INTTEGRO_API_KEY" \
  -H "Idempotency-Key: upload-hero-image-001" \
  -F "purpose=product_image" \
  -F "title=Hero image" \
  -F 'custom_data={"product_ref":"SKU-12345"}' \
  -F "file=@./hero.png;type=image/png"
TypeScripttypescript
import { InttegroClient } from '@inttegro/inttegro-sdk'

const inttegro = new InttegroClient({
  apiKey: process.env.INTTEGRO_API_KEY!,
})

const result = await inttegro.files.create({
  file: "./hero.png",
  purpose: "product_image",
  title: "Hero image",
  customData: {
    product_ref: "SKU-12345",
  },
}, {
  idempotencyKey: "upload-hero-image-001",
})
Gogo
package main

import (
  "context"
  "log"
  "os"

  inttegro "github.com/inttegro/inttegro-sdk-go/v14"
  "github.com/inttegro/inttegro-sdk-go/v14/customdata"
  "github.com/inttegro/inttegro-sdk-go/v14/file"
)

func main() {
  ctx := context.Background()
  client := inttegro.NewClient(os.Getenv("INTTEGRO_API_KEY"))

  params := file.CreateParams{
    CustomData: func() *customdata.Data { value, err := customdata.New(map[string]string{
        "product_ref": "SKU-12345",
      }); if err != nil { panic(err) }; return value }(),
    File: "./hero.png",
    Purpose: "product_image",
    Title: "Hero image",
  }
  params.IdempotencyKey = "upload-hero-image-001"
  result, err := client.Files.Create(ctx, params)
  if err != nil {
    log.Fatal(err)
  }
  _ = result
}
Pythonpython
import os

from inttegro import InttegroClient

client = InttegroClient(api_key=os.environ["INTTEGRO_API_KEY"])

result = client.files.create(
    file="./hero.png",
    purpose="product_image",
    title="Hero image",
    custom_data={
    "product_ref": "SKU-12345",
  },
    idempotency_key="upload-hero-image-001",
)
PHPphp
<?php

use Inttegro\Client;

$client = new Client($_ENV['INTTEGRO_API_KEY']);
$result = $client->files->create([
  'file' => './hero.png',
  'purpose' => 'product_image',
  'title' => 'Hero image',
  'custom_data' => [
    'product_ref' => 'SKU-12345',
  ],
], [
    'idempotency_key' => "upload-hero-image-001",
]);
Rubyruby
require "inttegro"

client = Inttegro::Client.new(api_key: ENV.fetch("INTTEGRO_API_KEY"))
result = client.files.create(
  file: "./hero.png",
  purpose: "product_image",
  title: "Hero image",
  custom_data: {
    product_ref: "SKU-12345",
  },
  idempotency_key: "upload-hero-image-001"
)
Javajava
import com.inttegro.Client;
import com.inttegro.files.FileCreateParams;
import com.inttegro.CustomData;
import com.inttegro.RequestOptions;

public class Example {
  public static void main(String[] args) throws Exception {
    var client = new Client(System.getenv("INTTEGRO_API_KEY"));
    var params = FileCreateParams.builder()
      .file("./hero.png")
      .purpose("product_image")
      .title("Hero image")
      .customData(new CustomData()
          .set("product_ref", "SKU-12345"))
      .build();
    var result = client.files().create(params, RequestOptions.withIdempotencyKey("upload-hero-image-001"));
  }
}
C#csharp
using Inttegro;

using var inttegro = new InttegroClient(
    Environment.GetEnvironmentVariable("INTTEGRO_API_KEY")!
);
var result = await inttegro.Files.CreateAsync(new {
  file = "./hero.png",
  purpose = "product_image",
  title = "Hero image",
  custom_data = new {
    product_ref = "SKU-12345",
  },
}, "upload-hero-image-001");

Use customData for your own string key-value data. metadata is returned by the API and cannot be supplied.

The response gives you a stable id. Store that ID on the Inttegro resource that needs the asset.

Use delegated upload when someone outside your backend should provide the file. Your server creates the request, then passes the returned uploadUrl to the uploader.

Create an upload request

POST/upload_requests/create
cURLbash
curl https://api.inttegro.com/upload_requests/create \
  -H "Authorization: Bearer $INTTEGRO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "purpose": "support_document",
    "constraints": {
      "max_size": 10485760,
      "content_types": ["application/pdf"],
      "extensions": [".pdf"]
    },
    "display": {
      "title": "Upload proof of purchase",
      "help_text": "Attach the PDF receipt from your order confirmation."
    },
    "recipient": {
      "type": "email",
      "email": "customer@example.com"
    },
    "resource": {
      "type": "case",
      "id": "case_123"
    },
    "expires_at": "2030-06-06T12:30:00Z"
  }'
TypeScripttypescript
import { InttegroClient, ChimeRecipientTypes } from '@inttegro/inttegro-sdk'

const inttegro = new InttegroClient({
  apiKey: process.env.INTTEGRO_API_KEY!,
})

const result = await inttegro.uploadRequests.create({
  purpose: "support_document",
  constraints: {
    maxSize: 10485760,
    contentTypes: [
      "application/pdf",
    ],
    extensions: [
      ".pdf",
    ],
  },
  display: {
    title: "Upload proof of purchase",
    helpText: "Attach the PDF receipt from your order confirmation.",
  },
  recipient: {
    type: ChimeRecipientTypes.Email,
    email: "customer@example.com",
  },
  resource: {
    type: "case",
    id: "case_123",
  },
  expiresAt: new Date("2030-06-06T12:30:00Z"),
})
Gogo
package main

import (
  "context"
  "log"
  "os"
  "time"

  inttegro "github.com/inttegro/inttegro-sdk-go/v14"
  "github.com/inttegro/inttegro-sdk-go/v14/uploadrequest"
)

func main() {
  ctx := context.Background()
  client := inttegro.NewClient(os.Getenv("INTTEGRO_API_KEY"))

  params := uploadrequest.CreateParams{
    Purpose: "support_document",
    Constraints: uploadrequest.Constraints{
      MaxSize: 10485760,
      ContentTypes: []string{
        "application/pdf",
      },
      Extensions: []string{
        ".pdf",
      },
    },
    Display: uploadrequest.Display{
      Title: "Upload proof of purchase",
      HelpText: "Attach the PDF receipt from your order confirmation.",
    },
    Recipient: uploadrequest.Party{
      Type: "email",
      Email: "customer@example.com",
    },
    Resource: uploadrequest.FileResource{
      Type: "case",
      ID: "case_123",
    },
    ExpiresAt: mustParseTime("2030-06-06T12:30:00Z"),
  }
  result, err := client.UploadRequests.Create(ctx, params)
  if err != nil {
    log.Fatal(err)
  }
  _ = result
}

func mustParseTime(value string) *time.Time {
  parsed, err := time.Parse(time.RFC3339, value)
  if err != nil {
    panic(err)
  }
  return &parsed
}
Pythonpython
import os
from datetime import datetime

import inttegro
from inttegro import InttegroClient

client = InttegroClient(api_key=os.environ["INTTEGRO_API_KEY"])

result = client.upload_requests.create(inttegro.upload_request.CreateRequest(
  purpose="support_document",
  constraints=inttegro.upload_request.ConstraintsInput(
    max_size=10485760,
    content_types=[
      "application/pdf",
    ],
    extensions=[
      ".pdf",
    ],
  ),
  display=inttegro.upload_request.DisplayInput(
    title="Upload proof of purchase",
    help_text="Attach the PDF receipt from your order confirmation.",
  ),
  recipient=inttegro.file.PartyInput(
    type=inttegro.chime.RecipientType.EMAIL,
    email="customer@example.com",
  ),
  resource=inttegro.file.ResourceInput(
    type="case",
    id="case_123",
  ),
  expires_at=datetime.fromisoformat("2030-06-06T12:30:00Z".replace("Z", "+00:00")),
))
PHPphp
<?php

use Inttegro\Client;

$client = new Client($_ENV['INTTEGRO_API_KEY']);
$result = $client->uploadRequests->create([
  'purpose' => 'support_document',
  'constraints' => [
    'max_size' => 10485760,
    'content_types' => [
      'application/pdf',
    ],
    'extensions' => [
      '.pdf',
    ],
  ],
  'display' => [
    'title' => 'Upload proof of purchase',
    'help_text' => 'Attach the PDF receipt from your order confirmation.',
  ],
  'recipient' => [
    'type' => \Inttegro\ChimeRecipientType::Email,
    'email' => 'customer@example.com',
  ],
  'resource' => [
    'type' => 'case',
    'id' => 'case_123',
  ],
  'expires_at' => '2030-06-06T12:30:00Z',
]);
Rubyruby
require "inttegro"

client = Inttegro::Client.new(api_key: ENV.fetch("INTTEGRO_API_KEY"))
result = client.upload_requests.create(
  purpose: "support_document",
  constraints: {
    max_size: 10485760,
    content_types: [
      "application/pdf",
    ],
    extensions: [
      ".pdf",
    ],
  },
  display: {
    title: "Upload proof of purchase",
    help_text: "Attach the PDF receipt from your order confirmation.",
  },
  recipient: {
    type: Inttegro::ChimeRecipientType::EMAIL,
    email: "customer@example.com",
  },
  resource: {
    type: "case",
    id: "case_123",
  },
  expires_at: "2030-06-06T12:30:00Z"
)
Javajava
import com.inttegro.Client;
import com.inttegro.files.UploadRequestCreateParams;
import com.inttegro.files.UploadConstraints;
import java.util.List;
import com.inttegro.files.UploadDisplay;
import com.inttegro.files.Actor;
import com.inttegro.files.ResourceRef;
import java.time.OffsetDateTime;

public class Example {
  public static void main(String[] args) throws Exception {
    var client = new Client(System.getenv("INTTEGRO_API_KEY"));
    var params = UploadRequestCreateParams.builder()
      .purpose("support_document")
      .constraints(UploadConstraints.builder()
          .maxSize(10485760)
          .contentTypes(List.of(
              "application/pdf"
            ))
          .extensions(List.of(
              ".pdf"
            ))
          .build())
      .display(UploadDisplay.builder()
          .title("Upload proof of purchase")
          .helpText("Attach the PDF receipt from your order confirmation.")
          .build())
      .recipient(Actor.builder()
          .type("email")
          .email("customer@example.com")
          .build())
      .resource(ResourceRef.builder()
          .type("case")
          .id("case_123")
          .build())
      .expiresAt(OffsetDateTime.parse("2030-06-06T12:30:00Z"))
      .build();
    var result = client.uploadRequests().create(params, null);
  }
}
C#csharp
using Inttegro;

using var inttegro = new InttegroClient(
    Environment.GetEnvironmentVariable("INTTEGRO_API_KEY")!
);
var result = await inttegro.UploadRequests.CreateAsync(new {
  purpose = "support_document",
  constraints = new {
    max_size = 10485760,
    content_types = new[] {
      "application/pdf",
    },
    extensions = new[] {
      ".pdf",
    },
  },
  display = new {
    title = "Upload proof of purchase",
    help_text = "Attach the PDF receipt from your order confirmation.",
  },
  recipient = new {
    type = Inttegro.ChimeRecipientType.Email,
    email = "customer@example.com",
  },
  resource = new {
    type = "case",
    id = "case_123",
  },
  expires_at = "2030-06-06T12:30:00Z",
});

The request expires after 24 hours unless you set a future expiresAt, and permits three failed attempts unless you set attempts.maxAttempts. Size values must be nonnegative and remain within the selected purpose; MIME types, extensions, and an exact filename can only narrow that purpose. See Create an upload request for the complete validation rules.

Store the returned uploadUrl securely and give it only to the uploader. It is returned once by create and is not returned by lookup, page, or cancel. Have the uploader send multipart/form-data directly to Fulfill an upload request.

Share files safely

File links are for controlled public access. They work for "product_image" and "product_video", and they let you set delivery behavior, expiry, and access limits.

The inline example keeps access.allowDownload set to true because attachment disposition is valid only when downloads are allowed. File links expire after 24 hours by default, and access.maxAccesses set to 0 means unlimited successful opens.

Create a public file link

POST/file_links/create
cURLbash
curl https://api.inttegro.com/file_links/create \
  -H "Authorization: Bearer $INTTEGRO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "file_id": "file_4q6YcQk1RzPv2mDa8nFw0sHu",
    "delivery": {
      "mode": "inline"
    },
    "access": {
      "allow_download": true,
      "max_accesses": 25
    },
    "expires_at": "2030-06-06T12:30:00Z"
  }'
TypeScripttypescript
import { InttegroClient } from '@inttegro/inttegro-sdk'

const inttegro = new InttegroClient({
  apiKey: process.env.INTTEGRO_API_KEY!,
})

const result = await inttegro.fileLinks.create({
  fileId: "file_4q6YcQk1RzPv2mDa8nFw0sHu",
  delivery: {
    mode: "inline",
  },
  access: {
    allowDownload: true,
    maxAccesses: 25,
  },
  expiresAt: new Date("2030-06-06T12:30:00Z"),
})
Gogo
package main

import (
  "context"
  "log"
  "os"
  "time"

  inttegro "github.com/inttegro/inttegro-sdk-go/v14"
  "github.com/inttegro/inttegro-sdk-go/v14/filelink"
)

func main() {
  ctx := context.Background()
  client := inttegro.NewClient(os.Getenv("INTTEGRO_API_KEY"))

  params := filelink.CreateParams{
    FileID: "file_4q6YcQk1RzPv2mDa8nFw0sHu",
    Delivery: filelink.Delivery{
      Mode: "inline",
    },
    Access: filelink.Access{
      AllowDownload: true,
      MaxAccesses: 25,
    },
    ExpiresAt: mustParseTime("2030-06-06T12:30:00Z"),
  }
  fileLink, url, err := client.FileLinks.Create(ctx, params)
  if err != nil {
    log.Fatal(err)
  }
  _ = fileLink
  _ = url
}

func mustParseTime(value string) *time.Time {
  parsed, err := time.Parse(time.RFC3339, value)
  if err != nil {
    panic(err)
  }
  return &parsed
}
Pythonpython
import os
from datetime import datetime

import inttegro
from inttegro import InttegroClient

client = InttegroClient(api_key=os.environ["INTTEGRO_API_KEY"])

result = client.file_links.create(inttegro.file_link.CreateRequest(
  file_id="file_4q6YcQk1RzPv2mDa8nFw0sHu",
  delivery=inttegro.file_link.DeliveryInput(
    mode="inline",
  ),
  access=inttegro.file_link.AccessRequest(
    allow_download=True,
    max_accesses=25,
  ),
  expires_at=datetime.fromisoformat("2030-06-06T12:30:00Z".replace("Z", "+00:00")),
))
PHPphp
<?php

use Inttegro\Client;

$client = new Client($_ENV['INTTEGRO_API_KEY']);
$result = $client->fileLinks->create([
  'file_id' => 'file_4q6YcQk1RzPv2mDa8nFw0sHu',
  'delivery' => [
    'mode' => 'inline',
  ],
  'access' => [
    'allow_download' => true,
    'max_accesses' => 25,
  ],
  'expires_at' => '2030-06-06T12:30:00Z',
]);
Rubyruby
require "inttegro"

client = Inttegro::Client.new(api_key: ENV.fetch("INTTEGRO_API_KEY"))
result = client.file_links.create(
  file_id: "file_4q6YcQk1RzPv2mDa8nFw0sHu",
  delivery: {
    mode: "inline",
  },
  access: {
    allow_download: true,
    max_accesses: 25,
  },
  expires_at: "2030-06-06T12:30:00Z"
)
Javajava
import com.inttegro.Client;
import com.inttegro.files.FileLinkCreateParams;
import com.inttegro.files.FileLinkDelivery;
import com.inttegro.files.FileLinkDeliveryMode;
import com.inttegro.files.FileLinkAccess;

public class Example {
  public static void main(String[] args) throws Exception {
    var client = new Client(System.getenv("INTTEGRO_API_KEY"));
    var expiresAt = new Time();
    var params = FileLinkCreateParams.builder()
      .fileId("file_4q6YcQk1RzPv2mDa8nFw0sHu")
      .delivery(FileLinkDelivery.builder()
          .mode(FileLinkDeliveryMode.INLINE)
          .build())
      .access(FileLinkAccess.builder()
          .allowDownload(true)
          .maxAccesses(25)
          .build())
      .expiresAt(expiresAt)
      .build();
    var result = client.fileLinks().create(params, null);
  }
}
C#csharp
using Inttegro;

using var inttegro = new InttegroClient(
    Environment.GetEnvironmentVariable("INTTEGRO_API_KEY")!
);
var result = await inttegro.FileLinks.CreateAsync(new {
  file_id = "file_4q6YcQk1RzPv2mDa8nFw0sHu",
  delivery = new {
    mode = "inline",
  },
  access = new {
    allow_download = true,
    max_accesses = 25,
  },
  expires_at = "2030-06-06T12:30:00Z",
});

Give the returned top-level url to the consumer. They open that URL via Open a file link. If access should end early, revoke it with Revoke a file link.

Attach file IDs to products

Treat Inttegro file IDs as the contract between your product catalog and stored media.

  • Use "product_image" for hero images and galleries.
  • Use "product_video" for product videos you may want to share publicly.
  • Use "product_download" for downloadable assets delivered after purchase.
  • Use "products_import" only for CSV product-catalog imports. The file must follow the required import schema, contain no more than 10,000 data rows, and stay within 32 MiB.

Store the returned file IDs on your product records through Create a product or Update a product. Do not save temporary upload URLs, local filenames, or third-party CDN URLs as your source of truth. That breaks lifecycle controls, makes deletions harder, and bypasses the purpose validation you applied at upload time.

Handle file-specific failures

File APIs return stable error codes. Use Error Codes to decide whether to ask for a different file, retry later, refresh an expired public URL, or clean up the resource that still references the file.

Type to search…

↑↓ navigate↵ selectEsc close