## Create D1 Database `client.D1.Database.New(ctx, params) (*D1, error)` **post** `/accounts/{account_id}/d1/database` Returns the created D1 database. ### Parameters - `params DatabaseNewParams` - `AccountID param.Field[string]` Path param: Account identifier tag. - `Name param.Field[string]` Body param: D1 database name. - `Jurisdiction param.Field[DatabaseNewParamsJurisdiction]` Body param: Specify the location to restrict the D1 database to run and store data. If this option is present, the location hint is ignored. - `const DatabaseNewParamsJurisdictionEu DatabaseNewParamsJurisdiction = "eu"` - `const DatabaseNewParamsJurisdictionFedramp DatabaseNewParamsJurisdiction = "fedramp"` - `PrimaryLocationHint param.Field[DatabaseNewParamsPrimaryLocationHint]` Body param: Specify the region to create the D1 primary, if available. If this option is omitted, the D1 will be created as close as possible to the current user. - `const DatabaseNewParamsPrimaryLocationHintWnam DatabaseNewParamsPrimaryLocationHint = "wnam"` - `const DatabaseNewParamsPrimaryLocationHintEnam DatabaseNewParamsPrimaryLocationHint = "enam"` - `const DatabaseNewParamsPrimaryLocationHintWeur DatabaseNewParamsPrimaryLocationHint = "weur"` - `const DatabaseNewParamsPrimaryLocationHintEeur DatabaseNewParamsPrimaryLocationHint = "eeur"` - `const DatabaseNewParamsPrimaryLocationHintApac DatabaseNewParamsPrimaryLocationHint = "apac"` - `const DatabaseNewParamsPrimaryLocationHintOc DatabaseNewParamsPrimaryLocationHint = "oc"` ### Returns - `type D1 struct{…}` The details of the D1 database. - `CreatedAt Time` Specifies the timestamp the resource was created as an ISO8601 string. - `FileSize float64` The D1 database's size, in bytes. - `Jurisdiction D1Jurisdiction` Specify the location to restrict the D1 database to run and store data. If this option is present, the location hint is ignored. - `const D1JurisdictionEu D1Jurisdiction = "eu"` - `const D1JurisdictionFedramp D1Jurisdiction = "fedramp"` - `Name string` D1 database name. - `NumTables float64` - `ReadReplication D1ReadReplication` Configuration for D1 read replication. - `Mode D1ReadReplicationMode` The read replication mode for the database. Use 'auto' to create replicas and allow D1 automatically place them around the world, or 'disabled' to not use any database replicas (it can take a few hours for all replicas to be deleted). - `const D1ReadReplicationModeAuto D1ReadReplicationMode = "auto"` - `const D1ReadReplicationModeDisabled D1ReadReplicationMode = "disabled"` - `UUID string` D1 database identifier (UUID). - `Version string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/d1" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) d1, err := client.D1.Database.New(context.TODO(), d1.DatabaseNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Name: cloudflare.F("my-database"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", d1.UUID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "created_at": "2022-11-15T18:25:44.442097Z", "file_size": 12, "jurisdiction": "eu", "name": "my-database", "num_tables": 12, "read_replication": { "mode": "auto" }, "uuid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "version": "production" }, "success": true } ```