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

# Create Order Results

> Creates a lab-result record for an order and queues it for the EHR.

Creating results is asynchronous: a valid request creates a lab-result record, returns immediately with the `lab_result_id`, and queues the record for the EHR. A `lab_result.created` webhook is sent when processing completes. If the operation fails terminally, a `lab_result.create_failed` webhook is sent instead.

Each result targets a component of the order. Reference a component by its `component` (name) or `field_id`, both of which come from the `result_components` returned by [Get Order](/api-reference/orders/get-by-id).

Creating order results is only supported for eClinicalWorks.

### Request Parameters

#### Required Fields

* **results** (array, required): Result values, one per component. At least one entry is required. Each entry is an object with:

  * **value** (string or number, required): The result value.
  * **component** (string): The component name, from `GET /v1/orders/{id}`.
  * **field\_id** (string): The component's EMR id, from `GET /v1/orders/{id}`.

  Provide `component` or `field_id` to identify each component.

#### Optional Fields

* **result\_date** (string, optional): Result date (ISO 8601, YYYY-MM-DD). Defaults to today when omitted.
* **collected\_date** (string, optional): Specimen collection date (ISO 8601, YYYY-MM-DD).
* **collection\_time** (string, optional): Specimen collection time, e.g. `"12:58 PM"`.
* **callback\_urls** (string\[], optional): URLs to receive the `lab_result.created` webhook, in addition to the account webhook.

### Example Request

```bash theme={null}
curl -X POST https://api.usecobalt.com/v1/orders/ord_123456/results \
-H 'Content-Type: application/json' \
-H 'client_id: ci_live_198908HJDKJSH98789OHKJL' \
-H 'client_secret: cs_live_9827hofdsklOYYHJLJh' \
-H 'access_token: 493JKLHIU98789hLKH9HHJH' \
-d '{
    "results": [
        { "component": "1hr Glucose (OB)", "value": 142 },
        { "field_id": "col_1002", "value": "88" }
    ],
    "result_date": "2026-03-17",
    "collected_date": "2026-03-16",
    "collection_time": "09:15 AM"
}'
```

### Example Response

```json theme={null}
{
  "success": true,
  "message": "Lab result created and queued. A lab_result.created webhook will be sent when it completes.",
  "lab_result_id": "lr_123456",
  "order_id": "ord_123456",
  "job_id": 12345
}
```

### Webhook Notifications

When processing completes, we send a webhook to your registered endpoint.

#### Success

```json theme={null}
{
  "id": "evt_1J9X2q2eZvKYlo2CluR9g9gV",
  "access_token_reference_id": "user_1J9X2q2eZvKYlo2Cxyz",
  "object": "event",
  "created": "2025-10-09T10:30:00Z",
  "type": "lab_result.created",
  "job_id": "12345",
  "data": {
    "lab_result_id": "lr_123456",
    "order_id": "ord_123456",
    "emr_order_id": "998877",
    "emr_encounter_id": "445566",
    "patient_mrn": "12345"
  }
}
```

#### Failure

```json theme={null}
{
  "id": "evt_1J9X2q2eZvKYlo2CluR9g9gW",
  "access_token_reference_id": "user_1J9X2q2eZvKYlo2Cxyz",
  "object": "event",
  "created": "2025-10-09T10:35:00Z",
  "type": "lab_result.create_failed",
  "job_id": "12345",
  "data": {
    "lab_result_id": "lr_123456",
    "order_id": "ord_123456",
    "patient_mrn": "12345",
    "failure_reason": "Lab result creation failed after multiple attempts. Please try again later or contact support."
  }
}
```


## OpenAPI

````yaml POST /orders/{id}/results
openapi: 3.1.0
info:
  title: Cobalt API
  version: 1.0.1
  description: API for interacting with Cobalt's EHR integration services
servers:
  - url: https://api.usecobalt.com/v1
    description: Production
security:
  - ClientCredentials: []
    ClientSecret: []
    AccessToken: []
paths:
  /orders/{id}/results:
    post:
      tags:
        - Orders
      summary: Add results to an order
      description: Queues result values for an existing order.
      operationId: addOrderResults
      parameters:
        - name: id
          in: path
          description: Cobalt order ID.
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - results
              properties:
                results:
                  type: array
                  items:
                    type: object
                    properties:
                      component:
                        type: string
                      field_id:
                        type: string
                      value:
                        anyOf:
                          - type: string
                          - type: number
                    required:
                      - value
                  minItems: 1
                  x-supported-emrs:
                    - eClinicalWorks
                  description: >-
                    Result values, one per component. Reference a component by
                    `component` (its name, from GET /v1/orders/:id) or
                    `field_id`.
                  x-required-for-emrs:
                    - eClinicalWorks
                result_date:
                  type: string
                  x-supported-emrs:
                    - eClinicalWorks
                  description: >-
                    Result date (ISO 8601, YYYY-MM-DD). Defaults to today when
                    omitted.
                collected_date:
                  type: string
                  x-supported-emrs:
                    - eClinicalWorks
                  description: Specimen collection date (ISO 8601, YYYY-MM-DD).
                collection_time:
                  type: string
                  x-supported-emrs:
                    - eClinicalWorks
                  description: Specimen collection time, e.g. "12:58 PM".
                callback_urls:
                  type: array
                  items:
                    type: string
                  x-supported-emrs:
                    - eClinicalWorks
                  description: >-
                    URLs to receive the lab_result.created webhook, in addition
                    to the account webhook.
      responses:
        '200':
          description: Lab result created and queued for the EMR
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  lab_result_id:
                    type: string
                  order_id:
                    type: string
                  job_id:
                    anyOf:
                      - type: string
                      - type: number
                required:
                  - success
                  - message
                  - lab_result_id
                  - order_id
                  - job_id
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  responses:
    BadRequest:
      description: Bad request — missing or invalid parameters
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                enum:
                  - false
              message:
                type: string
            required:
              - success
              - message
    Unauthorized:
      description: Unauthorized — missing or invalid credentials
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                enum:
                  - false
              message:
                type: string
            required:
              - success
              - message
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                enum:
                  - false
              message:
                type: string
            required:
              - success
              - message
  securitySchemes:
    ClientCredentials:
      type: apiKey
      in: header
      name: client_id
    ClientSecret:
      type: apiKey
      in: header
      name: client_secret
    AccessToken:
      type: apiKey
      in: header
      name: access_token

````