---
agentTools:
  projectIndex: https://payment-orchestrator.readme.io/llms.txt
---

# Scopes

A scope is a template for input and output fields of one or more [Workflows](https://payment-orchestrator.readme.io/reference/workflows). It can be compared to a relational database schema, where you first configure tables and their columns and then you insert data. A scope must exist before any workflows can be created.

### Example

This is an example of a Scope used for an hypothetical Payment Transactions scenario:

```json json
{
    "id": "1d00701f-9593-4a18-ba65-275b5b9310cc",
    "name": "Payment Transaction",
    "input": {
      "fields": [
        {
          "path": "reference",
          "type": "String",
          "required": true,
          "queryable": false
        },
        {
          "path": "amount",
          "type": "Numeric",
          "required": true,
          "queryable": true
        },
        {
          "path": "currency",
          "type": "String",
          "required": true,
          "queryable": true
        }
      ]
    },
    "output": {
      "fields": [
        {
          "path": "receiver.id",
          "type": "String",
          "required": true
        }
      ]
    },
    "createdAt": "2022-10-28T16:23:37.029Z",
    "updatedAt": "2022-10-28T16:23:37.029Z"
  }
```

This scope:

* Has three `required` input fields: `reference`, `amount` and `currency`, but only two may be used by workflow rules, according to the `queryable` flag: `amount` and `currency`. `reference` will still be saved by the workflow execution engine and may be used to filter workflow executions. Note that all required input fields need to be passed upon the execution of a workflow that targets the respective scope.
* Has one `required` output field called `receiver.id`. This means that workflows targeting this scope must have a rule set where all possible paths get this field assigned.

### Field Hierarchy

You can use the dot (**.**) notation to define hierarchy in field path names. Therefore, the field path `receiver.id` maps to the following JSON notation:

```json JSON
{
    "receiver": {
        "id": <value>
    }
}
```

For **input fields** using this notation, you may also provide the field name as a plain `receiver.id` . However, for **output fields** the workflow engine will always return the JSON notation explained above.

### Scope Field Data Types

For information about all possible scope field data types, check out [Scope Field Data Types](https://payment-orchestrator.readme.io/reference/scope-field-data-types)