# V1 Create Cursor

Create a cursor to paginate large data sets.
## Usage Notes
- The cursor expires after 5 minutes of inactivity. However, with continuous use, you can keep the cursor alive up to a maximum of 12 hours.
- A maximum of 10 cursors are allowed. Creation of the 11th cursor will result in the removal of the oldest cursor that is marked for expiration.
- The limit query parameter may be overridden by the server. The server will calculate the optimal limit depending upon the requested number of loans and fields.
- The cursorType is randomAccess which allows you to randomly assign a start position to start the pagination to retrieve data for the specified cursor.
- When specifying a cursorType, the request can only include a filter attribute.
- The x-total-count is a response header attribute that indicates the total number of loans matching your filter criteria.
- The x-cursor is a response header attribute that represents the name of the cursor.
- This API requires Encompass 17.3 or greater.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "version": "1.0",
    "title": "Loan: Loan Pipeline",
    "summary": "Use these APIs to search for loans and loan fields on the Pipeline, and to create a cursor to paginate large data sets. ",
    "description": ""
  },
  "servers": [
    {
      "url": "https://api.elliemae.com",
      "description": "Production"
    },
    {
      "url": "https://concept.api.elliemae.com",
      "description": "UAT"
    }
  ],
  "paths": {
    "/encompass/v1/loanPipeline?cursorType=randomAccess&limit=<count>": {
      "post": {
        "tags": [
          "V1 Loan Pipeline"
        ],
        "summary": "V1 Create Cursor",
        "description": "Create a cursor to paginate large data sets.\r\n## Usage Notes\r\n- The cursor expires after 5 minutes of inactivity. However, with continuous use, you can keep the cursor alive up to a maximum of 12 hours.\r\n- A maximum of 10 cursors are allowed. Creation of the 11th cursor will result in the removal of the oldest cursor that is marked for expiration.\r\n- The limit query parameter may be overridden by the server. The server will calculate the optimal limit depending upon the requested number of loans and fields.\r\n- The cursorType is randomAccess which allows you to randomly assign a start position to start the pagination to retrieve data for the specified cursor.\r\n- When specifying a cursorType, the request can only include a filter attribute.\r\n- The x-total-count is a response header attribute that indicates the total number of loans matching your filter criteria.\r\n- The x-cursor is a response header attribute that represents the name of the cursor.\r\n- This API requires Encompass 17.3 or greater.",
        "operationId": "create-cursor",
        "parameters": [
          {
            "$ref": "#/components/parameters/Authorization"
          },
          {
            "name": "cursorType",
            "in": "query",
            "description": "cursorType is `randomAccess`. Required only for pagination.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start",
            "in": "query",
            "description": "Zero-based starting index. The default is zero.",
            "schema": {
              "type": "integer",
              "default": "0"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "The maximum number of items to return in a page. Refer to the _Usage Notes_ in this endpoint page.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1LoanPipelineViewContract",
                "x-examples": {
                  "Example 1": {
                    "filter": {
                      "operator": "and",
                      "terms": [
                        {
                          "canonicalName": "Loan.LoanFolder",
                          "value": "(Trash)",
                          "matchType": "exact",
                          "include": false
                        },
                        {
                          "canonicalName": "Loan.LastModified",
                          "value": "02/25/2011",
                          "matchType": "greaterThanOrEquals",
                          "precision": "day"
                        }
                      ]
                    },
                    "fields": [
                      "Loan.GUID",
                      "Loan.LastModified"
                    ],
                    "sortOrder": [
                      {
                        "canonicalName": "Loan.LastModified",
                        "order": "desc"
                      }
                    ]
                  }
                }
              },
              "examples": {
                "Request Example": {
                  "value": {
                    "filter": {
                      "operator": "and",
                      "terms": [
                        {
                          "canonicalName": "Loan.LoanFolder",
                          "value": "(Trash)",
                          "matchType": "exact",
                          "include": false
                        },
                        {
                          "canonicalName": "Loan.LastModified",
                          "value": "02/25/2011",
                          "matchType": "greaterThanOrEquals",
                          "precision": "day"
                        }
                      ]
                    },
                    "fields": [
                      "Loan.GUID",
                      "Loan.LastModified"
                    ],
                    "sortOrder": [
                      {
                        "canonicalName": "Loan.LastModified",
                        "order": "desc"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1LoanPipelineViewContract"
                },
                "examples": {
                  "Model Data Sample": {
                    "value": {
                      "loanGuids": [
                        "string"
                      ],
                      "filter": [
                        {
                          "canonicalName": "string",
                          "value": "string",
                          "matchType": "string",
                          "precision": "string",
                          "include": true,
                          "terms": [
                            null
                          ],
                          "operator": "string"
                        }
                      ],
                      "fields": [
                        "string"
                      ],
                      "sortOrder": [
                        {
                          "canonicalName": "string",
                          "order": "string"
                        }
                      ]
                    }
                  },
                  "Live Data Sample": {
                    "value": [
                      {
                        "loanGuid": "b3a93a11-4c48-4c76-8685-f8edcb318f3c",
                        "fields": {
                          "Loan.LastModified": "7/13/2017 10:10:27 AM"
                        }
                      },
                      {
                        "loanGuid": "d23f6dcc-9fe5-4c9e-823c-31c5037b4253",
                        "fields": {
                          "Loan.LastModified": "7/13/2017 10:09:11 AM"
                        }
                      },
                      {
                        "loanGuid": "73b7b9ed-c98f-4996-9ea4-ee47e02ed1c1",
                        "fields": {
                          "Loan.LastModified": "7/13/2017 10:09:09 AM"
                        }
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          },
          "500": {
            "description": "Internal Server Error"
          }
        },
        "servers": [
          {
            "url": "https://api.elliemae.com",
            "description": "Production"
          },
          {
            "url": "https://concept.api.elliemae.com",
            "description": "UAT"
          }
        ]
      }
    }
  },
  "components": {
    "parameters": {
      "Authorization": {
        "name": "Authorization",
        "in": "header",
        "description": "Bearer token",
        "required": true,
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "V1LoanPipelineViewContract": {
        "type": "object",
        "title": "V1LoanPipelineViewContract",
        "description": "The following attributes make up the V1LoanPipelineViewContract object.",
        "properties": {
          "loanGuids": {
            "type": "array",
            "description": "List of loan IDs. Required if the \"filter\" attribute is not specified.",
            "items": {
              "type": "string"
            }
          },
          "filter": {
            "type": "array",
            "description": "Criteria to filter loans as described by the V1QueryCriterionContract.",
            "items": {
              "$ref": "#/components/schemas/V1QueryCriterionContract"
            }
          },
          "fields": {
            "type": "array",
            "description": "List of fields to return.",
            "items": {
              "type": "string"
            }
          },
          "sortOrder": {
            "type": "array",
            "description": "List of fields with more details like sort order as described by the V1LoanPipelineSortContract.",
            "items": {
              "$ref": "#/components/schemas/V1LoanPipelineSortContract"
            }
          }
        }
      },
      "V1QueryCriterionContract": {
        "type": "object",
        "title": "V1QueryCriterionContract",
        "description": "The following attributes make up the V1QueryCriterionContract object.",
        "properties": {
          "canonicalName": {
            "type": "string",
            "description": "The canonical name of the field to be used in the query."
          },
          "value": {
            "type": "string",
            "description": "Using the **canonicalName** and the **matchType** operator to compare against this constant value. In all cases, this will be a single value except when utilizing the **matchType** of MultiValue. In the case when this is an array of values, the filter term will evaluate to true if any of the values in the array matches the value in the loan."
          },
          "matchType": {
            "type": "string",
            "description": "The match type. Possible values:\r\n\r\n- Equals\r\n- NotEquals\r\n- GreaterThan\r\n- GreaterThanOrEquals\r\n- LessThan\r\n- LessThanOrEquals\r\n- Exact\r\n- StartsWith\r\n- Contains\r\n- IsEmpty\r\n- IsNotEmpty"
          },
          "precision": {
            "type": "string",
            "description": "Possible values are **Exact**, **Minute**, **Hour**, **Day**, **Month**, **Year**, and **Recurring**.<br>\r\nThe default behavior is **Exact**. <br>*NOTE: The Precision attribute only applies to date/dateTime values.*"
          },
          "include": {
            "type": "boolean",
            "description": "The flag `include` works as a **NOT** operator when set to false. Possible values are **true** and **false**.<br>- An `include` value of **true** means all loans satisfying this query term will be considered when evaluating the loans. This is the default value.<br>- An `include` value of **false** means all loans NOT satisfying this query term will be considered when evaluating the loans."
          },
          "terms": {
            "type": "array",
            "description": "For complex queries, an array of filter **terms** that are associated by the operator type can be provided instead of **canonicalName**, **value**, **matchType** and **precision** combination."
          },
          "operator": {
            "type": "string",
            "description": "The operator utilized to link multiple terms. Possible values are **And** and **Or**."
          }
        }
      },
      "V1LoanPipelineSortContract": {
        "type": "object",
        "title": "V1LoanPipelineSortContract",
        "description": "The following attributes make up the V1LoanPipelineSortContract object.",
        "properties": {
          "canonicalName": {
            "type": "string",
            "description": "Canonical field name."
          },
          "order": {
            "type": "string",
            "description": "Possible values are **None**, **Asc** *(for ascending)*, and **Desc** *(for descending)*."
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": false,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 106,
      "1": 4,
      "2": 191,
      "3": 240,
      "4": 161,
      "5": 78,
      "6": 226,
      "7": 124,
      "8": 137,
      "9": 103,
      "10": 180,
      "11": 41
    }
  }
}
```