Skip to content
Browse all functions

Convert Asset into Base64 String

files/asset2base64

asset2base64 (Convert Asset into Base64 String) is a 1001fx API function in the group Files & PDF: POST https://api.1001fx.com/files/asset2base64, 3 credits per call. It works as a ready-made module in Make and n8n or as a plain HTTP call.

3 credits per callHTTP APIn8nMake

Converts an uploaded asset (image, zip, audio, video, pdf, ...) or loads and converts the asset from the given URL to a base64 string.

Try it in the 1001fx app

Run asset2base64 in your browser with your API key – fill the form, click Run and get the answer or the file.

asset2base64 in the 1001fx app: the form with example values
Convert Asset into Base64 String in the 1001fx app

Endpoint

POSThttps://api.1001fx.com/files/asset2base64
Header
X-API-KEY: YOURSECRETAPIKEY How to
Content type
multipart/form-data

Parameters

  • urlstringoptional

    The URL of the asset to be converted into a base64 string.

    Example:
    https://api.1001fx.com/testdata/image.png
  • addPrefixbooleanoptional

    Specifies if the prefix 'data:MimeType;base64,' should be added to the result string. Default is true.

    Default:
    true
    Example:
    true
  • filefileoptional

    Asset file to be processed.

Examples

Convert Asset into Base64 String

Uploads an asset

Input

Expects one file named as file parameter: file
{
  "files": [
    {
      "name": "1600x900.png",
      "type": "image/png",
      "path": "testdata/images/1600x900.png"
    }
  ]
}

Output · HTTP 200

Result is a single file.
{
  "statusCode": 200
}
Show curl command
curl -X POST 'https://api.1001fx.com/files/asset2base64' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -F 'file=@1600x900.png'

Convert Asset from URL into Base64 String

Converts a file from url to a base64 string.

Input

Expects an url
{
  "url": "https://api.1001fx.com/testdata/image.png"
}

Output · HTTP 200

Result is a single file.
{
  "statusCode": 200
}
Show curl command
curl -X POST 'https://api.1001fx.com/files/asset2base64' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -F 'url=https://api.1001fx.com/testdata/image.png'

Use cases

Try asset2base64 now

Run it in your browser or create a free account and get 100 credits every month.

Changelog

  • 1.0.031.03.2023created
Ask 1001fx