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

# Create Bulk Operation

> Create a new bulk operation.




## OpenAPI

````yaml post /bulk-operations
openapi: 3.1.0
info:
  title: Bulk Operations API
  description: >-
    API for performing bulk operations for various resources


    ### Resource identifier format


    Resource identifiers (the `id` field and related global-identifier fields)
    are returned as JSON

    integers by default. To receive them as strings instead, send the

    `X-Loop-Global-Identifier-Type: string` request header.
  version: v1
servers:
  - url: https://api.loopreturns.com/api/v1
security: []
tags:
  - name: Bulk Operations
    description: Operations related to managing resources in bulk
paths:
  /bulk-operations:
    post:
      tags:
        - Bulk Operations
      summary: Create Bulk Operation
      description: |
        Create a new bulk operation.
      operationId: createBulkOperation
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CreateBulkOperationRequest'
      responses:
        '201':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  bulk_operation:
                    $ref: '#/components/schemas/BulkOperationResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedResponse'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
      security:
        - write: []
components:
  schemas:
    CreateBulkOperationRequest:
      type: object
      properties:
        file:
          type: string
          format: binary
          description: >
            The JSONL file containing the data for the bulk operations.


            Each line contains an individual operation, formatted as follows:


            `{"type": "{job type}", "parameters": {}, "payload": {}}`


            The following job types are supported:

            - [`order_create`](/api-reference/latest/orders/create-order)

            - [`order_update`](/api-reference/latest/orders/update-order)

            - [`order_upsert`](/api-reference/latest/orders/upsert-order)

            - [`order_delete`](/api-reference/latest/orders/delete-order)

            - [`product_create`](/api-reference/latest/products/create-product)

            - [`product_update`](/api-reference/latest/products/update-product)

            - [`product_upsert`](/api-reference/latest/products/upsert-product)

            - [`product_delete`](/api-reference/latest/products/delete-product)

            -
            [`product_variant_create`](/api-reference/latest/products/create-product-variant)

            -
            [`product_variant_update`](/api-reference/latest/products/update-product-variant)

            -
            [`product_variant_upsert`](/api-reference/latest/products/upsert-product-variant)

            -
            [`product_variant_delete`](/api-reference/latest/products/delete-product-variant)

            -
            [`collection_create`](/api-reference/latest/collections/create-collection)

            -
            [`collection_update`](/api-reference/latest/collections/update-collection)

            -
            [`collection_upsert`](/api-reference/latest/collections/upsert-collection)

            -
            [`collection_delete`](/api-reference/latest/collections/delete-collection)

            -
            [`inventory_upsert`](/api-reference/latest/inventories/upsert-inventory)

            -
            [`inventory_delete`](/api-reference/latest/inventories/delete-inventory)


            For most job types, `id` is the only parameter.

            Product variant jobs require `id` to be the product variant ID and
            `productId` to be the product ID.


            Payload details can be found in the documentation for each job,
            linked above.


            Lines must be separated with `\n`.


            There is no limit to the number of lines that can be included in a
            file,

            but bulk operation files are limited to 2 MB in size.
          examples:
            - type: product_update
              parameters:
                id: 1234567890
              payload:
                external_id: product-example-id
                sku: LOOP-12345
                name: Example
                weight_grams: 500
                barcode: Updated-Barcode
                description: An example product
                type: Example Product Type
                vendor: Internal
                price:
                  currency_code: USD
                  amount: 100
                created_at: '2023-08-10T15:00:00+00:00'
                updated_at: '2023-08-12T15:00:00+00:00'
                provider: Shopify
                options:
                  - position: 1
                    name: Color
                    values:
                      - red
                      - green
                      - blue
                  - position: 2
                    name: Condition
                    values:
                      - new
                      - used
                      - refurbished
                images:
                  - https://example.com/image.jpg
                  - https://example.com/image.png
                tags:
                  - Socks
                  - Sandals
                  - Sunglasses
      required:
        - file
    BulkOperationResponse:
      type: object
      properties:
        id:
          type: integer
          format: int64
          description: The unique identifier for the bulk operation, created by Loop.
          examples:
            - 641174584320376000
        status:
          type:
            - string
            - 'null'
          description: The status of the bulk operation.
          enum:
            - pending
            - processed_with_failures
            - processed_successful
        pending_count:
          type: integer
          format: int32
          description: The number of pending jobs.
          examples:
            - 1
        failed_count:
          type: integer
          format: int32
          description: The number of failed jobs.
          examples:
            - 0
        success_count:
          type: integer
          format: int32
          description: The number of successful jobs.
          examples:
            - 0
        created_at:
          type: string
          format: date-time
          description: The date and time at which the bulk operation was created.
          examples:
            - '2023-04-25T13:25:00-05:00'
        updated_at:
          type: string
          format: date-time
          examples:
            - '2023-04-27T13:25:00-05:00'
          description: The date and time at which the bulk operation was updated.
    UnauthorizedResponse:
      type: object
      required:
        - errors
      properties:
        errors:
          type: string
          examples:
            - Unauthorized.
    ValidationErrorResponse:
      type: object
      description: >-
        Returned when the request fails validation. Uses Laravel's standard
        validation error shape.
      properties:
        message:
          type: string
          examples:
            - The file field is required.
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          examples:
            - file:
                - The file field is required.
  securitySchemes:
    write:
      type: apiKey
      in: header
      name: X-Authorization
      description: 'API Scope: "Bulk Operations (write)"'
      x-scope: Bulk Operations (Write)

````