Almost every action performed in the Custom Portal UI has a corresponding REST API endpoint. This means you can programmatically create and manage content and use Custom Portal as a data source.

Base URL

https://{custom_portal_url}/api

Endpoints and Methods

Custom Portal has Swagger documentation at /docs. You can see all the API endpoints and test them using the Swagger UI.

Responses

Custom Portal's APIs return data in JSON format. Here is an example from /blocks:

[
  {
    "name": "HTML 20",
    "type": "html",
    "data": {
      "__source__": "",
      "columns": []
    },
    "css": [
      "iframe {",
      "    height: 100%;",
      "    width: 100%;",
      "    display: block;",
      "    border: none;",
      "}"
    ],
    "json_data": {
      "html": [
        "<div id=\"observablehq-ec2f659d\"></div>",
        "<script type=\"module\">",
        "import {Runtime, Inspector} from \"https://cdn.jsdelivr.net/npm/@observablehq/runtime@4/dist/runtime.js\";",
        "import define from \"https://api.observablehq.com/@d3/disjoint-force-directed-graph.js?v=3\";",
        "const inspect = Inspector.into(\"#observablehq-ec2f659d\");",
        "(new Runtime).module(define, name => (name === \"chart\") && inspect());",
        "</script>"
      ],
      "isolated": true
    },
    "id": "a988753b-e57f-4ac9-9549-0f3b2d113f25",
    "updated_at": "2020-04-17T15:33:14.340292+00:00",
    "created_at": "2020-04-17T15:33:14.340304+00:00"
  },
  {
    "name": "Select Filter 2",
    "type": "selectFilter",
    "data": {
      "__source__": "61d63f62-8481-475d-8a90-3a0e2e82cc28",
      "columns": [
        "region"
      ],