{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"type":"markdown"},"seo":{"title":"Quickstart: create a template"},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"quickstart-create-a-template","__idx":0},"children":["Quickstart: create a template"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This example saves a template that opens a URL passed at run time and returns the final address, including any redirect. Run the snippets in order in one Bash session on macOS or Linux; on Windows, use WSL. You need MoreLogin desktop client V2.73.0 or later, curl 7.76 or later, jq, and uuidgen. Keep the generated files: the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/browser-rpa/run-api-example"},"children":["run example"]}," and ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/browser-rpa/local-api#recovery"},"children":["request recovery"]}," use them."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"1-discover-capabilities-and-contracts","__idx":1},"children":["1. Discover capabilities and contracts"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Set the port to the Local API port shown in the MoreLogin client. The commands work in a private temporary directory, because real template and run responses can contain sensitive values."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"umask 077\nRPA_BASE_URL='http://127.0.0.1:40000/api/rpa/browser/v1'\nRPA_DIR=\"$(mktemp -d)\" && cd \"$RPA_DIR\"\nrpa_curl() {\n  curl --fail-with-body -sS --max-time 30 \"$@\"\n}\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you enabled Local API authentication, add the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Authorization"]}," header described in ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/api-reference/getting-started/authentication"},"children":["Authentication"]}," to the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["curl"]}," command in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["rpa_curl"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Check that the client supports the operations this example uses, and record the catalog revision. Write requests send it back in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["X-RPA-Catalog-Revision"]}," header."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"rpa_curl \"$RPA_BASE_URL/capabilities\" -o capabilities.json &&\njq '.data | {operations, limits, docs}' capabilities.json &&\njq -e '.data.operations as $ops | [\"listNodeTypes\",\"getNodeType\",\"validateWorkflow\",\"createTemplate\"] - $ops | length == 0' capabilities.json &&\nRPA_CATALOG_REVISION=\"$(jq -er '.data.catalogRevision' capabilities.json)\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Read the contracts of the four node types in the example. The last command succeeds only if every contract is authorable, supported at run time, runnable through the API, and fully documented. ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/browser-rpa/node-contract-guide"},"children":["Shared fields and workflow structure"]}," explains each contract field."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"rpa_curl --get \"$RPA_BASE_URL/node-types\" --data-urlencode 'q=gotoUrl' -o node-types.json &&\nrpa_curl \"$RPA_BASE_URL/node-types/start\" -o start.contract.json &&\nrpa_curl \"$RPA_BASE_URL/node-types/end\" -o end.contract.json &&\nrpa_curl \"$RPA_BASE_URL/node-types/browser_gotoUrl\" -o browser_gotoUrl.contract.json &&\nrpa_curl \"$RPA_BASE_URL/node-types/browser_getUrl\" -o browser_getUrl.contract.json &&\njq -s -e 'all(.[]; .data | .authorable and .runtimeSupported and .externalRunnable and .documentationComplete)' *.contract.json\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"idea"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["AI agents can start from the local guides: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["rpa_curl \"$RPA_BASE_URL/llms.txt\""]}," lists the Skill (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/docs/SKILL.md"]},") and the API guide. Paths that start with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/"]}," resolve against ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["http://127.0.0.1:<port>"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"2-validate-the-full-candidate","__idx":2},"children":["2. Validate the full candidate"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Save the following body as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["create.json"]},". Give each node a title that describes what it does. The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["end"]}," node returns its ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["message"]}," as the run's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["outputs.result"]},"; here the message is the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.value"]}," output of the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["url_result"]}," node."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"title\": \"Return the final page URL\",\n  \"description\": \"Visit the supplied page and return its final URL\",\n  \"workflow\": {\n    \"editorVersion\": 2,\n    \"editorParametersVersion\": 1,\n    \"variables\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"targetUrl\": {\n          \"type\": \"string\",\n          \"description\": \"Absolute HTTP(S) URL to open\"\n        }\n      },\n      \"required\": [\n        \"targetUrl\"\n      ]\n    },\n    \"nodes\": [\n      {\n        \"id\": \"start\",\n        \"type\": \"start\",\n        \"data\": {\n          \"title\": \"Read the target URL parameter\"\n        }\n      },\n      {\n        \"id\": \"visit\",\n        \"type\": \"browser_gotoUrl\",\n        \"data\": {\n          \"browserAction\": \"gotoUrl\",\n          \"browserUi\": {\n            \"inputs\": {\n              \"url\": \"${targetUrl}\",\n              \"postWaitMs\": 0\n            },\n            \"exception\": {\n              \"timeout\": 30000,\n              \"policy\": \"interrupt\"\n            }\n          },\n          \"title\": \"Open the supplied page\"\n        }\n      },\n      {\n        \"id\": \"url_result\",\n        \"type\": \"browser_getUrl\",\n        \"data\": {\n          \"browserAction\": \"getUrl\",\n          \"browserUi\": {\n            \"inputs\": {\n              \"type\": \"href\"\n            },\n            \"exception\": {\n              \"timeout\": 30000,\n              \"policy\": \"interrupt\"\n            }\n          },\n          \"title\": \"Read the final URL after navigation\"\n        }\n      },\n      {\n        \"id\": \"end\",\n        \"type\": \"end\",\n        \"data\": {\n          \"inputsValues\": {\n            \"status\": {\n              \"type\": \"constant\",\n              \"content\": \"success\"\n            },\n            \"message\": {\n              \"type\": \"ref\",\n              \"content\": [\n                \"url_result\",\n                \"data\",\n                \"value\"\n              ]\n            }\n          },\n          \"title\": \"Report the final page URL\"\n        }\n      }\n    ]\n  },\n  \"dependencies\": []\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"jq '{purpose:\"save\",source:{kind:\"inline\",template:.}}' create.json > validate-save.json &&\nrpa_curl \"$RPA_BASE_URL/validations\" -H 'Content-Type: application/json' \\\n  --data-binary @validate-save.json -o validation-save.json &&\njq '.data | {valid,issues,truncated,runtimeChecks}' validation-save.json &&\njq -e '.data.valid == true and .data.truncated == false' validation-save.json\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Read the validation report, including warnings and runtime checks. Continue only when ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["valid"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}," and the report isn't truncated. Validation doesn't open a browser."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"3-save-the-template-and-record-the-version","__idx":3},"children":["3. Save the template and record the version"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"([ -s create.key ] || uuidgen > create.key) &&\nrpa_curl \"$RPA_BASE_URL/templates\" -H 'Content-Type: application/json' \\\n  -H \"X-RPA-Catalog-Revision: $RPA_CATALOG_REVISION\" \\\n  -H \"Idempotency-Key: $(cat create.key)\" \\\n  --data-binary @create.json -D created.headers -o created.json &&\nhead -n 1 created.headers &&\njq '.data | {id,version,revisionId,warnings}' created.json\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["HTTP 201 means the template was saved. Keep the normalized response, which includes the workflow, ID, version, and revision ID, and the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ETag"]}," in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["created.headers"]},". The key in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["create.key"]}," identifies this write intent: reuse it only to retry the same request, and generate a new key for a new write. If the request times out, follow ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/browser-rpa/local-api#recovery"},"children":["request recovery"]}," before you send another write."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["After the template list refreshes, the template also appears under ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Custom Templates"]}," in the desktop client. To change it later, read its latest version, validate the complete candidate with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["source.base"]},", and submit the edit with its current ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["If-Match"]},". See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/browser-rpa/local-api#edit-an-existing-template"},"children":["Edit an existing template"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Next: ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/browser-rpa/run-api-example"},"children":["run the saved template with the API"]},"."]}]},"headings":[{"value":"Quickstart: create a template","id":"quickstart-create-a-template","depth":1},{"value":"1. Discover capabilities and contracts","id":"1-discover-capabilities-and-contracts","depth":2},{"value":"2. Validate the full candidate","id":"2-validate-the-full-candidate","depth":2},{"value":"3. Save the template and record the version","id":"3-save-the-template-and-record-the-version","depth":2}],"frontmatter":{"seo":{"title":"Quickstart: create a template"}},"lastModified":"2026-11-20T14:40:39.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/browser-rpa/quickstart","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}