# Security TXT ## Retrieves security.txt `client.SecurityTXT.Get(ctx, query) (*SecurityTXTGetResponse, error)` **get** `/zones/{zone_id}/security-center/securitytxt` Retrieves the current security.txt file configuration for a zone, used for security vulnerability reporting. ### Parameters - `query SecurityTXTGetParams` - `ZoneID param.Field[string]` Identifier. ### Returns - `type SecurityTXTGetResponse struct{…}` - `Acknowledgments []string` - `Canonical []string` - `Contact []string` - `Enabled bool` - `Encryption []string` - `Expires Time` - `Hiring []string` - `Policy []string` - `PreferredLanguages string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/security_txt" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) securityTXT, err := client.SecurityTXT.Get(context.TODO(), security_txt.SecurityTXTGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", securityTXT.Acknowledgments) } ``` #### 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" } } ], "success": true, "result": { "acknowledgments": [ "https://example.com/hall-of-fame.html" ], "canonical": [ "https://www.example.com/.well-known/security.txt" ], "contact": [ "mailto:security@example.com", "tel:+1-201-555-0123", "https://example.com/security-contact.html" ], "enabled": true, "encryption": [ "https://example.com/pgp-key.txt", "dns:5d2d37ab76d47d36._openpgpkey.example.com?type=OPENPGPKEY", "openpgp4fpr:5f2de5521c63a801ab59ccb603d49de44b29100f" ], "expires": "2019-12-27T18:11:19.117Z", "hiring": [ "https://example.com/jobs.html" ], "policy": [ "https://example.com/disclosure-policy.html" ], "preferred_languages": "en, es, fr" } } ``` ## Updates security.txt `client.SecurityTXT.Update(ctx, params) (*SecurityTXTUpdateResponse, error)` **put** `/zones/{zone_id}/security-center/securitytxt` Updates the security.txt file configuration for a zone, which provides security researchers with vulnerability reporting information. ### Parameters - `params SecurityTXTUpdateParams` - `ZoneID param.Field[string]` Path param: Identifier. - `Acknowledgments param.Field[[]string]` Body param - `Canonical param.Field[[]string]` Body param - `Contact param.Field[[]string]` Body param - `Enabled param.Field[bool]` Body param - `Encryption param.Field[[]string]` Body param - `Expires param.Field[Time]` Body param - `Hiring param.Field[[]string]` Body param - `Policy param.Field[[]string]` Body param - `PreferredLanguages param.Field[string]` Body param ### Returns - `type SecurityTXTUpdateResponse struct{…}` - `Errors []SecurityTXTUpdateResponseError` - `Code int64` - `Message string` - `DocumentationURL string` - `Source SecurityTXTUpdateResponseErrorsSource` - `Pointer string` - `Messages []SecurityTXTUpdateResponseMessage` - `Code int64` - `Message string` - `DocumentationURL string` - `Source SecurityTXTUpdateResponseMessagesSource` - `Pointer string` - `Success SecurityTXTUpdateResponseSuccess` Whether the API call was successful. - `const SecurityTXTUpdateResponseSuccessTrue SecurityTXTUpdateResponseSuccess = true` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/security_txt" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) securityTXT, err := client.SecurityTXT.Update(context.TODO(), security_txt.SecurityTXTUpdateParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", securityTXT.Errors) } ``` #### 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" } } ], "success": true } ``` ## Deletes security.txt `client.SecurityTXT.Delete(ctx, body) (*SecurityTXTDeleteResponse, error)` **delete** `/zones/{zone_id}/security-center/securitytxt` Removes the security.txt file configuration for a zone. The /.well-known/security.txt endpoint will no longer be served. ### Parameters - `body SecurityTXTDeleteParams` - `ZoneID param.Field[string]` Identifier. ### Returns - `type SecurityTXTDeleteResponse struct{…}` - `Errors []SecurityTXTDeleteResponseError` - `Code int64` - `Message string` - `DocumentationURL string` - `Source SecurityTXTDeleteResponseErrorsSource` - `Pointer string` - `Messages []SecurityTXTDeleteResponseMessage` - `Code int64` - `Message string` - `DocumentationURL string` - `Source SecurityTXTDeleteResponseMessagesSource` - `Pointer string` - `Success SecurityTXTDeleteResponseSuccess` Whether the API call was successful. - `const SecurityTXTDeleteResponseSuccessTrue SecurityTXTDeleteResponseSuccess = true` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/security_txt" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) securityTXT, err := client.SecurityTXT.Delete(context.TODO(), security_txt.SecurityTXTDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", securityTXT.Errors) } ``` #### 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" } } ], "success": true } ```