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

# Create custom drug

> Creates a user-level custom drug for a user in Parchment

Creates a **user-level** custom drug for the given user (stored against `USER#{user_id}`).

## Integration Notes

1. **Scope Requirement**: Your API token must include the `create:custom_drug` scope.
2. **Level**: This endpoint always creates user-level drugs. Use the bulk endpoint to manage the organization-level catalog.
3. **Response**: Returns the created drug, including its `custom_drug_id` (use it to update/delete the drug or to prefill the prescription form).
4. **Validation**: `item_generic_name`, `item_strength`, `item_form`, `route_of_administration`, `quantity`, `poison_class`, and `max_repeats` are required.

## Example Request

```json theme={null}
{
  "item_generic_name": "Amoxicillin",
  "item_strength": "500mg",
  "item_form": "Capsule",
  "route_of_administration": "Oral",
  "quantity": "20",
  "max_repeats": "2",
  "poison_class": "S4",
  "brand_name": "Amoxil",
  "patient_instructions": "Take one capsule twice daily"
}
```


## OpenAPI

````yaml POST /v1/organizations/{organization_id}/users/{user_id}/custom-drugs
openapi: 3.0.1
info:
  title: Parchment APIs
  description: >-
    Parchments API documentation for partner integrations, enabling secure
    e-prescription services
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.sandbox.parchmenthealth.io/external
  - url: https://api.parchmenthealth.io/external
security:
  - bearerAuth: []
paths:
  /v1/organizations/{organization_id}/users/{user_id}/custom-drugs:
    post:
      description: Creates a user-level custom drug for a user in Parchment
      parameters:
        - name: x-organization-secret
          in: header
          required: true
          description: Organization secret for authentication - provided by Parchment
          schema:
            type: string
        - name: organization_id
          in: path
          required: true
          description: Organization ID
          schema:
            type: string
            format: uuid
        - name: user_id
          in: path
          required: true
          description: User ID
          schema:
            type: string
      requestBody:
        description: Custom drug to create
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomDrugInput'
      responses:
        '201':
          description: Custom drug created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomDrugResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalApiErrorResponse'
        '422':
          description: Validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalApiErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalApiErrorResponse'
components:
  schemas:
    CustomDrugInput:
      type: object
      description: Custom drug fields supplied by a partner when creating a drug.
      required:
        - item_generic_name
        - item_strength
        - item_form
        - route_of_administration
        - quantity
        - poison_class
        - max_repeats
      properties:
        item_generic_name:
          type: string
          maxLength: 280
        item_trade_name:
          type: string
          maxLength: 280
        brand_name:
          type: string
          maxLength: 100
        item_strength:
          type: string
          maxLength: 100
        item_form:
          type: string
          maxLength: 50
        route_of_administration:
          type: string
          maxLength: 50
        quantity:
          type: string
          description: String or number; coerced to string
        max_repeats:
          type: string
          description: String or number; coerced to string
        poison_class:
          type: string
          maxLength: 2
        custom_product_id:
          type: string
          maxLength: 50
        description:
          type: string
          maxLength: 280
        patient_instructions:
          type: string
          maxLength: 250
        doctor_instructions:
          type: string
          maxLength: 50
    CustomDrugResponse:
      type: object
      properties:
        success:
          type: boolean
        statusCode:
          type: integer
        message:
          type: string
        code:
          type: string
          example: SUCCESS
        data:
          $ref: '#/components/schemas/ExternalCustomDrug'
        timestamp:
          type: string
        requestId:
          type: string
    ExternalApiErrorResponse:
      type: object
      required:
        - success
        - statusCode
        - error
        - timestamp
        - requestId
      properties:
        success:
          type: boolean
          description: Indicates if the request was successful
          example: false
        statusCode:
          type: integer
          description: HTTP status code
          example: 400
        code:
          type: string
          description: Machine-readable operation code identifying the error
          example: RESOURCE_NOT_FOUND
        error:
          type: object
          description: RFC 7807 compliant error details
          required:
            - type
            - title
            - detail
          properties:
            type:
              type: string
              format: uri
              description: URI identifying the problem type
              example: https://parchment.health/errors/validation-error
            title:
              type: string
              description: Human-readable summary of the problem
              example: Validation failed
            detail:
              type: string
              description: Human-readable explanation of the problem
              example: There were some problems with your input.
            instance:
              type: string
              format: uri
              description: URI reference to the specific occurrence
              example: /patients/123
            validation:
              type: array
              description: Field-level validation errors (for 422 responses)
              items:
                type: object
                properties:
                  field:
                    type: string
                    description: Field name that failed validation
                  message:
                    type: string
                    description: Validation error message
                  code:
                    type: string
                    description: Error code for programmatic handling
        timestamp:
          type: string
          format: date-time
          description: ISO 8601 timestamp of the response
          example: '2024-01-15T10:30:00.000Z'
        requestId:
          type: string
          description: Unique identifier for request tracing
          example: req_1705312200000_def456
        meta:
          type: object
          description: Additional response metadata
          properties:
            apiVersion:
              type: string
              description: API version used
              example: '1.0'
    ExternalCustomDrug:
      type: object
      description: >-
        A custom drug as exposed to partners. custom_drug_id is the unique
        identifier used to prefill the prescription form.
      properties:
        custom_drug_id:
          type: string
          description: Unique identifier for the custom drug
        item_generic_name:
          type: string
        item_trade_name:
          type: string
        brand_name:
          type: string
        item_strength:
          type: string
        item_form:
          type: string
        route_of_administration:
          type: string
        quantity:
          type: string
        max_repeats:
          type: string
        poison_class:
          type: string
        custom_product_id:
          type: string
        description:
          type: string
        patient_instructions:
          type: string
        doctor_instructions:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````