Skip to main content

Asset API

Upload and manage assets for AI features such as images for image processing, PDFs for document analysis, and other file types.

Overview

The Asset API provides a secure way to upload files that can be used with various AI features. Once uploaded, assets are stored with unique identifiers and can be referenced in other API calls. This API supports multiple file types and provides detailed metadata about uploaded files.

Endpoint

Authentication

All requests require authentication using an API key in the request header.

FieldValue
API-KEY<api-key>
Content-Typemultipart/form-data

Request Parameters

Required Parameters

ParameterTypeDescription
assetFileThe file to upload (images, PDFs, documents, etc.)

Example Request

const formData = new FormData();
formData.append('asset', fileInput.files[0]);

fetch('https://api.1min.ai/api/assets', {
method: 'POST',
headers: {
'API-KEY': 'YOUR_API_KEY'
},
body: formData
})
.then(response => response.json())
.then(data => console.log(data));

Response Payload

Success Response (200 OK)

{
"asset": {
"fieldname": "asset",
"originalname": "example.png",
"encoding": "7bit",
"mimetype": "image/png",
"size": 12368,
"bucket": "asset.1min.ai",
"key": "images/2024_09_30_13_38_59_100_example.png",
"acl": "private",
"contentType": "application/octet-stream",
"contentDisposition": null,
"contentEncoding": null,
"storageClass": "STANDARD",
"serverSideEncryption": null,
"metadata": {
"team-id": "307b3666-0869-4910-9d01-75fc14a08c4d",
"user-id": "52555103-410b-4ea0-881c-d6f3453f2469",
"fieldname": "asset",
"originalname": "example.png",
"encoding": "7bit",
"mimetype": "image/png"
},
"location": "https://asset.1min.ai.s3.us-east-1.amazonaws.com/images/2024_09_30_13_38_59_100_example.png",
"etag": "\"2cb9318ab87188247c8ed71e1d4078d9\""
},
"fileContent": {
"uuid": "26f30dfd-1d61-4b5b-889c-d7ab2d60d1ee",
"path": "images/2024_09_30_13_38_59_100_example.png",
"type": "png",
"name": "2024_09_30_13_38_59_100_example.png",
"content": "",
"status": "ACTIVE",
"metadata": {
"token": 0,
"character": 0
},
"createdAt": "2024-09-30T06:39:00.540Z"
}
}

Response Fields

asset Object

FieldTypeDescription
fieldnamestringForm field name used for upload
originalnamestringOriginal filename of the uploaded file
encodingstringFile encoding (e.g., "7bit")
mimetypestringMIME type of the uploaded file
sizenumberFile size in bytes
bucketstringS3 bucket name where file is stored
keystringUnique key/path for the file in storage
aclstringAccess control level ("private")
contentTypestringContent type of the stored file
contentDispositionstringContent disposition header (nullable)
contentEncodingstringContent encoding header (nullable)
storageClassstringS3 storage class (e.g., "STANDARD")
serverSideEncryptionstringServer-side encryption method (nullable)
metadataobjectAdditional metadata about the file
locationstringFull URL to access the uploaded file
etagstringEntity tag for the uploaded file

fileContent Object

FieldTypeDescription
uuidstringUnique identifier for the file record
pathstringStorage path relative to bucket
typestringFile type/extension
namestringGenerated filename in storage
contentstringText content (empty for binary files)
statusstringFile status ("ACTIVE", "INACTIVE")
metadataobjectProcessing metadata (tokens, characters)
createdAtstringFile creation timestamp (ISO 8601)

Using Uploaded Assets

Once an asset is uploaded successfully, you can use the key or path from the response in other API calls:

In AI Feature API

{
"type": "IMAGE_GENERATOR",
"model": "midjourney",
"promptObject": {
"imageUrl": "images/2024_09_30_13_38_59_100_example.png",
"mode": "fast"
}
}

Direct Access

You can also access the file directly using the location URL provided in the response (requires proper authentication).

Supported File Types

  • Images: PNG, JPEG, WEBP, GIF, SVG
  • Documents: PDF, DOC, DOCX, TXT
  • Data: JSON, CSV, XML
  • Other: Various file types depending on the AI feature requirements

Error Responses

Bad Request (400)

{
"success": false,
"error": {
"code": "BAD_REQUEST",
"message": "No file uploaded or invalid file format"
}
}

Unauthorized (401)

{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}
}

Payload Too Large (413)

{
"success": false,
"error": {
"code": "PAYLOAD_TOO_LARGE",
"message": "File size exceeds maximum limit"
}
}

Too Many Requests (429)

{
"success": false,
"error": {
"code": "TOO_MANY_REQUESTS",
"message": "Rate limit exceeded"
}
}

Rate Limits

  • Maximum file size: 50MB per upload
  • Rate limit: 100 requests per minute per API key
  • Concurrent uploads: 5 simultaneous uploads per API key

For more details about rate limits, see the Rate Limits specification.