11# XMTP Full Documentation
22
3- Generated at 08:42 PM UTC / September 11 , 2025
3+ Generated at 08:06 PM UTC / September 16 , 2025
44
55## Instructions for AI Tools
66
@@ -928,6 +928,8 @@ const client = await Client.create(
928928 // client options
929929 {
930930 dbEncryptionKey,
931+ // Optional: Use a function to dynamically set the database path based on inbox ID
932+ // dbPath: (inboxId) => `./agent-databases/xmtp-${inboxId}.db3`,
931933 },
932934);
933935```
@@ -971,7 +973,7 @@ type ClientOptions = {
971973 /**
972974 * Path to the local DB
973975 *
974- * There are 3 value types that can be used to specify the database path:
976+ * There are 4 value types that can be used to specify the database path:
975977 *
976978 * - `undefined` (or excluded from the client options)
977979 * The database will be created in the current working directory and is based on
@@ -984,8 +986,12 @@ type ClientOptions = {
984986 * - `string`
985987 * The given path will be used to create the database.
986988 * Example: `./my-db.db3`
989+ *
990+ * - `function`
991+ * A callback function that receives the inbox ID and returns a string path.
992+ * Example: `(inboxId) => string`
987993 */
988- dbPath?: string | null;
994+ dbPath?: string | null | ((inboxId: string) => string) ;
989995 /**
990996 * Encryption key for the local DB
991997 */
@@ -5725,6 +5731,8 @@ const client = await Client.create(
57255731 // client options
57265732 {
57275733 dbEncryptionKey,
5734+ // Optional: Use a function to dynamically set the database path based on inbox ID
5735+ // dbPath: (inboxId) => `./databases/xmtp-${inboxId}.db3`,
57285736 },
57295737);
57305738```
@@ -5812,7 +5820,7 @@ type ClientOptions = {
58125820 /**
58135821 * Path to the local DB
58145822 *
5815- * There are 3 value types that can be used to specify the database path:
5823+ * There are 4 value types that can be used to specify the database path:
58165824 *
58175825 * - `undefined` (or excluded from the client options)
58185826 * The database will be created in the current working directory and is based on
@@ -5825,8 +5833,12 @@ type ClientOptions = {
58255833 * - `string`
58265834 * The given path will be used to create the database.
58275835 * Example: `./my-db.db3`
5836+ *
5837+ * - `function`
5838+ * A callback function that receives the inbox ID and returns a string path.
5839+ * Example: `(inboxId) => string`
58285840 */
5829- dbPath?: string | null;
5841+ dbPath?: string | null | ((inboxId: string) => string) ;
58305842 /**
58315843 * Encryption key for the local DB
58325844 */
@@ -5897,7 +5909,7 @@ type ClientOptions = {
58975909 /**
58985910 * Path to the local DB
58995911 *
5900- * There are 3 value types that can be used to specify the database path:
5912+ * There are 4 value types that can be used to specify the database path:
59015913 *
59025914 * - `undefined` (or excluded from the client options)
59035915 * The database will be created in the current working directory and is based on
@@ -5910,8 +5922,12 @@ type ClientOptions = {
59105922 * - `string`
59115923 * The given path will be used to create the database.
59125924 * Example: `./my-db.db3`
5925+ *
5926+ * - `function`
5927+ * A callback function that receives the inbox ID and returns a string path.
5928+ * Example: `(inboxId) => string`
59135929 */
5914- dbPath?: string | null;
5930+ dbPath?: string | null | ((inboxId: string) => string) ;
59155931 /**
59165932 * Encryption key for the local DB
59175933 */
0 commit comments