Skip to main content
GET
/
v2
/
access-rules
Get all accessible Access Rules (V2)
curl --request GET \
  --url https://api-dev.narrative.io/v2/access-rules \
  --header 'Authorization: Bearer <token>'
{
  "prev_page": null,
  "current_page": 1,
  "next_page": null,
  "total_records": 2,
  "total_pages": 1,
  "records": [
    {
      "name": "name",
      "id": 2,
      "company_id": 42,
      "company_name": "company name",
      "company_slug": "company_slug",
      "display_name": "access rule",
      "description": "description",
      "image": "https://google.com/1.jpg",
      "tags": [
        "tag"
      ],
      "schema": {
        "type": "object",
        "properties": {
          "id": {
            "order": 1,
            "display_name": "id of field",
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "price_cpm_usd": 42,
      "metadata": {
        "created_at": "2007-12-03T10:15:30",
        "updated_at": "2008-12-03T10:15:30"
      },
      "type": "explicit_share",
      "mappings": [
        {
          "attribute_id": 42,
          "attribute_name": "id",
          "properties": [
            "id.type",
            "id.value"
          ]
        }
      ]
    },
    {
      "name": "access_rule_ebc86610_0907_4374_8fc9_be360f0ff8d0",
      "id": 1,
      "company_id": 1,
      "company_name": "company",
      "company_slug": "company_slug_60a4e678_1d56_48a7_8b8b_4e1d689b11a6",
      "display_name": "display name",
      "description": "description",
      "image": "https://narrative.test/1.png",
      "status": "active",
      "tags": [
        "_nio_access_rule"
      ],
      "nql": "select company_data.\"1\".columnA from company_data.\"1\" WHERE columnA = columnB",
      "schema": {
        "type": "object",
        "properties": {
          "columnA": {
            "display_name": "columnA",
            "type": "string"
          }
        },
        "required": [
          "columnA"
        ]
      },
      "collaborators": {
        "query": {
          "type": "inclusion",
          "company_ids": [
            789
          ]
        },
        "view": {
          "type": "all"
        }
      },
      "price_cpm_usd": 1000,
      "metadata": {
        "created_at": "2023-12-14T21:36:51.847901",
        "updated_at": "2023-12-14T21:36:51.847901"
      },
      "dataset_ids": [
        42
      ],
      "type": "owned",
      "mappings": [
        {
          "attribute_id": 42,
          "attribute_name": "id",
          "properties": [
            "id.type",
            "id.value"
          ]
        }
      ]
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

owned_only
boolean

If enabled, returns only owned rules.

shared_only
boolean

If enabled, returns only shared (not owned) rules.

tag
string

Check whether tag is presented. If multiple tags specified, looks if any of them is attached to a rule.

company_id
integer

Check whether owned by the company. Can be specified multiple times.

page
integer

Number of page. Stars from the first (1) page.

per_page
integer

Number of records to return.

dataset_id
integer

Check whether the rule is associated with specified dataset. Multiple values are allowed.

Response

200 - application/json

OK

records
object[]
required
Example:
{
  "name": "access_rule_ebc86610_0907_4374_8fc9_be360f0ff8d0",
  "id": 1,
  "company_id": 1,
  "company_name": "company",
  "company_slug": "company_slug_60a4e678_1d56_48a7_8b8b_4e1d689b11a6",
  "display_name": "display name",
  "description": "description",
  "image": "https://narrative.test/1.png",
  "status": "active",
  "tags": ["_nio_access_rule"],
  "nql": "select company_data.\"1\".columnA from company_data.\"1\" WHERE columnA = columnB",
  "schema": {
    "type": "object",
    "properties": {
      "columnA": {
        "display_name": "columnA",
        "type": "string"
      }
    },
    "required": ["columnA"]
  },
  "collaborators": {
    "query": { "type": "inclusion", "company_ids": [789] },
    "view": { "type": "all" }
  },
  "price_cpm_usd": 1000.054,
  "metadata": {
    "created_at": "2023-12-14T21:36:51.847901",
    "updated_at": "2023-12-14T21:36:51.847901"
  },
  "dataset_ids": [42],
  "type": "owned",
  "is_owned": true,
  "mappings": [
    {
      "attribute_id": 42,
      "attribute_name": "id",
      "properties": ["id.type", "id.value"]
    }
  ]
}
prev_page
integer<int64>

The number of previous page (if exists). Also can refer to the latest existing page if non-existing page was requested.

Example:

1

current_page
integer<int64>

The number of requested page.

Example:

1

next_page
integer<int64>

The number of next page (if exists).

Example:

42

total_records
integer<int64>

Total amount of accessible Access Rules

Example:

15000

total_pages
integer<int64>

Total amount of pages.

Example:

10