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

# Request a certificate

> This endpoint requests certificate generation for a completed topic or pathway enrolment. Use `knowledge_type=topic` for both standard and short topics. The returned `job_id` can be checked for 24 hours.

This is step 1 of 3. See [Certificates](/certificates) for the full process.

Certificate requests count towards the general API [rate limit](/rate-limits).




## OpenAPI

````yaml /openapi.yaml get /certificates
openapi: 3.1.0
info:
  title: Tribal Habits Public API
  version: '1'
  description: >
    The Tribal Habits Public API V1. Use it to manage your Tribal Habits user
    accounts (list, show, create and update) and other entities.


    Replace `myorg` in the server URL with your organisation's subdomain. See
    [Vanity URL](/vanity-url) if you use your own domain.
servers:
  - url: https://myorg.tribalhabits.com/papi
security:
  - ApiKeyHeader: []
tags:
  - name: Users
    description: Users
  - name: Topics
    description: Topics
  - name: Pathways
    description: Pathways
  - name: Enrolments
    description: Topic and Pathway Enrolments
  - name: Certificates
    description: >-
      Certificate generation and retrieval for completed topic and pathway
      enrolments.
  - name: External Knowledge
    description: Knowledge obtained from a source external of Tribal Habits.
  - name: Webhooks
    description: >-
      Webhooks triggered from certain actions in code that will call URLs
      assigned by you.
paths:
  /certificates:
    get:
      tags:
        - Certificates
      summary: Request a certificate
      description: >
        This endpoint requests certificate generation for a completed topic or
        pathway enrolment. Use `knowledge_type=topic` for both standard and
        short topics. The returned `job_id` can be checked for 24 hours.


        This is step 1 of 3. See [Certificates](/certificates) for the full
        process.


        Certificate requests count towards the general API [rate
        limit](/rate-limits).
      operationId: requestCertificate
      parameters:
        - name: user_name
          in: query
          required: true
          description: User name identifier (case-insensitive)
          schema:
            type: string
          example: user1@example.com
        - name: enrolment_id
          in: query
          required: true
          description: >-
            Topic enrolment ID or pathway enrolment ID. The enrolment must
            belong to the user
          schema:
            type: integer
          example: 12345
        - name: knowledge_type
          in: query
          required: true
          description: 'Enrolment type. Allowed values: `topic`, `pathway`'
          schema:
            type: string
            enum:
              - topic
              - pathway
          example: topic
      responses:
        '202':
          description: Accepted - Certificate job has been queued
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CertificateJob'
              example:
                job_id: cert_abc123xyz
                status: pending
        '400':
          description: Bad Request - Missing or invalid parameters
        '401':
          description: Unauthorized - API key missing or invalid
        '404':
          description: Not Found - User or enrolment was not found
        '422':
          description: Unprocessable Entity - Enrolment is not yet complete
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SingleError'
              example:
                error: Certificate not available. Enrolment is not yet complete.
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  schemas:
    CertificateJob:
      type: object
      properties:
        job_id:
          type: string
          description: The certificate job identifier
        status:
          type: string
          enum:
            - pending
            - complete
            - failed
        url:
          type: string
          description: >-
            Present when `status` is `complete`. Temporary pre-signed URL of the
            certificate PDF. It expires after 15 minutes. See [Download
            certificate PDF](/download-certificate)
        error:
          type: string
          description: Present when `status` is `failed`
    SingleError:
      type: object
      properties:
        error:
          type: string
  responses:
    TooManyRequests:
      description: >-
        Too Many Requests - You have exceeded the rate limit. See [Rate
        limits](/rate-limits)
      headers:
        Retry-After:
          description: Number of seconds until the rate limit window resets
          schema:
            type: integer
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
              retry_after_seconds:
                type: integer
          example:
            error: Rate limit exceeded. Please slow down.
            retry_after_seconds: 23
  securitySchemes:
    ApiKeyHeader:
      type: apiKey
      in: header
      name: Authorization
      description: >
        Your organisation's API key, sent as `Authorization: my_api_key`. The
        key can also be passed as an `api_key` query parameter. See
        [Authentication](/authentication).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.