> ## 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.

# Update custom drug

> Updates a user-level custom drug. Send only the fields to change.

Updates a **user-level** custom drug. Send only the fields you want to change.

## Integration Notes

1. **Scope Requirement**: Your API token must include the `update:custom_drug` scope.
2. **Target**: `drug_id` is the `custom_drug_id` returned by the list/create endpoints. The drug must already exist for this user — otherwise `404` is returned.
3. **Partial update**: Only the provided fields are changed; omitted fields are left untouched.
4. **Response**: Returns the updated drug.

## Example Request

```json theme={null}
{
  "quantity": "60",
  "max_repeats": "3",
  "patient_instructions": "Take one capsule three times daily"
}
```


## OpenAPI

````yaml PUT /v1/organizations/{organization_id}/users/{user_id}/custom-drugs/{drug_id}
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/{drug_id}:
    put:
      description: Updates a user-level custom drug. Send only the fields to change.
      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
        - name: drug_id
          in: path
          required: true
          description: Custom drug ID (custom_drug_id from the list endpoint)
          schema:
            type: string
      requestBody:
        description: Partial custom drug fields to update
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomDrugUpdate'
      responses:
        '200':
          description: Custom drug updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomDrugResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalApiErrorResponse'
        '404':
          description: Custom drug not found for this user
          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:
    CustomDrugUpdate:
      type: object
      description: Partial custom drug fields to update. Send only the fields to change.
      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
        max_repeats:
          type: 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

````