> For the complete documentation index, see [llms.txt](https://docs.borlaug.services/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.borlaug.services/api/ar/registries.md).

# Registries

## Create a registry

<mark style="color:green;">`POST`</mark> `https://api.borlaug.network/ar/registries`

Create a new registry

#### Headers

| Name                | Type   | Description                                                                  |
| ------------------- | ------ | ---------------------------------------------------------------------------- |
| BWS-Idempotency-Key | string | An optional header that will be returned with the same value in the response |
| Content-Type        | string | application/json                                                             |
| Authorization       | string | The authorization token                                                      |

#### Request Body

| Name     | Type   | Description                                       |
| -------- | ------ | ------------------------------------------------- |
| did      | string | DID of registry owner (Hex format)                |
| name     | string | Registry name                                     |
| settings | object | Settings to apply for all assets in this registry |

{% tabs %}
{% tab title="200 " %}

```
{
    "result": "success",
    "id": "2",
    "timestamp": "2020-04-01T12:39:18.009365600",
    "block": "0x64c3bf6839388fd1e06d6597a7fba278039a760a5a81da83770b3d5479afb169",
    "extrinsic": "0xc5edb3fe4527d971e7adbd6525402029c47d1ff548d3898dd7c2c7ea00d63c33"
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Sample Request" %}

```
{
	"name" : "My Collection",
	"did" : "0x3863ca92d8afd54a45547a7c3e840d3dbb626f0d1919001dff328fc868fe4d6e",
	"settings": {
	  "prefix": "ASSET-",
	  "sequence_start": "24"
	}
}
```

{% endtab %}
{% endtabs %}

## Get a list of Registries

<mark style="color:blue;">`GET`</mark> `https://api.borlaug.network/ar/registries`

#### Headers

| Name                | Type   | Description             |
| ------------------- | ------ | ----------------------- |
| Authorization       | string | The authorization token |
| BWS-Idempotency-Key | string | An idempotency key      |

{% tabs %}
{% tab title="200 " %}

```
{
    "registries": [
        {
            "registry_id": 1,
            "name": "Test Registry",
            "settings": {
                "prefix": "ASSET-",
                "sequence_start": 5
            },
            "block": "0x4ba4d1355227cea3d1850860d0834b34afbb11170f0ca712852af48f4d87ae98",
            "extrinsic": "0x40fbd99b5c293be369999c1f450a9411cc541f16508e30f73a54b4ff2e12d86d"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Rename the registry

<mark style="color:purple;">`PATCH`</mark> `https://api.borlaug.network/ar/registries/:registryid`

#### Path Parameters

| Name       | Type   | Description                      |
| ---------- | ------ | -------------------------------- |
| registryid | string | The id of the registry to update |

#### Headers

| Name                | Type   | Description      |
| ------------------- | ------ | ---------------- |
| Content-Type        | string | application/json |
| BWS-Idempotency-Key | string |                  |
| Authorization       | string |                  |

#### Request Body

| Name     | Type   | Description |
| -------- | ------ | ----------- |
| settings | string |             |
| name     | string |             |

{% tabs %}
{% tab title="200 " %}

```
{
    "result": "success",
    "message": "Registry Updated",
    "timestamp": "2020-04-01T12:49:26.449112400"
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Sample Request" %}

```
{
	"name" : "Test Registry",
	"settings" : {
		"prefix" : "ASSET-",
		"sequence_start" : 8
	}
}
```

{% endtab %}
{% endtabs %}

## Deletes a registry and all assets in it

<mark style="color:red;">`DELETE`</mark> `https://api.borlaug.network/ar/registries/:registryid`

#### Path Parameters

| Name       | Type   | Description                      |
| ---------- | ------ | -------------------------------- |
| registryid | string | The id of the registry to delete |

#### Headers

| Name                | Type   | Description      |
| ------------------- | ------ | ---------------- |
| Content-Type        | string | application/json |
| BWS-Idempotency-Key | string |                  |
| Authorization       | string |                  |

#### Request Body

| Name | Type   | Description           |
| ---- | ------ | --------------------- |
| did  | string | Did of registry owner |

{% tabs %}
{% tab title="200 " %}

```
{
    "result": "success",
    "message": "Registry Deleted",
    "timestamp": "2020-04-01T12:52:12.006750900",
    "block": "0x948f0d09ed2698a681e36fafd63e32facdb45981252440516971f7bcff99f48a",
    "extrinsic": "0x6d53701d06f027cde7b749f8c58fb1c70000d365b2ce924d57495ee6c916acb5"
}
```

{% endtab %}
{% endtabs %}

```
{	
	"did" : "0x3863ca92d8afd54a45547a7c3e840d3dbb626f0d1919001dff328fc868fe4d6e"	
}
```
