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

# Create Worker Credential

> Creates a credential record for a specific worker.



## OpenAPI

````yaml api-reference/v01.12.00/openapi-v01.12.00.json POST /workers/{id}/credentials
openapi: 3.0.0
info:
  title: Roosted
  version: 0.1.12
  contact:
    name: Support
    url: https://support.roostedhr.com/support/home
    email: support@roostedhr.com
  description: |-
    Enterprise API

    Sandbox keys and Production keys are requested from support
servers:
  - url: https://api.roostedhr.com/api/1_12
  - url: https://sandbox.roostedhr.com/api/1_12
security:
  - X-API-KEY: []
tags:
  - name: Announcements
  - name: Areas
  - name: Clients
  - name: Company
  - name: Configuration
  - name: Events
  - name: Locations
  - name: Payroll Groups
  - name: Rate Cards
  - name: Shifts
  - name: Skillsets
  - name: Time Tracking
  - name: Wage Rules
  - name: Workers
paths:
  /workers/{id}/credentials:
    parameters:
      - schema:
          type: string
        name: id
        in: path
        required: true
        description: Worker ID
    post:
      tags:
        - Workers
      summary: Create Worker Credential
      description: Creates a credential record for a specific worker.
      operationId: post-worker-credential
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                p_id:
                  type: integer
                  minimum: 0
                  description: Worker personnel ID.
                credentials_id:
                  type: string
                  description: Credential definition ID.
                date_completed:
                  type: string
                  format: date-time
                  description: Completion date in ISO 8601 format.
                date_expired:
                  type: string
                  format: date-time
                  description: Expiration date in ISO 8601 format.
                clients_id:
                  type: string
                  nullable: true
                  description: >-
                    Client ID to associate with the credential. `null` for
                    general credentials.
                locations_id:
                  type: integer
                  minimum: 0
                  nullable: true
                  description: >-
                    Location/venue ID to associate with the credential. `null`
                    for general credentials.
                file_type:
                  type: string
                  description: MIME type of the uploaded file.
                file_name:
                  type: string
                  description: Original file name.
                file:
                  type: string
                  format: binary
                  nullable: true
                  description: File binary data.
                name:
                  type: string
                  description: Display name for the credential.
              required:
                - credentials_id
            examples:
              Add General Credential:
                value:
                  credentials_id: AP1nm7sNrd
                  p_id: '12345'
                  date_completed: '2023-12-03T20:00:00.000Z'
                  date_expired: '2023-12-04T20:00:00.000Z'
                  clients_id: null
                  locations_id: null
                  file_name: ''
                  file_type: ''
                  file: null
                  name: ''
        description: ''
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkerCredential'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: WRK-100
                  error:
                    type: string
                    example: Credentials ID is missing.
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: ATH-100
                  error:
                    type: string
                    example: Invalid or missing API key.
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: WRK-800
                  error:
                    type: string
                    example: Insufficient permissions to manage workers.
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: WRK-300
                  error:
                    type: string
                    example: Worker not found.
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: WRK-1700
                  error:
                    type: string
                    example: Failed to create credential.
components:
  schemas:
    WorkerCredential:
      type: object
      description: A credential record assigned to a worker.
      properties:
        id:
          type: string
          description: Personnel credential record identifier.
        personnel_id:
          type: integer
          description: Worker personnel ID.
        credentials_id:
          type: string
          description: Credential definition ID.
        submitter_id:
          type: integer
          description: ID of the user who submitted the credential.
        submitter_name:
          type: string
          description: Name of the user who submitted the credential.
        date_completed:
          type: string
          nullable: true
          description: Completion date (e.g. "2023-12-03 20:00:00"). `null` if not set.
        date_completed_nice:
          type: string
          nullable: true
          description: Formatted completion date (e.g. "Dec 3rd, 2023"). `null` if not set.
        date_expired:
          type: string
          nullable: true
          description: Expiration date (e.g. "2023-12-04 20:00:00"). `null` if not set.
        date_expired_nice:
          type: string
          nullable: true
          description: Formatted expiration date (e.g. "Dec 4th, 2023"). `null` if not set.
        date_submitted:
          type: string
          description: Submission timestamp.
        date_submitted_nice:
          type: string
          description: Formatted submission date.
        file_location_value:
          type: string
          nullable: true
          description: URL to the uploaded credential file. `null` if no file attached.
        file_name:
          type: string
          nullable: true
          description: Original file name.
        file_display_name:
          type: string
          nullable: true
          description: Display file name.
        clients_id:
          type: string
          nullable: true
          description: Associated client ID. `null` for general credentials.
        client_name:
          type: string
          nullable: true
          description: Associated client name.
        locations_id:
          type: string
          nullable: true
          description: Associated location/venue ID. `null` for general credentials.
        location_name:
          type: string
          nullable: true
          description: Associated location/venue name.
        deleted:
          type: integer
          enum:
            - 0
            - 1
          description: Soft-delete flag. `0` = active, `1` = deleted.
        company_id:
          type: integer
          description: Company ID.
        name:
          type: string
          description: Credential name.
        description:
          type: string
          description: Credential description.
        expiring_inform:
          type: integer
          enum:
            - 0
            - 1
          description: Whether to notify worker before expiry. `1` = yes, `0` = no.
        expiring_inform_period:
          type: integer
          description: Days before expiry to notify the worker.
        expiring_inform_hr:
          type: integer
          enum:
            - 0
            - 1
          description: Whether to notify HR before expiry. `1` = yes, `0` = no.
        expiring_inform_hr_period:
          type: integer
          description: Days before expiry to notify HR.
        expired_inform:
          type: integer
          enum:
            - 0
            - 1
          description: Whether to notify worker on expiry. `1` = yes, `0` = no.
        expired_inform_hr:
          type: integer
          enum:
            - 0
            - 1
          description: Whether to notify HR on expiry. `1` = yes, `0` = no.
        rule_usable:
          type: integer
          enum:
            - 0
            - 1
          description: >-
            Whether the credential can be used in matching rules. `1` = yes, `0`
            = no.
        worker_viewable:
          type: integer
          enum:
            - 0
            - 1
          description: >-
            Whether the worker can view this credential. `1` = viewable, `0` =
            hidden.
        worker_editable:
          type: integer
          enum:
            - 0
            - 1
          description: >-
            Whether the worker can edit this credential. `1` = editable, `0` =
            read-only.
        type:
          type: string
          enum:
            - General
            - Client
            - Venue
          description: Credential type.
        protected:
          type: integer
          enum:
            - 0
            - 1
          description: >-
            Whether the credential is protected from deletion. `1` = protected,
            `0` = not protected.
        course_id:
          type: integer
          nullable: true
          description: Associated course ID. `null` if not linked to a course.
        expiration_months:
          type: integer
          nullable: true
          description: Number of months until auto-expiry. `null` if no auto-expiry.
  securitySchemes:
    X-API-KEY:
      name: X-API-KEY
      type: apiKey
      in: header

````