> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pdfshift.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create API key

> Creates a new API key for the connected account with basic level (not master).

This endpoint requires an API key with the `master` privilege (or a Bearer token from the Dashboard).

If the account has reached the maximum number of allowed active API keys, the request will be refused.

If you want to create an API key with master access, you need to create it via the Dashboard.



## OpenAPI

````yaml https://api.pdfshift.io/openapi.json post /account/api
openapi: 3.0.3
info:
  title: PDFShift API Documentation
  version: '3.0'
  description: >-
    This is the documentation for the PDFShift API.


    Our aim here is to provide you with a clear, concise and complete set of
    tool to generate the PDF you want.


    Don't forget to add the `sandbox` parameter to `True` while testing the API,
    this won't use your credits and generate free PDF (with a watermark).

    But if you forgot to set it, don't worry ; Send us a message and we'll reset
    your credits usage.
  termsOfService: https://pdfshift.io/terms
  contact:
    name: PDFShift
    url: https://pdfshift.io
    email: support@pdfshift.io
  x-logo:
    url: https://pdfshift.io/images/favicons/android-chrome-512x512.png
servers:
  - url: https://api.pdfshift.io/v3
    description: ''
    x-last-modified: 1764750693905
security:
  - apiKeyHeader: []
externalDocs:
  description: You can access our documentation online by visiting https://docs.pdfshift.io
  url: https://docs.pdfshift.io
paths:
  /account/api:
    post:
      tags:
        - api-keys
      summary: Create API key
      description: >-
        Creates a new API key for the connected account with basic level (not
        master).


        This endpoint requires an API key with the `master` privilege (or a
        Bearer token from the Dashboard).


        If the account has reached the maximum number of allowed active API
        keys, the request will be refused.


        If you want to create an API key with master access, you need to create
        it via the Dashboard.
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiKeyForm'
      responses:
        '200':
          description: API key created
          headers:
            X-RateLimit-Remaining:
              description: >-
                The number of requests remaining in the current rate limit
                window.
              schema:
                type: integer
            X-RateLimit-Limit:
              description: >-
                The maximum number of requests allowed in the current rate limit
                window.
              schema:
                type: integer
            X-RateLimit-Reset:
              description: >-
                The time at which the current rate limit window resets (Unix
                timestamp).
              schema:
                type: integer
                format: int64
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyResult'
              example:
                success: true
                key:
                  created: 1734076868000
                  name: Production key
                  removed: null
                  token: sk_abcde...
                  public: zyzabc...
                  last_used: null
                  usage: 0
                  is_master: false
        '400':
          description: >-
            Bad request. The maximum number of allowed API keys has been
            reached, or the data passed was invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized. Invalid auth key, missing, or disabled.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests. You have been rate limited.
          headers:
            X-RateLimit-Remaining:
              description: >-
                The number of requests remaining in the current rate limit
                window.
              schema:
                type: integer
            X-RateLimit-Limit:
              description: >-
                The maximum number of requests allowed in the current rate limit
                window.
              schema:
                type: integer
            X-RateLimit-Reset:
              description: >-
                The time at which the current rate limit window resets (Unix
                timestamp).
              schema:
                type: integer
                format: int64
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    ApiKeyForm:
      type: object
      properties:
        name:
          type: string
          maxLength: 250
          description: A human-friendly name to identify the API key.
    ApiKeyResult:
      type: object
      properties:
        success:
          type: boolean
        key:
          $ref: '#/components/schemas/ApiKeyObject'
    Error:
      type: object
      properties:
        success:
          type: boolean
        error:
          type: string
        code:
          type: integer
          format: int32
    ApiKeyObject:
      type: object
      properties:
        created:
          type: integer
          format: int64
          description: Creation date of the key, as a Unix timestamp in milliseconds.
        name:
          type: string
          default: null
          description: The name given to the key.
        removed:
          type: integer
          format: int64
          default: null
          description: >-
            Date at which the key was disabled, as a Unix timestamp in
            milliseconds. Null if the key is active.
        token:
          type: string
          description: The secret API key. Use this value to authenticate requests.
        public:
          type: string
          description: The public identifier of the key, used for converting templates.
        last_used:
          type: integer
          format: int64
          default: null
          description: >-
            Date at which the key was last used, as a Unix timestamp in
            milliseconds. Null if never used.
        usage:
          type: integer
          format: int32
          description: Number of conversions performed with this key over the last 7 days.
        is_master:
          type: boolean
          description: Whether this key has master privileges.
  securitySchemes:
    apiKeyHeader:
      type: apiKey
      description: >-
        Authenticate your account by including your secret key in API requests.

        You can manage your API keys in the
        [Dashboard](https://app.pdfshift.io/dashboard/).


        Authentication to the API is performed by using the HTTP Header
        X-API-Key.
      name: X-API-Key
      in: header
      x-last-modified: 1764750344730

````