Use the API to upload

Use the Akord API to upload to Arweave directly.

  1. Create your account in seconds (100 MB free to test your workflow)

Example 1.1. Minimal upload

curl --location 'https://api.akord.com/files' \
--header 'Accept: application/json' \
--header 'Api-Key: your_api_key' \
--header 'Content-Type: text/plain' \
--data '@/path/to/your/file.txt'

Thats it! You just uploaded the file to Arweave. Here is the example response:

{
    "id": "a6f1fbfc-403d-4607-b648-4b949fdd50bd", 
    //technical id of upload. can be used to get metadata of the upload or file binary from cloud storage
    
    "mime_type": "text/plain", //depends on content-type of upload, goes as a tag 
    "sizeInBytes": 10,
    "cloud": {
        "uri": "a6f1fbfc-403d-4607-b648-4b949fdd50bd", //same as ID
        "url": "https://api.akord.com/files/a6f1fbfc-403d-4607-b648-4b949fdd50bd"                 //url to binary served from cloud storage
    },
    "tx": {
        "id": "LAWVdsBRTkUF8ptiEwiU6n4Q-_5ukBJIFmeAllX7Q0E", //fixed ID of Arweave transaction (ANS-104 data item ID)
        "status": "scheduled", 
        //indicates where is your file in Arweave bundling context
        //scheduled - file is in our cloud storage and is scheduled for ANS-104 
        //verification - file is being verified for malicious content
        //blocked - file is recognized as malicious, won't go to Arweave
        //pending - file was bundled and posted to Arweave
        //confirmed - file is confirmed on Arweave
        //rejected - this indicates a technical problem with our bundling service)
        "tags": [], //your Arweave tags appended to transaction
        "statusUrl": "https://api.akord.com/files/a6f1fbfc-403d-4607-b648-4b949fdd50bd/status", //check file status endpoint, returns simillar JSON schema
        "gatewayUrls": [
            "https://akrd.net/LAWVdsBRTkUF8ptiEwiU6n4Q-_5ukBJIFmeAllX7Q0E", 
            //our instance of Arweave gateway - this url will work always, even right after upload since it falls back to cloud storage when file is not yet on Arweave
            "https://arweave.net/LAWVdsBRTkUF8ptiEwiU6n4Q-_5ukBJIFmeAllX7Q0E" 
            // other Arweave gatways
        ]
        "viewblockUrl": "https://viewblock.io/arweave/tx/LAWVdsBRTkUF8ptiEwiU6n4Q-_5ukBJIFmeAllX7Q0E", //see your file on Viewblock - this url will only work when file is in 'committed' status & indexed by Viewblock
        "info": "Transaction is visible on the blockchain indexers when in the \"committed\" status.",
        "infoUrl": "https://docs.akord.com/api-and-dev-tools/build/akord-api/files"
    }
}

Example 1.2. Upload with Arweave transaction tags

To add tags to your Arweave transaction - use query params. Each query param with key prefixed with tag- is treated as Arweave transaction tags. Tags query params are case sensitive. E.g.

tag-file-category=photo => Tag name: 'file-category', Tag value: 'photo'

Tag-File-Category=PHOTO => Tag name: 'File-Category', Tag value: 'PHOTO'

curl --location 'https://api.akord.com/files?tag-file-category=photo&tag-file-description=wedding%202024' \
--header 'Accept: application/json' \
--header 'Api-Key: your_api_key' \
--header 'Content-Type: image/png' \
--data '@/path/to/your/file.png'
{
    "id": "a2a48bc6-7e9f-48c6-abc7-9e641390680b",
    "mimeType": "image/png",
    "sizeInBytes": 437432,
    "cloud": {
        "uri": "a2a48bc6-7e9f-48c6-abc7-9e641390680b",
        "url": "https://api.akord.com/files/a2a48bc6-7e9f-48c6-abc7-9e641390680b"
    },
    "tx": {
        "id": "ewR2EcQJOSAN-dH0GZVswOG_g_kjtFh_dUSrjpbd_Lo",
        "status": "scheduled",
        "tags": [
            {
                "name": "file-category",
                "value": "photo"
            },
            {
                "name": "file-description",
                "value": "wedding 2024"
            }
        ],
        "statusUrl": "https://api.akord.com/files/a2a48bc6-7e9f-48c6-abc7-9e641390680b/status",
        "gatewayUrls": [
            "https://akrd.net/ewR2EcQJOSAN-dH0GZVswOG_g_kjtFh_dUSrjpbd_Lo",
            "https://arweave.net/ewR2EcQJOSAN-dH0GZVswOG_g_kjtFh_dUSrjpbd_Lo"
        ],
        "viewblockUrl": "https://viewblock.io/arweave/tx/ewR2EcQJOSAN-dH0GZVswOG_g_kjtFh_dUSrjpbd_Lo",
        "info": "Transaction is visible on the blockchain indexers when in the \"committed\" status.",
        "infoUrl": "https://docs.akord.com/api-and-dev-tools/build/akord-api/files"
    }
}

Example 1.3. Upload with Arweave transaction tags (encoded)

You may encode your tags as base64 string and pass it as a single param

base64_encoded_tags=$(echo -n '[
    {
        "name": "file-category",
        "value": "photo"
    },
    {
        "name": "file-description",
        "value": "wedding 2024"
    }
]' | base64)

# Use in querystring
curl --location 'https://api.akord.com/files?tags=$base64_encoded_tags' \
--header 'Accept: application/json' \
--header 'Api-Key: your_api_key' \
--header 'Content-Type: image/png' \
--data '@/path/to/your/file.png'

# Or use in header
curl --location 'https://api.akord.com/files' \
--header 'Accept: application/json' \
--header 'Api-Key: your_api_key' \
--header 'Content-Type: image/png' \
--header 'Tags: $base64_encoded_tags' \
--data '@/path/to/your/file.png'

Check out examples of multipart uploads for larger files here:

Last updated