Views

1. List Views

Returns a list of all views.

  • URL: /lighthouse/orgs/{org_id}/businesses/{business_id}/workspaces/{workspace_id}/views

  • Method: GET

  • Description: Retrieves a non-paginated list of views.

Query Params

Name
Type
Required
Description

Example Request

curl -X GET https://api.piercloud.io/lighthouse/orgs/{org_id}/businesses/{business_id}/workspaces/{workspace_id}/views \
     -H "Authorization: Bearer  "

Successful Response (200 OK)

{
  "code": "success",
  "data": {
    "views": [
      {
        "id": 1,
        "name": "View name",
        "description": null,
        "created_at": "2025-01-01T00:00:00.911Z"
      }
    ],
    "total": 1
  }
}

Error Response (400 Bad Request)

{
  "code": "bad-request/invalid-parameters",
  "message": "error message"
}

Error Response (401 Unauthorized)

{
  "code": "failed",
  "message": "invalid or expired token"
}

Error Response (403 Forbidden)

{
  "code": "authorization/forbidden",
  "message": "Unable to give access to the user"
}

2. Access View Information

Returns information about a specific view.

  • URL: /lighthouse/orgs/{org_id}/businesses/{business_id}/views/{id}

  • Method: GET

  • Description: Returns information about a single view.

Query Params

Name
Type
Required
Description

Example Request

curl -X GET https://api.piercloud.io/lighthouse/orgs/{org_id}/businesses/{business_id}/views/{id} \
     -H "Authorization: Bearer  "

Successful Response (200 OK)

{
  "code": "success",
  "data": {
    "id": 123,
    "name": "View name",
    "description": null,
    "workspace": {
      "id": 1234,
      "name": "Workspace name"
    }
  }
}

Error Response (400 Bad Request)

{
  "code": "bad-request/invalid-parameters",
  "message": "error message"
}

Error Response (401 Unauthorized)

{
  "code": "failed",
  "message": "invalid or expired token"
}

Error Response (403 Forbidden)

{
  "code": "authorization/forbidden",
  "message": "Unable to give access to the user"
}

Error Response (404 Not Found)

{
  "code": "view/not-found",
  "message": "View not found"
}

3. Get View Data

  • URL: /lighthouse/orgs/{org_id}/businesses/{business_id}/views/{id}/data

  • Method: GET

  • Description: Returns the access token and other information based on the provided credentials.

Query Params

Name
Type
Required
Description

start_date

date

No

Start date of the period (YYYY-MM-DD). Default: Beginning of the current month

end_date

date

No

End date of the period (YYYY-MM-DD). Default: End of the current month

date_type

string

No

Enter "month" if you want to filter by competence (monthly basis), or "date" if you want to filter by a specific date.

filters

JSON

No

Enter the filters you want to add to the view, following the JSON format according to the example below.

Example of JSON filters

[
    {
        "name": "lineitem/usageaccountid",
        "data_type": "string",
        "role": "filter",
        "filters": [
            {
                "expression": "IS",
                "value": ["12345678901"],
                "negative_expression": false
            }
        ]
    }
]
Column
Type
Required
Description

name

string

Yes

Name of the column you want to filter

data_type

string

Yes

Enter the column type. Possible values: "string", "number", and "date".

role

string

Yes

Enter the rule type. Possible value: "filter".

filters.expression

string

Yes

Enter the filter expression. Possible values: "IS", "CONTAINS".

filters.value

Array<string>

Yes

Enter the values you want to filter by.

filters.negative_expression

Boolean

No

Specify if you want to apply a negation expression.

Example Request

curl -X GET https://api.piercloud.io/lighthouse/orgs/{org_id}/businesses/{business_id}/views/{id}/data \
     -H "Authorization: Bearer  "

Successful Response (200 OK)

{
    "code": "success",
    "data": [
        {
            "key_1": "value_1",
            "key_2": "value_2",
            "key_3": "value_3"
            ...
        }
    ]
}

Error Response (400 Bad Request)

{
  "code": "bad-request/invalid-parameters",
  "message": "error message"
}

Error Response (401 Unauthorized)

{
  "code": "failed",
  "message": "invalid or expired token"
}

Error Response (403 Forbidden)

{
  "code": "authorization/forbidden",
  "message": "Unable to give access to the user"
}

Error Response (404 Not Found)

{
  "code": "view/not-found",
  "message": "View not found"
}

Last updated