Blocks: Create

Description

Add a block to a case.

See the Get Block API to learn more about case blocks.

Request

HTTP Method: POST

Parameter Description
title The title of the block.
block_type The type of block to create - options: note, file, linked_cases, metadata, closure_conditions, case_action, block_group and html.
color Optional The color of the block - options: primary, white, gold, magenta, green, blue, red, mint, indigo. Only note, file, block_group and html blocks can be colored.
elements Optional An array of elements to add to the block.
position Optional The zero-indexed position of the block in the case.
hidden Optional A boolean (true or false).
block_group_id Optional The ID or slug of a group block to nest this block within. Slugs are prefixed with blk_ (e.g. blk_my_group).
author_email Optional The email address of the author of the block.

white and primary are interchangeable names for the default color: note and html blocks report it as white, while file and block group blocks report it as primary.

Element Parameters

Note Element Parameters

Parameter Description
content The content of the note.
note_type The type of note - "html" for html blocks and "text" for any others.
color Optional The color of the note - options: white, gold, magenta, green, blue, red, mint, indigo. Deprecated: Set color on the block instead.

File Element Parameters

Parameter Description
filename The name of the file.
file_contents The base64-encoded contents of the file.
annotation Optional The annotation text for the file.
Path Parameter Description
case_id The ID of the case.

Sample request for a note block

curl -X POST \
  https://<tenant-domain>/api/v2/cases/<<case_id>>/blocks \
  -H 'content-type: application/json' \
  -H 'Authorization: Bearer <<CREDENTIAL.tines_api_key>>' \
  -d '{
        "title": "My Note Block",
        "block_type": "note",
        "author_email": "jane@tines.io",
        "color": "blue",
        "elements": [
          {
            "content": "This is a note element",
            "note_type": "text"
          }
        ],
        "position": 0
      }'

Sample request for a file block

curl -X POST \
  https://<tenant-domain>/api/v2/cases/<<case_id>>/blocks \
  -H 'content-type: application/json' \
  -H 'Authorization: Bearer <<CREDENTIAL.tines_api_key>>' \
  -d '{
        "title": "My File Block",
        "block_type": "file",
        "color": "mint",
        "elements": [
          {
            "filename": "example.txt",
            "file_contents": "SGVsbG8gV29ybGQ="
          }
        ],
        "position": 1
      }'

Response

A successful request will return a JSON object describing the created block.

Field description

Parameter Description
block The block object.
Block Parameter Description
id The ID of the block record attached to the case.
slug A human-readable identifier for the block, prefixed with blk_. Auto-generated from the block title.
title The title of the block.
block_type The type of the block - options: note, file, linked_cases, metadata, closure_conditions, case_action, block_group and html.
color The color of the block. Only present on note, file, block_group and html blocks.
position The position of the block in the case.
hidden Boolean indicating whether the block is hidden.
block_group_id The ID of the block group this block is nested in.
elements An array of elements contained within the block.
created_at ISO 8601 Timestamp representing creation date and time.
updated_at ISO 8601 Timestamp representing last updated date and time.

Common Element Parameters

Parameter Description
element_id The unique ID of this element within the current block.
id The original/source ID of the element.
element_type The type of the element - options: note, file.
author Details of the author of the element.
created_at ISO 8601 Timestamp representing creation date and time.
updated_at ISO 8601 Timestamp representing last updated date and time.
Author parameter Description
user_id The user ID.
first_name The user's first name.
last_name The user's last name.
email The user's email address.
avatar_url The user's avatar url.
is_service_account Whether this user is a service account (true/false).

Note Element Parameters

Parameter Description
content The content of the note.
note_type The type of note - "html" for html blocks and "text" for any others.
color The color of the note - options: white, gold, magenta, green, blue, red, mint, indigo.

File Element Parameters

Parameter Description
file Object containing file information (filename and url).

Sample response for a note block

{
  "block": {
    "id": 123,
    "slug": "blk_my_note_block",
    "title": "My Note Block",
    "block_type": "note",
    "color": "blue",
    "position": 0,
    "hidden": false,
    "block_group_id": null,
    "elements": [
      {
        "element_id": 456,
        "id": 123,
        "element_type": "note",
        "content": "This is a note element",
        "note_type": "text",
        "color": "blue",
        "author": {
          "user_id": "1",
          "first_name": "Jane",
          "last_name": "Doe",
          "email": "jane@tines.io",
          "avatar_url": "example.com/avatar",
          "is_service_account": false
        },
        "created_at": "2025-01-07T11:42:58Z",
        "updated_at": "2025-01-07T11:42:58Z"
      }
    ],
    "created_at": "2025-01-07T11:42:58Z",
    "updated_at": "2025-01-07T11:42:58Z"
  }
}
Was this helpful?
Blocks: Create | API | Tines