# Accounts

Every account can be accessed through two types:

* As a **Public Account** with the type `PublicAccount`, which represents the publicly available portion of an account.

  ```
  struct PublicAccount {

      let address: Address

      // Storage operations

      fun getCapability<T>(_ path: Path): Capability<T>?
      fun getLinkTarget(_ path: Path): Path?
  }
  ```

  Any code can get the `PublicAccount` for an account address using the built-in `getAccount` function:

  ```
  fun getAccount(_ address: Address): PublicAccount
  ```
* As an **Authorized Account** with type `AuthAccount`, which represents the authorized portion of an account.

  Access to an `AuthAccount` means having full access to its storage, public keys, and code.

  Only signed transactions can get the `AuthAccount` for an account. For each script signer of the transaction, the corresponding `AuthAccount` is passed to the `prepare` phase of the transaction.

  ```
  struct AuthAccount {

      let address: Address

      // Contract code

      fun setCode(_ code: [UInt8], ... contractInitializerArguments)

      // Key management

      fun addPublicKey(_ publicKey: [UInt8])
      fun removePublicKey(_ index: Int)

      // Storage operations

      fun save<T>(_ value: T, to: Path)
      fun load<T>(from: Path): T?
      fun copy<T: AnyStruct>(from: Path): T?

      fun borrow<T: &Any>(from: Path): T?

      fun link<T: &Any>(_ newCapabilityPath: Path, target: Path): Capability<T>?
      fun getLinkTarget(_ path: Path): Path?
      fun unlink(_ path: Path)

      fun getCapability<T: &Any>(_ path Path): Capability<T>?
  }
  ```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://max-daunarovich.gitbook.io/flow-network/introduction/accounts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
