# Accounts

<table><thead><tr><th width="210">Attribute</th><th>Description</th></tr></thead><tbody><tr><td><code>name</code></td><td>An account name of your choice.</td></tr><tr><td><code>visibility</code></td><td>One of "<code>PUBLIC</code>", "<code>PRIVATE</code>" or "<code>UNLISTED</code>" - see <a href="#discovery">Discovery</a>.</td></tr></tbody></table>

<table><thead><tr><th width="210">Relationship</th><th>Description</th></tr></thead><tbody><tr><td><code>currency</code></td><td>A <a href="../static#currency-codes">supported currency</a> for this account.</td></tr></tbody></table>

<table><thead><tr><th width="210">Meta</th><th>Description</th></tr></thead><tbody><tr><td><code>externalId</code></td><td>An external ID to tie this account with a resource from your side.</td></tr><tr><td><code>createdAt</code></td><td>The timestamp (UTC) (<a href="https://en.wikipedia.org/wiki/ISO_8601">ISO8601</a>) when the account was created.</td></tr><tr><td><code>updatedAt</code></td><td>The timestamp (UTC) (<a href="https://en.wikipedia.org/wiki/ISO_8601">ISO8601</a>) when the account was updated.</td></tr></tbody></table>

***

{% openapi src="<https://2742279370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJTlJGD24d8T6euWbm1om%2Fuploads%2F7QefoZ1pPhsDSoic0seH%2Fswagger.yml?alt=media&token=f7398d06-a703-4b52-825a-3ea33efbed7c>" path="/accounts" method="get" expanded="true" %}
[swagger.yml](https://2742279370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJTlJGD24d8T6euWbm1om%2Fuploads%2F7QefoZ1pPhsDSoic0seH%2Fswagger.yml?alt=media\&token=f7398d06-a703-4b52-825a-3ea33efbed7c)
{% endopenapi %}

***

{% openapi src="<https://2742279370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJTlJGD24d8T6euWbm1om%2Fuploads%2F7QefoZ1pPhsDSoic0seH%2Fswagger.yml?alt=media&token=f7398d06-a703-4b52-825a-3ea33efbed7c>" path="/accounts" method="post" expanded="true" %}
[swagger.yml](https://2742279370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJTlJGD24d8T6euWbm1om%2Fuploads%2F7QefoZ1pPhsDSoic0seH%2Fswagger.yml?alt=media\&token=f7398d06-a703-4b52-825a-3ea33efbed7c)
{% endopenapi %}

* You cannot change an account's `currencyCode` once created.

***

{% openapi src="<https://2742279370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJTlJGD24d8T6euWbm1om%2Fuploads%2F7QefoZ1pPhsDSoic0seH%2Fswagger.yml?alt=media&token=f7398d06-a703-4b52-825a-3ea33efbed7c>" path="/accounts/{accountId}" method="get" expanded="true" %}
[swagger.yml](https://2742279370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJTlJGD24d8T6euWbm1om%2Fuploads%2F7QefoZ1pPhsDSoic0seH%2Fswagger.yml?alt=media\&token=f7398d06-a703-4b52-825a-3ea33efbed7c)
{% endopenapi %}

***

{% openapi src="<https://2742279370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJTlJGD24d8T6euWbm1om%2Fuploads%2F7QefoZ1pPhsDSoic0seH%2Fswagger.yml?alt=media&token=f7398d06-a703-4b52-825a-3ea33efbed7c>" path="/accounts/{accountId}" method="patch" expanded="true" %}
[swagger.yml](https://2742279370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJTlJGD24d8T6euWbm1om%2Fuploads%2F7QefoZ1pPhsDSoic0seH%2Fswagger.yml?alt=media\&token=f7398d06-a703-4b52-825a-3ea33efbed7c)
{% endopenapi %}

***

{% openapi src="<https://2742279370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJTlJGD24d8T6euWbm1om%2Fuploads%2F7QefoZ1pPhsDSoic0seH%2Fswagger.yml?alt=media&token=f7398d06-a703-4b52-825a-3ea33efbed7c>" path="/accounts/{accountId}" method="delete" expanded="true" %}
[swagger.yml](https://2742279370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJTlJGD24d8T6euWbm1om%2Fuploads%2F7QefoZ1pPhsDSoic0seH%2Fswagger.yml?alt=media\&token=f7398d06-a703-4b52-825a-3ea33efbed7c)
{% endopenapi %}

* When deleting an account, you will first receive a `412 Precondition Failed` response. You should then take the `Last-Modified` header included with the error response, set it as the `If-Unmodified-Since` request header & repeat the request.
  * On successful delete, you'll receive a `204 No Content` response.
  * If you receive a `412 Precondition Failed` response **again**, use the new `Last-Modified` header received & repeat.

***

## The `root` account

The `root` account for **Testbank** is special. You can [credit your account](https://www.testbank.dev/transactions#crediting-your-account) from the root account to generate a balance to play with, or you can [empty your account](https://www.testbank.dev/transactions#emptying-your-account) to the root account to clear your account out.
