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

# Change a sample request's workflow state (RFC 6902 JSON Patch)

> Applies a JSON Patch document (RFC 6902) to a sample request's writable state. The document is seeded from the current request, so an operation on '/status' moves the request and an omitted operation preserves the current value. Only status and, for a transition to sent, trackingNumber are writable. The permitted transitions mirror the legacy web state machine and depend on the caller: a designer or the assigned supplier may make any transition that side allows, and the target must be reachable from the request's current state. Measured values can be written in every state except commented; a measurement write on a commented request is a 422. A transition the state machine does not allow is a 422. Supplying a trackingNumber for any target state other than sent is a 400, as is an empty patch document. This write persists the status, the state-change timestamp, and the send date and tracking number on a sent transition, and writes the communication-log audit trail for the transition (publishing drafts when the sample leaves received); it emits no notification or workflow side effect. Cross-organization access is a 403, a missing style or request a 404, a failed test operation, an operation that changes the id, or another write changing the status while this write is in progress a 409, and any other inapplicable operation a 422. The transition is validated against the status at the time of the write, not against the seeded document.



## OpenAPI

````yaml https://service.my.delogue.com/openapi/external.json patch /api/styles/{styleId}/sample-requests/{id}
openapi: 3.1.1
info:
  title: Delogue External API - (Production)
  description: Integration endpoints for Delogue API
  version: 1.0.0
servers:
  - url: >-
      https://ca-delogue-service-prod.bravepebble-62e34dbe.westeurope.azurecontainerapps.io/
security: []
tags:
  - name: Barcodes
  - name: Brands
  - name: CareInstructionIcons
  - name: CareInstructionLayers
  - name: CareInstructionMaterials
  - name: CareInstructions
  - name: Color Groups
  - name: Colors
  - name: ComplianceCategories
  - name: ComplianceCustomFields
  - name: Facilities
  - name: Groups
  - name: ItemCategories
  - name: Items
  - name: MeasurementCharts
  - name: MigrationVerification
  - name: Organizations
  - name: SampleRequests
  - name: SampleTypes
  - name: Seasons
  - name: SizeRanges
  - name: Style Prices
  - name: StyleCareInstructions
  - name: StyleCategories
  - name: StyleColors
  - name: StyleContacts
  - name: StyleCustomFields
  - name: StyleFiles
  - name: StyleItems
  - name: StyleRelations
  - name: Styles
  - name: StyleSkus
  - name: StyleSupplierFacilities
  - name: SubSuppliers
  - name: Suppliers
paths:
  /api/styles/{styleId}/sample-requests/{id}:
    patch:
      tags:
        - SampleRequests
      summary: Change a sample request's workflow state (RFC 6902 JSON Patch)
      description: >-
        Applies a JSON Patch document (RFC 6902) to a sample request's writable
        state. The document is seeded from the current request, so an operation
        on '/status' moves the request and an omitted operation preserves the
        current value. Only status and, for a transition to sent, trackingNumber
        are writable. The permitted transitions mirror the legacy web state
        machine and depend on the caller: a designer or the assigned supplier
        may make any transition that side allows, and the target must be
        reachable from the request's current state. Measured values can be
        written in every state except commented; a measurement write on a
        commented request is a 422. A transition the state machine does not
        allow is a 422. Supplying a trackingNumber for any target state other
        than sent is a 400, as is an empty patch document. This write persists
        the status, the state-change timestamp, and the send date and tracking
        number on a sent transition, and writes the communication-log audit
        trail for the transition (publishing drafts when the sample leaves
        received); it emits no notification or workflow side effect.
        Cross-organization access is a 403, a missing style or request a 404, a
        failed test operation, an operation that changes the id, or another
        write changing the status while this write is in progress a 409, and any
        other inapplicable operation a 422. The transition is validated against
        the status at the time of the write, not against the seeded document.
      operationId: StyleSampleRequests_PatchSampleRequest
      parameters:
        - name: styleId
          in: path
          description: Identifier of the style the sample request belongs to.
          required: true
          schema:
            type: integer
            format: int64
        - name: id
          in: path
          description: Identifier of the sample request to update.
          required: true
          schema:
            type: integer
            format: int64
        - name: X-Delogue-Api
          in: header
          schema:
            type: string
      requestBody:
        content:
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/JsonPatchDocument'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponseOfStyleSampleRequestDto'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
      security:
        - {}
