How to upload files to Bika and update record via API

This guide will walk you through the process using cURL to upload local files and attach them to Bika records with simple terminal commands.

:pushpin: Prerequisites

  • A Bika account with API access
  • An Access Token (generate via Bika’s developer settings)
  • A local file to upload (e.g., example.png)
  • Terminal or command-line tool

Step 1: Prepare Your Bika Environment

Create a space and database:

Ensure your database has a field for attachments (e.g., Images).

Get Required IDs:

  • SPACE_ID: Found in Bika’s space URL (e.g., https://bika.ai/space/{SPACE_ID}).
  • NODE_ID: Identifier for your database. Check Bika’s URL.
  • RECORD_ID: ID of the target record to update.

Step 2: Upload a File to Bika workspace

Run this cURL command to upload your file and save the data in response for the next step:

curl 'https://bika.ai/api/openapi/bika/v1/spaces/{SPACE_ID}/attachments' \  
  -H "Authorization: Bearer {YOUR_ACCESS_TOKEN}" \  
  -F 'file=@./example.png'  

Response Example:

{
    "success": true, 
    "code": 200, 
    "message": "SUCCESS", 
    "data": [
        {
            "id": "attpcZFhfBmt6KFA4MbKKoO1", 
            "path": "openapi/teCC2LGpyEOUWZsXET9I6.png", 
            "size": 211047, 
            "bucket": "bika", 
            "mimeType": "image/png", 
            "name": "teCC2LGpyEOUWZsXET9I6.png"
        }
    ]
}

Step 3: Attach the File to a Record

Use a PATCH request to update the record with the uploaded attachment:

curl -X PATCH "https://bika.ai/api/openapi/bika/v1/spaces/{SPACE_ID}/resources/databases/{NODE_ID}/records" \  
  -H "Authorization: Bearer {YOUR_ACCESS_TOKEN}" \  
  -H "Content-Type: application/json" \  
  -d '{  
      "cells": {  
          "attachmentField": [  
              {  
                "id": "attpcZFhfBmt6KFA4MbKKoO1",  
                "path": "openapi/teCC2LGpyEOUWZsXET9I6.png",  
                "size": 211047,  
                "bucket": "bika",  
                "mimeType": "image/png",  
                "name": "teCC2LGpyEOUWZsXET9I6.png"  
              }  
          ]  
      },
      "id": "{RECORD_ID}"
  }'  

:key: Key Notes

1. Replace Placeholders:

  • {SPACE_ID}, {NODE_ID}, {RECORD_ID}, {YOUR_ACCESS_TOKEN}
  • attachmentField : Match your Bika database’s attachment field name (e.g., Images).

2. Multiple Attachments:

Add more objects to the array:

"attachmentField": [  
  { "id": "att1", "path": "...", ... },  
  { "id": "att2", "path": "...", ... }  
]

:rotating_light: Troubleshooting

  • 401 Unauthorized: Invalid or expired access token.
  • Not Found: Verify SPACE_ID, NODE_ID, or RECORD_ID values.
  • Field {key} not found: Ensure the attachment field exists in your Bika database.

thank you for the great post!

PUT seems to lead in 404, however PATCH works.

yes, you are right, it’s PATCH :laughing:

Hi @Kelvin @Thea - I am not very technical, so when I see commands or terminals, it makes it more complicated. Any chance you can provide an example with make.com please?

Hey there! Totally get that techy stuff can be overwhelming. Just to clarify, Bika isn’t officially on Make.com yet, so you won’t find pre-built options for it there. But no worries - you could try using Make’s HTTP module to send requests manually.

I don’t use Make.com much myself, but I found their HTTP docs (https://apps.make.com/http) and a YouTube tutorial (https://youtu.be/CFl-kQ07sVM) that might help with POST requests and file uploads. Maybe you can adapt the cURL examples from our docs into Make’s interface by setting headers and parameters manually? The setup process looks similar to other no-code tools I’ve seen. Don’t stress if it takes a few tries - these API things always have a learning curve! :sweat_smile:

1 Like

Thank you, but I know how to make the HTTP request, this is not a problem. I would need help with specifically Bika.

(Can’t upload images because of your settings for new users)

I’m trying to move away from monday.com, but in Monday it’s literally one simple action - “upload a file”, no tech set up needed. Any expectation for this to be the case here?

Please clarify what the highlighted IDs are and where I get them from:

-d '{
“cells”: {
“attachmentField”: [
{
“id”: “attpcZFhfBmt6KFA4MbKKoO1”,
“path”: “openapi/teCC2LGpyEOUWZsXET9I6.png”,
“size”: 211047,
“bucket”: “bika”,
“mimeType”: “image/png”,
“name”: “teCC2LGpyEOUWZsXET9I6.png”
}
]
},
“id”: “recif5tp0iMl4y6JHwIaCtvm”

The id here is the attachment ID assigned by Bika after a successful upload.

The path is a relative path - you can directly access the attachment by combining it with our domain, like: https://s1.bika.ai/openapi/teCC2LGpyEOUWZsXET9I6.png.

The name is just a randomly generated string we use for storage.

The bottom id (recif5tp0iMl4y6JHwIaCtvm) is actually the record ID - this tells our system which database record to attach this file to, as explained in the tutorial above.

BTW that whole JSON block with attachment details gets automatically returned when you use our upload API (no need to edit it manually).
If you’re stuck, just revisit step 2/3 in the tutorial at the top of this post - it shows exactly where these IDs come from.

1 Like

Hi team,

Thank you, but it’s still a bit more complex than I can follow. We have a Tier 5 plan from AppSumo, and as you can imagine, if we’re unable to use the tool to its fullest (need to be able to upload attachments), we may need to request a refund unfortunately.

Would someone on your team be able to create a short video, demo, or step-by-step guide on how to upload files using Make.com?

I’m sure many Make.com users would benefit from it as well.

Thank you!