Billing » API » Tenant

This endpoint is responsible for handling tenants.

Get all tenants

Request headers

Content-Type application/json
Authorization Bearer <token>

Request parameters

_allTenantsMeta.page int page number, starting from zero
_allTenantsMeta.perPage int number of items returned per
_allTenantsMeta.sortField str field used to sort the returned items, defaults to id
_allTenantsMeta.sortOrder str asc or desc, defaults to asc
POST

/graphql

Example request with curl
$ curl "https://api.canyan.io/graphql" \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-token-here>" \
  --data @- <<EOF
{"query": "{
    allTenants {
        id
        name
    }
    meta: _allTenantsMeta(page: 0, perPage: 10, sortField: \"id\", sortOrder: \"asc\") {
      count
  }
}" }
EOF

Response

allTenants.id objectid Identifier of the tenant
allTenants.name string Name of the tenant
meta.count int Results count
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
  "data": {
    "allTenants": [
      {
        "id": "fabio",
        "name": "Fabio's tenant"
      },
      {
        "id": "alex",
        "name": "Alex's tenant"
      },
      {
        "id": "paolo",
        "name": "Paolo's tenant"
      }
    ],
    "meta": {
      "count": 3
    }
  }
}

Get specific tenant details

Request headers

Content-Type application/json
Authorization Bearer <token>

Request parameters

allTenants.filter.id id id of the tenant
allTenants.filter.ids array array of ids to fetch
POST

/graphql

Example request with curl
$ curl "https://api.canyan.io/graphql" \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-token-here>" \
  --data @- <<EOF
{"query": "{
    allTenants(filter: {id: \"alex\"} ) {
        id
        name
    }
}" }
EOF

Response

allTenants.id objectid Identifier of the tenant.
allTenants.name string Name of the tenant.
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
  "data": {
    "allTenants": [
      {
        "id": "alex",
        "name": "Alex's tenant"
      }
    ]
  }
}

Create a new tenant

Request headers

Content-Type application/json
Authorization Bearer <token>

Request parameters

createTenant.id objectid Identifier of the tenant
createTenant.name string Name of the tenant
POST

/graphql

Example request with curl
$ curl "https://api.canyan.io/graphql" \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-token-here>" \
  --data @- <<EOF
{"query": "mutation {
    createTenant( id:\"alex\", name:\"Alex's awesome tenant\") {
      id
      name
    }
  }"
}
EOF

Response

createTenant.id objectid Identifier of the tenant
createTenant.name string Name of the tenant
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
  "data": {
    "createTenant": [
      {
        "id": "alex",
        "name": "Alex's awesome tenant"
      }
    ]
  }
}

Update a tenant

Request headers

Content-Type application/json
Authorization Bearer <token>

Request parameters

updateTenant.id objectid Identifier of the tenant
updateTenant.name string Name of the tenant
POST

/graphql

Example request with curl
$ curl "https://api.canyan.io/graphql" \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-token-here>" \
  --data @- <<EOF
{"query": "mutation {
    updateTenant( id:\"alex\", name:\"Updated awesome tenant\") {
      id
      name
    }
  }"
}
EOF

Response

updateTenant.id objectid Identifier of the tenant.
updateTenant.name string Name of the tenant.
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
  "data": {
    "updateTenant": [
      {
        "id": "alex",
        "name": "Updated awesome tenant"
      }
    ]
  }
}

Delete a tenant

Request headers

Content-Type application/json
Authorization Bearer <token>

Request parameters

deleteTenant.id objectid Identifier of the tenant
POST

/graphql

Example request with curl
$ curl "https://api.canyan.io/graphql" \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-token-here>" \
  --data @- <<EOF
{"query": "mutation {
    deleteTenant( id:\"alex\") {
      id
      name
    }
  }"
}
EOF

Response

deleteTenant.id objectid Identifier of the tenant.
deleteTenant.name string Name of the tenant.
Example response
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "deleteTenant": {
      "id": "alex",
      "name": "Alex2's tenant"
    }
  }
}
Stay updated

By registering with us you will receive right in your inbox all new features and updates

Check your email

We sent you an email with a link to get started. You’ll be in your account in no time.