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

# Create contract

> Allows the client to create a new smart contract, based on an existing (and approved) contract template.

## Overview

Allows the client to create a new smart contract, based on an existing (and approved) contract template. The request must be signed using one of the keys created by the  client.

## HTTP request

`POST /Agent/Legal/CreateContract`

## Authentication

Requires a valid JWT bearer token.

## Request (JSON)

```json theme={null}
{
	"templateId": Required(Str(PTemplateId)),
	"visibility": Required(Str(PVisibility)),
	"Parts":
	{
		"role": Required(Str(PRole)),
		"legalId": Required(Str(PLegalId))
	}?[],
	"Parameters":
	{
		"name": Required(Str(PParameterName)),
		"value": Required(PParameterValue)
	}?[]
}
```

## Input parameters

| Parameter      | Description                                                                                                             |
| -------------- | ----------------------------------------------------------------------------------------------------------------------- |
| PTemplateId    | Contract ID of approved template to use to create the new smart contract.                                               |
| PVisibility    | Visibility of the new smart contract. Possible values are CreatorAndParts, DomainAndParts, Public and PublicSearchable. |
| PRole          | Role of a predefined part to the contract.                                                                              |
| PLegalId       | Legal ID of a predefined part to the contract.                                                                          |
| PLegalId       | Values of properties that will be engraved into the Legal Identity.                                                     |
| PPropertyName  | Names of properties that will be engraved into the Legal Identity.                                                      |
| PPropertyValue | Values of properties that will be engraved into the Legal Identity.                                                     |

## Response (JSON)

```json theme={null}
{
	"Contract": Required(PContract)
}
```

## Response parameters

| Parameter | Description                                    |
| --------- | ---------------------------------------------- |
| PContract | Smart contract object generated by the server. |

## Notes

This endpoint uses the request schema notation described in [Pattern matching](/guides/pattern-matching).
