GET/v1/tokens/verify

Verify a token

Security: Bearer Auth

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer 123

Responses

StatusMeaningDescription
200OKReturns that the given API token is valid
401UnauthorizedReturns an error message if the token is invalid
500Internal Server ErrorInternal Server Error

Response Schema

result:object
success:boolean
Whether the API call was successful
errors:object[]
messages:object[]

Request

GET
/v1/tokens/verify
curl --request GET \
  --url https://api.onlineornot.com/v1/tokens/verify \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'

Response

{
  "result": {
    "id": "a1b2c3d4",
    "status": "active"
  },
  "success": true,
  "errors": [],
  "messages": []
}

GET/v1/tokens/permissions

Retrieve a token's permissions

Security: Bearer Auth

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer 123

Responses

StatusMeaningDescription
200OKReturns the permissions of a given API token
500Internal Server ErrorInternal Server Error

Response Schema

result:object
success:boolean
Whether the API call was successful
errors:object[]
messages:object[]

Request

GET
/v1/tokens/permissions
curl --request GET \
  --url https://api.onlineornot.com/v1/tokens/permissions \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'

Response

{
  "result": {
    "permissions": [
      "uptime_checks (read)"
    ]
  },
  "success": true,
  "errors": [],
  "messages": []
}

GET/v1/tokens

List all API tokens

Retrieve a paginated list of all API tokens for the organization

Security: Bearer Auth

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer 123

Query parameters

page:stringoptional
Page number of paginated results.
Default: "1"
per_page:stringoptional
Number of items per page.
Default: "20"

Responses

StatusMeaningDescription
200OKReturns a list of API tokens
500Internal Server ErrorInternal Server Error

Response Schema

result:object[]
result_info:object
success:boolean
Whether the API call was successful
errors:object[]
messages:object[]

Request

GET
/v1/tokens
curl --request GET \
  --url https://api.onlineornot.com/v1/tokens \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'

Response

{
  "result": [
    {
      "id": "a1b2c3d4",
      "name": "My API Token",
      "expiresAfter": "2025-12-31T23:59:59.000Z",
      "createdAt": "2024-01-15T10:30:00.000Z",
      "grants": [
        {
          "scope": "UPTIME_CHECKS",
          "permission": "READ"
        }
      ]
    }
  ],
  "result_info": {
    "page": 1,
    "per_page": 20,
    "count": 1,
    "total_count": 1
  },
  "success": true,
  "errors": [],
  "messages": []
}

POST/v1/tokens

Create an API token

Create a new API token for the organization

Security: Bearer Auth

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer 123

Body parameters

name:string
Token name
grants:object[]
List of grants (scope and permission pairs) for the token
expiresAt:string,null(date-time)optional
Custom expiration date for the token. If not provided, defaults to 365 days from now. Set to null for no expiration.

Responses

StatusMeaningDescription
201CreatedCreate a new API token
500Internal Server ErrorInternal Server Error

Response Schema

result:object
success:boolean
Whether the API call was successful
errors:object[]
messages:object[]

Request

POST
/v1/tokens
curl --request POST \
  --url https://api.onlineornot.com/v1/tokens \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}' \
  --header 'Content-Type: application/json' \
  --data '{"name":"My API Token","permissions":[{"permission":"UPTIME_CHECKS","permissionLevel":"READ"}]}'

Response

{
  "result": {
    "id": "a1b2c3d4",
    "name": "My API Token",
    "expiresAfter": "2025-12-31T23:59:59.000Z",
    "createdAt": "2024-01-15T10:30:00.000Z",
    "token": "abc123def456ghi789jkl012mno345pqrs678tuv"
  },
  "success": true,
  "errors": [],
  "messages": []
}

GET/v1/tokens/{token_id}

Retrieve an API token

Look up detailed information about a specific API token

Security: Bearer Auth

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer 123

Path parameters

token_id:string
The token ID

Responses

StatusMeaningDescription
200OKRetrieve the specified API token
404Not FoundToken not found
500Internal Server ErrorInternal Server Error

Response Schema

result:object
success:boolean
Whether the API call was successful
errors:object[]
messages:object[]

Request

GET
/v1/tokens/{token_id}
curl --request GET \
  --url https://api.onlineornot.com/v1/tokens/a1b2c3d4 \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'

Response

{
  "result": {
    "id": "a1b2c3d4",
    "name": "My API Token",
    "expiresAfter": "2025-12-31T23:59:59.000Z",
    "createdAt": "2024-01-15T10:30:00.000Z",
    "grants": [
      {
        "scope": "UPTIME_CHECKS",
        "permission": "READ"
      }
    ]
  },
  "success": true,
  "errors": [],
  "messages": []
}

DELETE/v1/tokens/{token_id}

Delete an API token

Permanently delete an API token

Security: Bearer Auth

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer 123

Path parameters

token_id:string
The token ID

Responses

StatusMeaningDescription
200OKDelete the specified API token
404Not FoundToken not found
500Internal Server ErrorInternal Server Error

Response Schema

result:object
success:boolean
Whether the API call was successful
errors:object[]
messages:object[]

Request

DELETE
/v1/tokens/{token_id}
curl --request DELETE \
  --url https://api.onlineornot.com/v1/tokens/a1b2c3d4 \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'

Response

{
  "result": {
    "deleted": true
  },
  "success": true,
  "errors": [],
  "messages": []
}

Was this page helpful?