# Retrieve an order factory

To [fetch](https://docs.commercelayer.io/core/fetching-resources) a single order factory, send a `GET` request to the `/api/order_factories/:id` endpoint, where `id` is the ID of the resource that you want to retrieve.

## Request

**GET** <https://yourdomain.commercelayer.io/api/order\\_factories/:id>

### **Example**

{% tabs %}
{% tab title="Request" %}
The following request fetches the order factory identified by the ID "XAyRWNUzyN":

```shell
curl -g -X GET \
  'https://yourdomain.commercelayer.io/api/order_factories/XAyRWNUzyN' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token'
```

{% endtab %}

{% tab title="Response" %}
On success, the API responds with a `200 OK` status code, returning a single resource object:

```json
{
  "data": {
    "id": "XAyRWNUzyN",
    "type": "order_factories",
    "links": {
      "self": "https://yourdomain.commercelayer.io/api/order_factories/XAyRWNUzyN"
    },
    "attributes": {
      "type": "recurring_order_copies",
      "status": "in_progress",
      "started_at": "2018-01-01T12:00:00.000Z",
      "completed_at": "2018-01-01T12:00:00.000Z",
      "failed_at": "2018-01-01T12:00:00.000Z",
      "errors_log": {
        "status": [
          "cannot transition from draft to placed"
        ]
      },
      "errors_count": 2,
      "place_target_order": true,
      "reuse_wallet": true,
      "created_at": "2018-01-01T12:00:00.000Z",
      "updated_at": "2018-01-01T12:00:00.000Z",
      "reference": "ANY-EXTERNAL-REFEFERNCE",
      "reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
      "metadata": {
        "foo": "bar"
      }
    },
    "relationships": {
      "source_order": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/order_factories/XAyRWNUzyN/relationships/source_order",
          "related": "https://yourdomain.commercelayer.io/api/order_factories/XAyRWNUzyN/source_order"
        }
      },
      "target_order": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/order_factories/XAyRWNUzyN/relationships/target_order",
          "related": "https://yourdomain.commercelayer.io/api/order_factories/XAyRWNUzyN/target_order"
        }
      },
      "events": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/order_factories/XAyRWNUzyN/relationships/events",
          "related": "https://yourdomain.commercelayer.io/api/order_factories/XAyRWNUzyN/events"
        }
      },
      "event_stores": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/order_factories/XAyRWNUzyN/relationships/event_stores",
          "related": "https://yourdomain.commercelayer.io/api/order_factories/XAyRWNUzyN/event_stores"
        }
      }
    },
    "meta": {
      "mode": "test",
      "organization_id": "xRRkjDFafe",
      "trace_id": "69abaa3545913c78132e5578bd26208d44aa9043647d78698fd0021f3958cd74"
    }
  }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.commercelayer.io/core-api-reference/order_factories/retrieve.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
