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

# Ordering actors

> Control who acts on a package and when: sequential flows, parallel steps, and mixed flows built with ProcessStep.

Every actor on a package belongs to a **process step**. Steps run one after another, and all actors
in the same step act in parallel. By choosing each actor's `ProcessStep` you decide whether people
act one at a time, all at once, or a mix of both.

This page shows two worked examples, each built as an
[instant package](https://developers.gonitro.com/docs/nsev/build/tutorials/instant-package.md). The rules the steps must follow are set out in
[The package model → The process](https://developers.gonitro.com/docs/nsev/build/concepts/package-model.md#the-process). In short:

* Steps are numbered from `0`.
* Approver and FormFiller steps come before the first Signer step. Receivers share a single
  last step.
* Each step holds one actor type, except that Approvers and FormFillers may share a step.

A request that breaks these rules fails with `400`, returning `Actor.InvalidOrder` or
`Actor.ReceiversMustComeLast`.

> [!NOTE]
>
> In an instant package, `ProcessStep` only sets the order. The values are sorted and renumbered from `0`,
> so `1`, `5`, `9` become steps `0`, `1`, `2`. Either every non-Receiver actor sets `ProcessStep` or
> none does. A Receiver's `ProcessStep` is ignored: receivers always go in the last step.

## Sequential ordering

In a sequential flow, each actor has a step of their own, so exactly one person acts at a time. The
next person is only invited once the previous one has finished.

In this example, a form filler completes the document first, then an approver reviews it, then two
people sign in a fixed order: Signer B first and Signer A last.

| Step | Actor | Waits for |
| - | - | - |
| `0` | FormFiller | - |
| `1` | Approver | FormFiller |
| `2` | Signer B | Approver |
| `3` | Signer A | Signer B |

The FormFiller and the Approver *could* share step `0`, but here the approver must see the completed
form, so the Approver gets step `1`. The Approver isn't invited until the FormFiller has filled in
every required field.

The order of the stakeholders in the request body doesn't matter. Only `ProcessStep` determines
who goes first.

> [accordion] Request body: Stakeholders
>
> ```json theme={null}
> "Stakeholders": [
>   {
>     "Type": "Person",
>     "Language": "en",
>     "FirstName": "Frank",
>     "LastName": "Filler",
>     "EmailAddress": "frank.filler@example.com",
>     "Actors": [
>       {
>         "Type": "FormFiller",
>         "ProcessStep": 0,
>         "Elements": [
>           {
>             "Type": "TextBoxField",
>             "DocumentIndex": 0,
>             "FieldId": "@LastName1",
>             "ToolTipLabel": "Last name",
>             "IsRequired": true
>           }
>         ]
>       }
>     ]
>   },
>   {
>     "Type": "Person",
>     "Language": "en",
>     "FirstName": "Anna",
>     "LastName": "Approver",
>     "EmailAddress": "anna.approver@example.com",
>     "Actors": [
>       { "Type": "Approver", "ProcessStep": 1 }
>     ]
>   },
>   {
>     "Type": "Person",
>     "Language": "en",
>     "FirstName": "Sam",
>     "LastName": "SignerA",
>     "EmailAddress": "signer.a@example.com",
>     "Actors": [
>       {
>         "Type": "Signer",
>         "ProcessStep": 3,
>         "Elements": [
>           {
>             "Type": "SigningField",
>             "DocumentIndex": 0,
>             "FieldId": "#Sig1",
>             "SigningMethods": ["manual:manual"]
>           }
>         ]
>       }
>     ]
>   },
>   {
>     "Type": "Person",
>     "Language": "en",
>     "FirstName": "Sara",
>     "LastName": "SignerB",
>     "EmailAddress": "signer.b@example.com",
>     "Actors": [
>       {
>         "Type": "Signer",
>         "ProcessStep": 2,
>         "Elements": [
>           {
>             "Type": "SigningField",
>             "DocumentIndex": 0,
>             "Location": { "Page": 1, "Left": 350, "Top": 215 },
>             "Dimensions": { "Width": 150, "Height": 120 },
>             "SigningMethods": ["manual:manual"]
>           }
>         ]
>       }
>     ]
>   }
> ]
> ```

The two signing fields are placed in different ways. Signer A's field references a text marker
(`#Sig1`) that is already in the document, and Signer B's field uses explicit coordinates. Both
work in any flow. See [Field positioning](https://developers.gonitro.com/docs/nsev/build/guides/field-positioning.md).

## Mixed ordering

A mixed flow puts several actors in some steps and one actor in others. Actors who share a step can
act in any order, and the next step starts only once all of them have finished.

In this example, one approver and one form filler start at the same time, a second approver then
reviews their work, and a second form filler completes the document. After that, two signers sign
in parallel, and a third signs last.

| Step | Actors | Starts when |
| - | - | - |
| `0` | Approver 2, FormFiller 1 (parallel) | Package is activated |
| `1` | Approver 1 | Both step `0` actors have finished |
| `2` | FormFiller 2 | Approver 1 has approved |
| `3` | Signer 2, Signer 3 (parallel) | FormFiller 2 has finished |
| `4` | Signer 1 | Signer 2 and Signer 3 have both signed |

Step `0` mixes an Approver and a FormFiller, which is the one allowed combination. Step `3` contains
two actors of the same type, which is always allowed.

> [accordion] Request body: Stakeholders
>
> ```json theme={null}
> "Stakeholders": [
>   {
>     "Type": "Person",
>     "Language": "en",
>     "FirstName": "Alex",
>     "LastName": "Approver1",
>     "EmailAddress": "approver1@example.com",
>     "Actors": [
>       { "Type": "Approver", "ProcessStep": 1 }
>     ]
>   },
>   {
>     "Type": "Person",
>     "Language": "en",
>     "FirstName": "Ava",
>     "LastName": "Approver2",
>     "EmailAddress": "approver2@example.com",
>     "Actors": [
>       { "Type": "Approver", "ProcessStep": 0 }
>     ]
>   },
>   {
>     "Type": "Person",
>     "Language": "en",
>     "FirstName": "Finn",
>     "LastName": "Filler1",
>     "EmailAddress": "filler1@example.com",
>     "Actors": [
>       {
>         "Type": "FormFiller",
>         "ProcessStep": 0,
>         "Elements": [
>           {
>             "Type": "TextBoxField",
>             "DocumentIndex": 0,
>             "FieldId": "@LastName1",
>             "ToolTipLabel": "Last name",
>             "IsRequired": false
>           }
>         ]
>       }
>     ]
>   },
>   {
>     "Type": "Person",
>     "Language": "en",
>     "FirstName": "Fay",
>     "LastName": "Filler2",
>     "EmailAddress": "filler2@example.com",
>     "Actors": [
>       {
>         "Type": "FormFiller",
>         "ProcessStep": 2,
>         "Elements": [
>           {
>             "Type": "CheckBoxField",
>             "DocumentIndex": 0,
>             "FieldId": "@Lang1",
>             "ToolTipLabel": "Mandatory language",
>             "IsRequired": true,
>             "DefaultValue": false
>           }
>         ]
>       }
>     ]
>   },
>   {
>     "Type": "Person",
>     "Language": "en",
>     "FirstName": "Sam",
>     "LastName": "Signer1",
>     "EmailAddress": "signer1@example.com",
>     "Actors": [
>       {
>         "Type": "Signer",
>         "ProcessStep": 4,
>         "Elements": [
>           {
>             "Type": "SigningField",
>             "DocumentIndex": 0,
>             "FieldId": "#Sig1",
>             "SigningMethods": ["manual:manual"]
>           }
>         ]
>       }
>     ]
>   },
>   {
>     "Type": "Person",
>     "Language": "en",
>     "FirstName": "Sara",
>     "LastName": "Signer2",
>     "EmailAddress": "signer2@example.com",
>     "Actors": [
>       {
>         "Type": "Signer",
>         "ProcessStep": 3,
>         "Elements": [
>           {
>             "Type": "SigningField",
>             "DocumentIndex": 0,
>             "Location": { "Page": 1, "Left": 350, "Top": 215 },
>             "Dimensions": { "Width": 150, "Height": 120 },
>             "SigningMethods": ["manual:manual"]
>           }
>         ]
>       }
>     ]
>   },
>   {
>     "Type": "Person",
>     "Language": "en",
>     "FirstName": "Sid",
>     "LastName": "Signer3",
>     "EmailAddress": "signer3@example.com",
>     "Actors": [
>       {
>         "Type": "Signer",
>         "ProcessStep": 3,
>         "Elements": [
>           {
>             "Type": "SigningField",
>             "DocumentIndex": 0,
>             "Location": { "Page": 1, "Left": 350, "Top": 415 },
>             "Dimensions": { "Width": 150, "Height": 120 },
>             "SigningMethods": ["manual:manual"]
>           }
>         ]
>       }
>     ]
>   }
> ]
> ```

## Changing the order after creation

`ProcessStep` sets the order when you create actors. While the package is still a draft, you can
also read and restructure the process directly: add a step, add an actor to an existing step, or
replace the whole process at once. See [Get process](https://developers.gonitro.com/docs/nsev/api-reference/process/get-process.md) and
[Update process](https://developers.gonitro.com/docs/nsev/api-reference/process/update-process.md).

## Next steps

* Place the fields each actor works with in [Field positioning](https://developers.gonitro.com/docs/nsev/build/guides/field-positioning.md)
* Build the full request in [Instant package](https://developers.gonitro.com/docs/nsev/build/tutorials/instant-package.md)
* Track each actor's `Waiting` and `Available` statuses as described in [The package model → Actor status](https://developers.gonitro.com/docs/nsev/build/concepts/package-model.md#actor-status)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.