components:
  schemas:
    JsonPatchDocument:
      type: array
      items:
        type: object
        oneOf:
          - required:
              - op
              - path
              - value
            type: object
            properties:
              op:
                enum:
                  - add
                  - replace
                  - test
                type: string
              path:
                type: string
              value: {}
            additionalProperties: false
          - required:
              - op
              - path
              - from
            type: object
            properties:
              op:
                enum:
                  - move
                  - copy
                type: string
              path:
                type: string
              from:
                type: string
            additionalProperties: false
          - required:
              - op
              - path
            type: object
            properties:
              op:
                enum:
                  - remove
                type: string
              path:
                type: string
            additionalProperties: false
    ApiResponseOfStyleSampleRequestDto:
      required:
        - status
        - code
        - data
      type: object
      properties:
        status:
          $ref: '#/components/schemas/ApiResponseStatus'
          description: >-
            The coarse outcome of the request, indicating whether it succeeded
            or failed.
        code:
          type: string
          description: >-
            The specific machine-readable outcome code, such as ok on success or
            the most specific error code on failure. Always lowercase on the
            wire.
        data:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/StyleSampleRequestDto'
              description: >-
                The response payload, either a single object for a by-id read or
                an array for a bulk operation. Omitted from the body when there
                is no value.
          description: >-
            The response payload, either a single object for a by-id read or an
            array for a bulk operation. Omitted from the body when there is no
            value.
      additionalProperties: false
    ApiErrorResponse:
      type: object
      properties:
        status:
          $ref: '#/components/schemas/ApiResponseStatus'
          description: >-
            The coarse outcome of the request, indicating whether it succeeded
            or failed.
        code:
          type: string
          description: >-
            The specific machine-readable outcome code, such as ok on success or
            the most specific error code on failure. Always lowercase on the
            wire.
        error:
          $ref: '#/components/schemas/ErrorWrapper'
          description: >-
            The error payload, present instead of data on a failed response. It
            wraps the list of detail rows describing what went wrong.
      additionalProperties: false
    ApiResponseStatus:
      enum:
        - success
        - error
      type: string
      description: >-
        The coarse outcome of the request, indicating whether it succeeded or
        failed.
    StyleSampleRequestDto:
      type: object
      properties:
        id:
          type: integer
          description: Unique identifier of the sample request.
          format: int64
        styleId:
          type: integer
          description: Identifier of the style this sample request belongs to.
          format: int64
        status:
          $ref: '#/components/schemas/StyleSampleRequestStatusDto'
          description: >-
            Current status of the sample request as it moves through the
            request, send, receive and comment sample workflow.
        deadline:
          type:
            - 'null'
            - string
          description: >-
            Date by which the requested sample is due. Null when no deadline has
            been set.
          format: date-time
        etd:
          type:
            - 'null'
            - string
          description: >-
            Estimated time of departure for the sample shipment. Null when not
            set.
          format: date-time
        sendDate:
          type:
            - 'null'
            - string
          description: >-
            Date the sample was dispatched by the supplier. Null until the
            sample is sent.
          format: date-time
        lastStateChange:
          type:
            - 'null'
            - string
          description: >-
            Timestamp of the most recent status or archive change on the sample
            request.
          format: date-time
        note:
          type:
            - 'null'
            - string
          description: >-
            Free-text note attached to the sample request. Null when none was
            entered.
        trackingNumber:
          type:
            - 'null'
            - string
          description: >-
            Carrier tracking number for the dispatched sample. Null until a
            tracking number is recorded.
        sampleType:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/SampleTypeDto'
              description: >-
                The sample type this request was raised for, such as a fit or
                proto sample. Null when no sample type is set.
          description: >-
            The sample type this request was raised for, such as a fit or proto
            sample. Null when no sample type is set.
        properties:
          type: array
          items:
            type: string
          description: >-
            Extensibility flags for the sample request. Emits is_archived when
            the request has been archived.
      additionalProperties: false
    ErrorWrapper:
      type: object
      properties:
        details:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetailDto'
          description: >-
            The list of individual error detail rows for this failure, one per
            field or rule that failed.
      additionalProperties: false
      description: >-
        The error payload, present instead of data on a failed response. It
        wraps the list of detail rows describing what went wrong.
    StyleSampleRequestStatusDto:
      enum:
        - requested
        - sent
        - received
        - commented
        - cancelled
        - confirmed
        - planned
      type: string
      description: >-
        Current status of the sample request as it moves through the request,
        send, receive and comment sample workflow.
    SampleTypeDto:
      type: object
      properties:
        id:
          type: integer
          description: Unique identifier of the sample type.
          format: int64
        name:
          type: string
          description: >-
            Display name of the sample type, such as Proto sample or Sales
            sample. Shown when creating sample requests on a style.
        state:
          $ref: '#/components/schemas/SampleTypeState'
          description: >-
            Lifecycle state of the sample type. An inactive sample type cannot
            be selected when creating new sample requests.
        commentDeadline:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          description: >-
            Number of days after the sample is received within which the brand
            should post comments. Null when no deadline is configured.
          format: int32
        position:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - integer
            - string
          description: >-
            1-based display order among the organization's sample types,
            reflecting the sequence of the sampling process. Controlled by the
            server.
          format: int32
        notifySettings:
          type: array
          items:
            enum:
              - requested
              - sent
              - received
              - commented
              - cancelled
              - confirmed
              - planned
            type: string
          description: >-
            Sample-request statuses that trigger an email notification to the
            supplier contact when that status is set. A status absent from the
            list sends no email for it.
        properties:
          type: array
          items:
            type: string
          description: >-
            Extensibility flags for the sample type. Currently always an empty
            array.
      additionalProperties: false
      description: >-
        The sample type this request was raised for, such as a fit or proto
        sample. Null when no sample type is set.
    ErrorDetailDto:
      required:
        - type
        - field
        - value
      type: object
      properties:
        type:
          type: string
          description: >-
            The hierarchical error code identifying the specific failure, such
            as validation_error.required_field. Consumers branch on this rather
            than on the message text.
        field:
          type:
            - 'null'
            - string
          description: >-
            The input field that caused the failure. Omitted when no specific
            field is at fault, such as an authorization denial or a server
            error.
        value:
          type:
            - 'null'
            - string
          description: >-
            A human-readable message describing the failure, or the offending
            value or limit that triggered it.
      additionalProperties: false
    SampleTypeState:
      enum:
        - active
        - inactive
        - deleted
      type: string
      description: >-
        Lifecycle state of the sample type. An inactive sample type cannot be
        selected when creating new sample requests.

````

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