# Queries

## Query by order-id

Returns a Credit Data Order by ID.

GraphQL

```graphql
query ($id: uuid!) {
  credit_data_order_by_pk(order_id: $id) {
    # order fields
  }
}
```

#### Arguments

`orderId` \- `uuid!``non-null`

The ID of the order to return.

#### Possible returns

`Order.*`\- [`CreditDataOrder`](https://developers.bloomcredit.io/reference/credit-data-order-1)

Any requested field from the Order object.

### Examples

Get an order by its ID

The following query retrieves an order with its ID, returning the order date.

GQL

```graphql
query ($id: uuid!) {
  credit_data_order_by_pk(order_id: $id) {
    consumer_id
    credit_scores {
      model
      value
    },
    order_id,
    order_date,
    tradelines{
        account{
            account_number,
            type,
            type_description,
            account_date_opened,
            account_date_closed
        }
    }
  }
}
```

Response

```json
{
    "data": {
        "credit_data_order_by_pk": {
            "consumer_id": "e61b2429-ed55-4f40-be12-ff860d4de39a",
            "credit_scores": [
                {
                    "model": "FICO8",
                    "value": 571
                }
            ],
            "order_id": "df547033-414c-44c7-be43-73ec60b73684",
            "order_date": null,
            "tradelines": [
                {
                    "account": {
                        "account_number": "9064264682000",
                        "type": "REVOLVING",
                        "type_description": "Credit Card",
                        "account_date_opened": "2022-03-01",
                        "account_date_closed": null
                    }
                }
            ]
        }
    }
}
```

## Query credit attributes

Returns a Credit Attributes related to an order.

GraphQL

```graphql
query ($id: String!) {
  get_auto_attributes_by_order_id(args: {id: $id}) {
    # credit data fields
  }
  get_delinquency_attributes_by_order_id(args: {id: $id}) {
    # credit data fields
  }
  get_mortgage_attributes_by_order_id(args: {id: $id}) {
    # credit data fields
  }
  get_revolving_attributes_by_order_id(args: {id: $id}) {
    # credit data fields
  }
  get_specialized_attributes_by_order_id(args: {id: $id}) {
    # credit data fields
  }
  get_student_loans_attributes_by_order_id(args: {id: $id}) {
    # credit data fields
  }
  get_tradeline_attributes_by_order_id(args: {id: $id}) {
    # credit data fields
  }
  get_worst_attributes_by_order_id(args: {id: $id}) {
    # credit data fields
  }
  get_unsecured_installment_attributes_by_order_id(args: {id: $id}) {
    # credit data fields
  }
}
```

#### Arguments

`id` \- `String!``non-null`

The ID of the related order

#### Possible returns

Refer to the [Credit Attributes](https://developers.bloomcredit.io/reference/attributes-1) page for detailed information.

### Examples

Get unsecured installment Credit Attributes

The following query retrieves an order with its ID, returning the order date.

GQL

```graphql
query ($id: String!) {
   get_unsecured_installment_attributes_by_order_id(args: {id: $id}) {
    unsecured_installment_tradelines_opened_6_months
    total_unsecured_installment_tradelines
    total_monthly_payment_obligation_for_open_unsecured_installment
    outstanding_balance_open_unsecured_installment_tradelines
    open_unsecured_installment_tradelines
    months_recent_unsecured_installment_tradelines_opened
    months_recent_unsecured_installment_tradeline_delinquency
    active_installment_tradelines
  }
}
```

Response

```json
{
    "data": {
        "get_unsecured_installment_attributes_by_order_id": [
            {
                "unsecured_installment_tradelines_opened_6_months": "000000098",
                "total_unsecured_installment_tradelines": null,
                "total_monthly_payment_obligation_for_open_unsecured_installment": null,
                "outstanding_balance_open_unsecured_installment_tradelines": null,
                "open_unsecured_installment_tradelines": "000000098",
                "months_recent_unsecured_installment_tradelines_opened": "000000998",
                "months_recent_unsecured_installment_tradeline_delinquency": "000000996",
                "active_installment_tradelines": "000000006"
            }
        ]
    }
}
```
