Endpoints
api
Modules:
Classes:
-
ActualServer–Implements the low-level API for interacting with the Actual server by just implementing the API calls and
ActualServer
ActualServer(
base_url: str = "http://localhost:5006",
token: str | None = None,
password: str | None = None,
bootstrap: bool = False,
cert: str | SSLContext | bool = True,
extra_headers: dict[str, str] | None = None,
timeout: float | Timeout | None = 60.0,
)
Implements the low-level API for interacting with the Actual server by just implementing the API calls and response models.
Parameters:
-
(base_urlstr, default:'http://localhost:5006') –Url of the running Actual server.
-
(tokenstr | None, default:None) –The token for authentication, if this is available (optional).
-
(passwordstr | None, default:None) –The password for authentication. It will be used on the .login() method to retrieve the token.
-
(bootstrapbool, default:False) –if the server is not bootstrapped, bootstrap it with the password.
-
(certstr | SSLContext | bool, default:True) –If a custom certificate should be used (e.g., self-signed certificate), its path can be provided as a string or as custom ssl.SSLContext. Set to
Falsefor no certificate check. -
(extra_headersdict[str, str] | None, default:None) –Additional headers to be attached to each request to the Actual server.
-
(timeoutfloat | Timeout | None, default:60.0) –Timeout in seconds applied to all HTTP requests. Set to
Noneto disable. Accepts a float or anhttpx.Timeoutobject for fine-grained control. Defaults to 60 seconds.
Methods:
-
login–Logs in on the Actual server using the password provided. Raises
AuthorizationErrorif it fails to -
headers–Generates a header based on the stored token for the connection.
-
info–Gets the information from the Actual server, like the name and version.
-
validate–Validates if the user is valid and logged in, and if the token is also valid and bound to a session.
-
needs_bootstrap–Checks if the Actual needs bootstrap, in other words, if it needs a master password for the server.
-
data_file_index–Gets all the migration file references for the actual server.
-
data_file–Gets the content of the individual migration file from server.
-
reset_user_file–Resets the file. If the file_id is not provided, the current file set is reset. Usually used together with
-
download_user_file–Downloads the user file based on the file_id provided. Returns the
bytesfrom the response, which is a -
upload_user_file–Uploads the binary data, which is a zip folder containing the
db.sqliteand themetadata.json. If the -
list_user_files–Lists the user files. If the response item contains
encrypt_key_iddifferent fromNone, then the -
get_user_file_info–Gets the user file information, including the encryption metadata.
-
update_user_file_name–Updates the file name for the budget on the remote server.
-
delete_user_file–Deletes the user file loaded from the remote server.
-
user_get_key–Gets the key information associated with a user file, including the algorithm, key, salt, and iv.
-
user_create_key–Creates a new key for the user file. The key has to be used then to encrypt the local file, and this file
-
reset_password–Resets the password for the user. You need to be logged in to reset your password, as the old
-
sync_sync–Calls the sync endpoint with a request and returns the response. Both the request and response are
-
login_methods–Returns login methods available for the user.
-
is_open_id_owner_created–Checks if the owner has been created on the OpenID server. This endpoint is non-authorized, which means
-
open_id_config–Gets the OpenID configuration for the server. You will need to provide the main password to access this
-
open_id_users–Returns the list of OpenID users on the server.
-
create_open_id_user–Creates a new user on the OpenID server, assigning it, by default, the most basic permissions.
-
update_open_id_user–Updates a user on the OpenID server.
-
delete_open_id_user–Deletes a user from the OpenID server. Will raise an exception with 404 if the user does not exist.
-
list_file_users_allowed–Lists all users allowed to access a certain file. Also returns if the user owns the file or not.
Source code in actual/api/__init__.py
login
login(
password: str | None = None,
method: Literal[
"password", "header", "openid"
] = "password",
) -> LoginDTO
Logs in on the Actual server using the password provided. Raises AuthorizationError if it fails to
authenticate the user.
Parameters:
-
(passwordstr | None, default:None) –password of the Actual server. If missing, OpenID authentication will be attempted.
-
(methodLiteral['password', 'header', 'openid'], default:'password') –the method used to authenticate with the server. Check the official auth header documentation for information. Here, the appropriate method will be chosen even if this option is missing.
Raises:
-
AuthorizationError–if the token is invalid.
Source code in actual/api/__init__.py
headers
Generates a header based on the stored token for the connection.
If a file_id is provided, it would be used as the X-ACTUAL-FILE-ID header. Extra headers will be
included as they are provided on the final dictionary.
Source code in actual/api/__init__.py
validate
validate() -> ValidateDTO
Validates if the user is valid and logged in, and if the token is also valid and bound to a session.
Source code in actual/api/__init__.py
needs_bootstrap
needs_bootstrap() -> BootstrapInfoDTO
Checks if the Actual needs bootstrap, in other words, if it needs a master password for the server.
Source code in actual/api/__init__.py
data_file_index
Gets all the migration file references for the actual server.
Source code in actual/api/__init__.py
data_file
Gets the content of the individual migration file from server.
reset_user_file
Resets the file. If the file_id is not provided, the current file set is reset. Usually used together with the upload_user_file() method.
Source code in actual/api/__init__.py
download_user_file
Downloads the user file based on the file_id provided. Returns the bytes from the response, which is a
zipped folder of the database db.sqlite and the metadata.json. If the database is encrypted, the key id
has to be retrieved additionally using user_get_key().
Source code in actual/api/__init__.py
upload_user_file
upload_user_file(
binary_data: bytes,
file_id: str,
file_name: str = "My Finances",
encryption_meta: dict | None = None,
) -> UploadUserFileDTO
Uploads the binary data, which is a zip folder containing the db.sqlite and the metadata.json. If the
file is encrypted, the encryption_meta has to be provided with fields keyId, algorithm, iv and authTag
Source code in actual/api/__init__.py
list_user_files
list_user_files() -> ListUserFilesDTO
Lists the user files. If the response item contains encrypt_key_id different from None, then the
file must be decrypted on retrieval.
Source code in actual/api/__init__.py
get_user_file_info
get_user_file_info(file_id: str) -> GetUserFileInfoDTO
Gets the user file information, including the encryption metadata.
Source code in actual/api/__init__.py
update_user_file_name
Updates the file name for the budget on the remote server.
Source code in actual/api/__init__.py
delete_user_file
delete_user_file(file_id: str)
Deletes the user file loaded from the remote server.
Source code in actual/api/__init__.py
user_get_key
user_get_key(file_id: str) -> UserGetKeyDTO
Gets the key information associated with a user file, including the algorithm, key, salt, and iv.
Source code in actual/api/__init__.py
user_create_key
Creates a new key for the user file. The key has to be used then to encrypt the local file, and this file still needs to be uploaded.
Source code in actual/api/__init__.py
reset_password
Resets the password for the user. You need to be logged in to reset your password, as the old password does not need to be provided.
Source code in actual/api/__init__.py
sync_sync
sync_sync(request: SyncRequest) -> SyncResponse
Calls the sync endpoint with a request and returns the response. Both the request and response are protobuf models. The request and response are not standard REST, but rather protobuf binary serialized data. The server stores this serialized data to allow the user to replay all changes to the database and construct a local copy.
Source code in actual/api/__init__.py
login_methods
login_methods() -> LoginMethodsDTO
Returns login methods available for the user.
Source code in actual/api/__init__.py
is_open_id_owner_created
is_open_id_owner_created() -> bool
Checks if the owner has been created on the OpenID server. This endpoint is non-authorized, which means you can access it even if the user is not logged in.
Source code in actual/api/__init__.py
open_id_config
open_id_config(password: str) -> OpenIDConfigResponseDTO
Gets the OpenID configuration for the server. You will need to provide the main password to access this config.
Source code in actual/api/__init__.py
open_id_users
open_id_users() -> list[OpenIDUserDTO]
Returns the list of OpenID users on the server.
Source code in actual/api/__init__.py
create_open_id_user
create_open_id_user(
user_name: str,
display_name: str = "",
enabled: bool = True,
owner: bool = False,
role: Literal["ADMIN", "BASIC"] = "BASIC",
) -> OpenIDUserDTO
Creates a new user on the OpenID server, assigning it, by default, the most basic permissions.
Source code in actual/api/__init__.py
update_open_id_user
update_open_id_user(
user_id: str,
user_name: str | None = None,
display_name: str | None = None,
enabled: bool | None = None,
owner: bool | None = None,
role: Literal["ADMIN", "BASIC"] | None = None,
) -> OpenIDUserDTO
Updates a user on the OpenID server.
Source code in actual/api/__init__.py
delete_open_id_user
delete_open_id_user(
user_id: str,
) -> OpenIDDeleteUserResponseDTO
Deletes a user from the OpenID server. Will raise an exception with 404 if the user does not exist.
Source code in actual/api/__init__.py
list_file_users_allowed
list_file_users_allowed(
file_id: str,
) -> list[OpenIDUserFileAccessDTO]
Lists all users allowed to access a certain file. Also returns if the user owns the file or not.
Source code in actual/api/__init__.py
models
Classes:
-
Endpoints–List of all endpoints mapped by the Actualpy API.
-
BankSyncs–Types of bank sync supported by the library.
-
StatusCode–Status code of the request response.
-
StatusDTO–Base class for all status responses.
-
ErrorStatusDTO– -
TokenDTO–Response model for the token on login.
-
LoginDTO–Login response model.
-
UploadUserFileDTO–Upload user file response model.
-
IsValidatedDTO–Response model for the validation of a budget file.
-
ValidateDTO–Validate budget response model.
-
EncryptMetaDTO–Encryption metadata.
-
EncryptionTestDTO–Encryption test data including the encryption metadata.
-
EncryptionDTO–Encryption information including the salt and test data (with encryption metadata).
-
FileDTO–Base file model.
-
RemoteFileListDTO–Remote file model.
-
RemoteFileDTO–Remote file model (including encryption metadata).
-
GetUserFileInfoDTO–Get user file info response model.
-
ListUserFilesDTO–List user files response model.
-
UserGetKeyDTO–User key response model.
-
BuildDTO–Build information from the Actual server, including the name, version and description.
-
InfoDTO–Information response model.
-
LoginMethodDTO–Login method information.
-
IsBootstrapedDTO–Bootstrap information, including available login methods and whether multi-user is enabled.
-
LoginMethodsDTO–Login methods response model.
-
BootstrapInfoDTO–Bootstrap information response model.
-
IsConfiguredDTO–Bank status configuration status (
configuredisTrueif configured). -
BankSyncStatusDTO–Bank sync status response model.
-
BankSyncAccountDTO–Bank sync account response model.
-
BankSyncTransactionResponseDTO–Bank sync transaction response model.
-
BankSyncErrorDTO–Bank sync error response model.
-
IssuerConfig–OpenID issuer configuration.
-
OpenIDConfigDTO–OpenID configuration.
-
OpenIDConfigResponseDTO–OpenID configuration response model.
-
OpenIDBootstrapDTO–OpenID bootstrap configuration.
-
OpenIDUserDTO–OpenID user information.
-
OpenIDDeleteUserDTO–OpenID user deletion information.
-
OpenIDDeleteUserResponseDTO–OpenID user deletion response model.
-
BaseOpenIDUserFileAccessDTO–Base OpenID user file access information.
-
OpenIDUserFileAccessDTO–OpenID user file access information.
Endpoints
BankSyncs
Bases: Enum
Types of bank sync supported by the library.
Attributes:
-
GOCARDLESS–GoCardless integration. See how to set it up
-
SIMPLEFIN–Simplefin integration. See how to set it up
GOCARDLESS
class-attribute
instance-attribute
GoCardless integration. See how to set it up
SIMPLEFIN
class-attribute
instance-attribute
Simplefin integration. See how to set it up
StatusCode
StatusDTO
Bases: BaseModel
Base class for all status responses.
The general classes will contain the status code and the data model under data property.
Parameters:
-
(statusStatusCode) –
ErrorStatusDTO
TokenDTO
LoginDTO
UploadUserFileDTO
Bases: StatusDTO
Upload user file response model.
Parameters:
-
(statusStatusCode) – -
(group_idstr) –
IsValidatedDTO
Bases: BaseModel
Response model for the validation of a budget file.
Parameters:
-
(validatedbool | None) – -
(user_namestr | None, default:None) – -
(permissionstr | None, default:None) – -
(user_idstr | None, default:None) – -
(display_namestr | None, default:None) – -
(login_methodstr | None, default:'password') –
ValidateDTO
Bases: StatusDTO
Validate budget response model.
Parameters:
-
(statusStatusCode) – -
(dataIsValidatedDTO) –
EncryptMetaDTO
EncryptionTestDTO
Bases: BaseModel
Encryption test data including the encryption metadata.
Parameters:
-
(valuestr) – -
(metaEncryptMetaDTO) –
EncryptionDTO
FileDTO
RemoteFileListDTO
Bases: FileDTO
Remote file model.
If the file is encrypted, the encrypt_key_id field will be present.
If OpenID is enabled and the file is owned by certain users, the owner field will be present.
Parameters:
-
(deletedint | None) – -
(file_idstr) – -
(group_idstr | None) – -
(namestr) – -
(encrypt_key_idstr | None) – -
(ownerstr | None, default:None) – -
(users_with_accessForwardRef('list[BaseOpenIDUserFileAccessDTO] | None'), default:<dynamic>) –Built-in mutable sequence.
If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.
RemoteFileDTO
GetUserFileInfoDTO
Bases: StatusDTO
Get user file info response model.
Parameters:
-
(statusStatusCode) – -
(dataRemoteFileDTO) –
ListUserFilesDTO
Bases: StatusDTO
List user files response model.
Parameters:
-
(statusStatusCode) – -
(datalist[RemoteFileListDTO]) –
UserGetKeyDTO
BuildDTO
InfoDTO
LoginMethodDTO
IsBootstrapedDTO
Bases: BaseModel
Bootstrap information, including available login methods and whether multi-user is enabled.
Parameters:
-
(bootstrappedbool) – -
(login_methodstr | None, default:'password') – -
(multi_userbool | None, default:False) – -
(available_login_methodslist[LoginMethodDTO] | None, default:None) –
LoginMethodsDTO
Bases: StatusDTO
Login methods response model.
Parameters:
-
(statusStatusCode) – -
(methodslist[LoginMethodDTO]) –
BootstrapInfoDTO
Bases: StatusDTO
Bootstrap information response model.
Parameters:
-
(statusStatusCode) – -
(dataIsBootstrapedDTO) –
IsConfiguredDTO
Bases: BaseModel
Bank status configuration status (configured is True if configured).
Parameters:
-
(configuredbool) –
BankSyncStatusDTO
Bases: StatusDTO
Bank sync status response model.
Parameters:
-
(statusStatusCode) – -
(dataIsConfiguredDTO) –
BankSyncAccountDTO
Bases: StatusDTO
Bank sync account response model.
Parameters:
-
(statusStatusCode) – -
(dataBankSyncAccountData) –
BankSyncTransactionResponseDTO
Bases: StatusDTO
Bank sync transaction response model.
Parameters:
-
(statusStatusCode) – -
(dataBankSyncTransactionData) –
BankSyncErrorDTO
Bases: StatusDTO
Bank sync error response model.
Parameters:
-
(statusStatusCode) – -
(dataBankSyncErrorData) –
IssuerConfig
OpenIDConfigDTO
OpenIDConfigResponseDTO
Bases: StatusDTO
OpenID configuration response model.
Parameters:
-
(statusStatusCode) – -
(datadict[str, OpenIDConfigDTO]) –
OpenIDBootstrapDTO
Bases: BaseModel
OpenID bootstrap configuration.
Parameters:
-
(client_idstr) –OAuth2 client ID
-
(client_secretstr) –OAuth2 client secret
-
(discovery_urlIssuerConfig | None, default:None) –OpenID discovery URL
-
(server_hostnamestr) –
OpenIDUserDTO
OpenIDDeleteUserDTO
OpenIDDeleteUserResponseDTO
Bases: StatusDTO
OpenID user deletion response model.
Parameters:
-
(statusStatusCode) – -
(dataOpenIDDeleteUserDTO) –
BaseOpenIDUserFileAccessDTO
bank_sync
Classes:
-
BankSyncTransactionDTO– -
BankSyncOrgDTO– -
BankSyncAccountDTO– -
BankSyncAmount– -
DebtorAccount– -
Balance–An object containing the balance amount and currency.
-
TransactionItem– -
Transactions– -
BankSyncAccountData– -
BankSyncTransactionData– -
BankSyncErrorData–
BankSyncTransactionDTO
BankSyncAccountDTO
BankSyncAmount
DebtorAccount
Balance
Bases: BaseModel
An object containing the balance amount and currency.
Parameters:
-
(balance_amountBankSyncAmount) – -
(balance_typeBalanceType) – -
(reference_datestr | None, default:None) –The date of the balance
TransactionItem
Bases: BaseModel
Parameters:
-
(transaction_idstr | None, default:None) – -
(bookedbool | None, default:False) – -
(transaction_amountBankSyncAmount) – -
(payee_namestr | None, default:None) – -
(datedate) – -
(notesstr | None, default:None) – -
(payeestr | None, default:None) – -
(payee_accountDebtorAccount | None, default:None) – -
(booking_datedate | None, default:None) – -
(value_datedate | None, default:None) – -
(remittance_information_unstructuredstr | None, default:None) – -
(remittance_information_unstructured_arraylist[str], default:<dynamic>) –Built-in mutable sequence.
If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.
-
(additional_informationstr | None, default:None) – -
(posted_datedate | None, default:None) –
Attributes:
-
imported_payee–Deprecated method to convert the payee name. Use the payee_name instead.
Transactions
Bases: BaseModel
Parameters:
-
(alllist[TransactionItem]) –List of all transactions, from newest to oldest.
-
(bookedlist[TransactionItem]) – -
(pendinglist[TransactionItem]) –
BankSyncAccountData
BankSyncTransactionData
Bases: BaseModel
Parameters:
-
(balanceslist[Balance]) – -
(starting_balanceint) – -
(transactionsTransactions) – -
(ibanstr | None, default:None) – -
(institution_idstr | None, default:None) –
Attributes:
balance
property
balance: Decimal
Starting balance of the account integration, converted to a decimal amount.
For simpleFin, this will represent the current amount on the account, while for goCardless it will
represent the actual initial amount before all transactions.
protobuf_models
Classes:
-
HULC_Client–A Hybrid Unique Logical Clock (HULC) timestamp generator.
-
EncryptedData–The encrypted data information, namely the iv, authTag and data.
-
Message–A change message from Actual, containing the dataset (table), row (primary key), column and value.
-
MessageEnvelope–Envelopes a message while including the timestamp and if the message is encrypted or not.
-
SyncRequest–Sync request message that is sent to the server for retrieving new messages since the last synchronization.
-
SyncResponse–Sync response that is sent to the client with the new messages.
HULC_Client
A Hybrid Unique Logical Clock (HULC) timestamp generator.
The generator makes sure that change timestamps are consistent across multiple clients that could have different clocks.
Methods:
-
from_timestamp–Generates a HULC_Client from a timestamp string.
-
timestamp–Actual uses Hybrid Unique Logical Clock (HULC) timestamp generator.
-
random_client_id–Creates a client id for the HULC request.
Source code in actual/protobuf_models.py
from_timestamp
classmethod
from_timestamp(ts: str) -> HULC_Client
Generates a HULC_Client from a timestamp string.
Source code in actual/protobuf_models.py
timestamp
Actual uses Hybrid Unique Logical Clock (HULC) timestamp generator.
Timestamps serialize into a 46-character collatable string. Examples:
2015-04-24T22:23:42.123Z-1000-0123456789ABCDEF2015-04-24T22:23:42.123Z-1000-A219E7A71CC18912
See original source code for reference.
Source code in actual/protobuf_models.py
random_client_id
staticmethod
Creates a client id for the HULC request.
Implementation copied from the source code.
Source code in actual/protobuf_models.py
EncryptedData
Bases: Message
The encrypted data information, namely the iv, authTag and data.
Message
Bases: Message
A change message from Actual, containing the dataset (table), row (primary key), column and value.
Methods:
-
get_value–Serialization types from Actual.
-
set_value–Sets the value of the message based on the Actual spec for datatypes.
get_value
Serialization types from Actual.
Source code in actual/protobuf_models.py
set_value
Sets the value of the message based on the Actual spec for datatypes.
Source code in actual/protobuf_models.py
MessageEnvelope
Bases: Message
Envelopes a message while including the timestamp and if the message is encrypted or not.
SyncRequest
Bases: Message
Sync request message that is sent to the server for retrieving new messages since the last synchronization.
SyncResponse
Bases: Message
Sync response that is sent to the client with the new messages.