Prerequisites
- Complete your first Agent API call.
- Have an approved Legal Identity and its signing key metadata and password.
- Confirm your provider accepts the
urn:nf:iot:leg:sc:1.0contract schema and the payment instruction namespace used below. - Use the sandbox automatic approval process or arrange operator review. Submitting a template does not mean it is already approved.
- Use an XML editor or validator that supports XSD validation; follow local XML validation.
1. Define the contract
Download acknowledgement.xml. The complete file is shown below; you can also start with an empty file and add its sections in this order.2. Validate the file
Load the contract schema set in your XML validator and validate the completeacknowledgement.xml file using these steps.
Expected result: the schema set compiles and the contract has no XML validation errors. Correct invalid namespaces, missing required fields, or element ordering before submission.
If you introduce a custom machine-readable element, also create its XSD, load it in the local namespace map, and confirm the provider’s schema resolution requirements. An arbitrary XML payload is not a verified provider-supported instruction.
3. Propose the template
Send the following requests over HTTPS with your account’s exact host, JWT, and application URL asReferer. Replace every placeholder before sending a request.
Base64-encode the complete file’s UTF-8 bytes, then send:
templateBase64 field contains that encoded XML. Propose Template returns Template. Record its identifier.
In the sandbox, the submitted template enters automatic review. On other Neurons, give the identifier to the operator to arrange approval. See Contract approval.
Retrieve it with Legal/GetContract using the request shown below and the template identifier to observe its lifecycle. Continue only when its state is Approved. If it remains Proposed or is Rejected, contact the operator before creating an instance.
4. Create an instance
Send the approved template identifier and the participant’s approved Legal Identity toLegal/CreateContract:
Contract identifier separately from the template identifier. The role and parameter names are case-sensitive names from the template. Do not send empty arrays for this example.
5. Review and sign the instance
Retrieve the created instance using its identifier:Participant role to the signer. If any value is wrong, stop before signing.
Use the participant’s existing key and its password. Calculate keySignature and requestSignature from the contract signature formulas, using the key’s keyId, localName, and namespace, the account password, and a fresh nonce. Bind the signature to the reviewed contractId, legalId, and role Participant.
The key namespace is algorithm metadata retained during key creation. It is not the contract XML namespace.
After the signer confirms the exact contract and role, submit the signature explicitly:
Legal/GetContract and the same contractId.
Check the returned participant signature and contract lifecycle state. A successful signature request alone does not establish that every provider requirement is satisfied. For multiple parties, repeat review and signing in each party’s authorized application session using the contract lifecycle guide.
Recover and retain the result
Retain the template ID, instance ID, reviewed parameters, participant identity, and observed signature/lifecycle result. The example defines duration and archival periods; deleting your local files does not delete a signed contract. Follow the provider’s supported lifecycle and retention rules.
Continue with a token and state machine, or adapt a LegalLab example to a different agreement.