Views

These endpoints allow you to programmatically interact with your views. You can create a view by going to the Explore page in Autoblocks:


GEThttps://api.autoblocks.ai/views

Get a list of views

This endpoint returns a list of all of your views. It is useful for getting the id of a view so that you can use other endpoints that require a view's id.

Code samples for getting a list of views

GET
https://api.autoblocks.ai/views
curl 'https://api.autoblocks.ai/views' \
  --header "Authorization: Bearer $AUTOBLOCKS_API_KEY"
[
  {
    "id": "cljzx8zhd00077w3sqredd0fz",
    "name": "My First View"
  }
]
GEThttps://api.autoblocks.ai/views/<viewId>/traces

Get a list of traces for a view

This endpoint allows you to paginate through traces from a given view. Traces are returned in descending order based on the trace's starting timestamp, and within a trace, events are in ascending order based on the event's timestamp. The nextCursor property returned in the response can be used to get the next page of traces. When there are no more traces, nextCursor will not be defined.

Query parameters

  • Name
    pageSize
    Type
    string (required)
    Description

    How many traces to return per page. Must be an integer between 1 and 100.

  • Name
    cursor
    Type
    string
    Description

    Optional field used for paginating through traces. This should be set to the nextCursor field returned from the previous request.

Code samples for getting a list of traces from a view

GET
https://api.autoblocks.ai/views/<viewId>/traces
curl 'https://api.autoblocks.ai/views/cljzx8zhd00077w3sqredd0fz/traces?pageSize=10' \
  --header "Authorization: Bearer $AUTOBLOCKS_API_KEY"
{
  "nextCursor": "eyJ0aW1lc3RhbXAiOiIyMDIzLTAxLTAxVDAwOjAwOjAxLjEyM1oiLCJldmVudElkIjoiZXZlbnQtMSJ9",
  "traces": [
    {
      "id": "b3f8c1c0-9b0b-11eb-8dcd-0242ac130003",
      "events": [
        {
          "id": "cljzxfcxr00077w1yvis84a72",
          "traceId": "b3f8c1c0-9b0b-11eb-8dcd-0242ac130003",
          "timestamp": "2021-04-08T18:00:00.000Z",
          "message": "model.input",
          "properties": {
            "input": "Write me a poem"
          }
        }
      ]
    }
  ]
}