For Developers

Create File

POST https://ed.link/api/v2/graph/classes/:class_id/files

Upload a new File to be associated with a Class.

Request Parameters

ParameterTypeDescription
class_idstringThe UUID of the desired Class.

Request Body

The are two required fields:

  • title is typically the filename, but can be any alphanumeric string. We recommend avoiding emojis, and other esoteric UTF-8 codepoints, since not all underlying LMSs will accept "strange" names.
  • data a Uint8Array of the file contents.

See our guide on Uploading Files to learn how to generate the data array from a file.

There is one optional field, size which must be a number matching the number of bytes in data (i.e. the length of the data array). If size does not match the data, we will issue a warning and ignore the size field.

To send a sample plain text file with the contents of hello the json payload would look like:

{
    "title": "mysamplefile.txt",
    "size": 5,
    "data": [104, 101, 108, 108, 111]
}

Sample Request

axios.post(
    `https://ed.link/api/v2/graph/classes/${class_id}/files`,
    {
        title: 'mysamplefile.txt',
        size: 5,
        data: [104, 101, 108, 108, 111]
    },
    {
        headers: {
            authorization: `Bearer ${integration_access_token}`
        }
    }
);

Response Data

On success, this endpoint returns a normal File object.

{
    "$request": "00000000-0000-0000-0000-000000000000",
    "$data": {
        "type": "file",
        "title": "mysamplefile.txt",
        "description": "",
        "url": "https://ed.link/api/v2/graph/classes/11111111-1111-1111-1111-111111111111/files/22222222-2222-2222-2222-222222222222/download",
        "size": 5,
        "thumbnail_url": null,
        "created_date": "2025-07-21T20:02:32.000Z",
        "updated_date": "2025-07-21T20:02:32.000Z",
        "share_mode": "view",
        "identifiers": [
            {
                "type": "canvas_id",
                "value": "123"
            }
        ],
        "rule_ids": [],
        "references": {},
        "id": "22222222-2222-2222-2222-222222222222"
    }
}