DNSFilter Api Keys API

The Api Keys API from DNSFilter — 3 operation(s) for api keys.

OpenAPI Specification

dnsfilter-api-keys-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: DNSFilter Agent Local User Bulk Deletes Api Keys API
  description: "\n**Note:** If you are a distributor integrating with DNSFilter, please check\n          out our [Distributors Development Guide](/docs/distributors).\n\n### Authentication\n\n- Authentication is required for most, but not all, endpoints.\n\n- Authentication is done by setting the `Authorization` request header.\n  The header value is the API key itself.\n  For example: `Authorization: eyJ...`\n\n- An API key can be obtained through the DNSFilter dashboard under\n  Account Settings. For additional information see\n  [this KB article](https://help.dnsfilter.com/hc/en-us/articles/21169189058323-API-Tokens).\n\n### Rate Limiting\n\n- All endpoints are rate limited.\n\n- The limits may vary by endpoint, but are generally consistent.\n\n- When the rate limit is exceeded the API will return the standard `429` HTTP status.\n\n- The following headers will also be provided in the response:\n  `Retry-After`, `RateLimit-Policy`, `RateLimit`, `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`.\n  For details on the values of these headers, see the following articles\n  [here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After),\n  [here](https://www.ietf.org/archive/id/draft-ietf-httpapi-ratelimit-headers-08.html),\n  and [here](https://www.ietf.org/archive/id/draft-polli-ratelimit-headers-05.html).\n\n- For additional information see [this KB article](https://help.dnsfilter.com/hc/en-us/articles/38202811088403-API-Rate-Limits).\n\n### Error Handling\n\n- The API uses standard HTTP status codes to indicate success or failure.\n\n- For _V1_ endpoints the response format is:\n  ```json\n  { \"error\": \"string\", \"type\": \"string(optional)\" }\n  ```\n- For _V2_ endpoints the response format is:\n  ```json\n  { \"error\": { \"message\": \"string\", \"type\": \"string(optional)\" } }\n  ```\n\n### Pagination\n\nFor the _V1_ endpoints, the pagination parameters are nested. That is to say,\nif passed as JSON they look like this: `{\"page[number]\": 1, \"page[size]\": 10}`.\n\nTo pass this information in the URL query string, it would be formatted like\nthis: `...?page%5Bnumber%5D=1&page%5Bsize%5D=10`.\n\nIn this guide, the UI will indicate that `page` is an `object` and if you\nwant to set values when trying the request, you must enter it as if it was\nthe JSON above.\n\n### A Quick Example\n\nThe following will return information about the currently\nauthenticated user.\n\n```bash\n% curl -H 'Authorization: ***' https://api.dnsfilter.com/v1/users/self\n\n{ \"data\": {\n    \"id\": \"12345\",\n    \"type\": \"users\",\n    \"attributes\": {\n      \"name\": \"John Doe\",\n      \"email\": \"john@example.com\",\n      ...additional fields...\n}}}\n```\n"
  version: '2026-07-13'
servers:
- url: https://api.dnsfilter.com
  description: Production
tags:
- name: Api Keys
  description: ''
paths:
  /v1/api_keys:
    post:
      tags:
      - Api Keys
      operationId: V1_Api_Keys-create
      parameters: []
      responses:
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Can not create api_key with the specified data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '201':
          description: created api key
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/ApiKeySpec'
      description: Creates a new api key.
      summary: Create
      security:
      - header_authorization: []
      x-controller: v1/api_keys
      x-action: create
      requestBody:
        description: api key information
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiKeyCreateSpec'
    get:
      tags:
      - Api Keys
      operationId: V1_Api_Keys-index
      parameters:
      - name: expired
        description: if the api key is expired or not.
        required: false
        in: query
        schema:
          type: boolean
      - name: id
        description: id of the api key
        required: false
        in: query
        schema:
          type: integer
      - name: last_four
        description: last four values of api key token
        required: false
        in: query
        schema:
          type: string
      - name: name
        description: name of api key
        required: false
        in: query
        schema:
          type: string
      - name: organization_id
        description: Organization ID
        required: false
        in: query
        schema:
          type: integer
      responses:
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '200':
          description: api keys
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/ApiKeySpec'
                  links:
                    $ref: '#/components/schemas/Links'
      description: Gets the list of api keys associated with the current user.
      summary: List
      security:
      - header_authorization: []
      x-controller: v1/api_keys
      x-action: index
  /v1/api_keys/{id}:
    get:
      tags:
      - Api Keys
      operationId: V1_Api_Keys-show
      parameters:
      - name: id
        description: ApiKey ID
        required: true
        in: path
        schema:
          type: integer
      responses:
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Can not update api key with the specified data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '200':
          description: queried api key
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/ApiKeySpec'
      description: Displays an api key.
      summary: Show
      security:
      - header_authorization: []
      x-controller: v1/api_keys
      x-action: show
    delete:
      tags:
      - Api Keys
      operationId: V1_Api_Keys-destroy
      parameters:
      - name: id
        description: Api Key ID
        required: true
        in: path
        schema:
          type: integer
      responses:
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '204':
          description: no content
      description: Removes the api key.
      summary: Delete
      security:
      - header_authorization: []
      x-controller: v1/api_keys
      x-action: destroy
  /v1/api_keys/{id}/revoke:
    post:
      tags:
      - Api Keys
      operationId: V1_Api_Keys-revoke
      parameters:
      - name: id
        description: api key id
        required: true
        in: path
        schema:
          type: integer
      responses:
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Can not update api key with the specified data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '200':
          description: Updated api key
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/ApiKeySpec'
      description: Revokes the api key for the user.
      summary: Revoke
      security:
      - header_authorization: []
      x-controller: v1/api_keys
      x-action: revoke
components:
  schemas:
    Links:
      type: object
      properties:
        self:
          type: string
          description: Endpoint URL (may be null)
      description: JSON API links member representation
    ApiKeyCreateSpec:
      type: object
      properties:
        name:
          type: string
          description: name
        expiry:
          type: string
          description: 2024-12-22T17:24:32.162-05:00 intended expiry
      description: Api key creation specification
    Error:
      type: object
      properties:
        error:
          type: string
          description: 'Error message (e.x.: Not Authorized)'
      description: Error basic representation
    ApiKey:
      type: object
      properties:
        name:
          type: string
          description: name
        expiry:
          type: string
          description: 2024-12-22T17:24:32.162-05:00 intended expiry
        last_four:
          type: string
          description: last four digits of the token
        token:
          type: string
          description: 'full token on initial create or a redacted token with last four. i.e: ***************Lhz4'
        status:
          type: string
          description: token status (active, revoked)
        created_at:
          type: string
          description: created at datetime 2024-09-20T15:59:59.100-04:00
        updated_at:
          type: string
          description: date last updated 2024-09-20T15:59:59.100-04:00
        'user_id:':
          type: integer
          description: associated user to api key
      description: ApiKey resource
    ApiKeySpec:
      allOf:
      - $ref: '#/components/schemas/IdType'
      - type: object
        properties:
          attributes:
            $ref: '#/components/schemas/ApiKey'
      description: ApiKey specification
    IdType:
      type: object
      properties:
        id:
          type: string
          description: Resource Id (integer or uuid)
        type:
          type: string
          description: Resource type name
        uuid:
          type: string
          description: Resource UUID (if applicable)
      description: JSON API resource ID and type attributes
  securitySchemes:
    header_authorization:
      type: apiKey
      name: Authorization
      in: header