# Organizations ## List organizations the user has access to `client.Organizations.List(ctx, query) (*SinglePage[Organization], error)` **get** `/organizations` Retrieve a list of organizations a particular user has access to. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/) ### Parameters - `query OrganizationListParams` - `ID param.Field[[]string]` Only return organizations with the specified IDs (ex. id=foo&id=bar). Send multiple elements by repeating the query value. - `Containing param.Field[OrganizationListParamsContaining]` - `Account string` Filter the list of organizations to the ones that contain this particular account. - `Organization string` Filter the list of organizations to the ones that contain this particular organization. - `User string` Filter the list of organizations to the ones that contain this particular user. IMPORTANT: Just because an organization "contains" a user is not a representation of any authorization or privilege to manage any resources therein. An organization "containing" a user simply means the user is managed by that organization. - `Name param.Field[OrganizationListParamsName]` - `Contains string` (case-insensitive) Filter the list of organizations to where the name contains a particular string. - `EndsWith string` (case-insensitive) Filter the list of organizations to where the name ends with a particular string. - `StartsWith string` (case-insensitive) Filter the list of organizations to where the name starts with a particular string. - `PageSize param.Field[int64]` The amount of items to return. Defaults to 10. - `PageToken param.Field[string]` An opaque token returned from the last list response that when provided will retrieve the next page. Parameters used to filter the retrieved list must remain in subsequent requests with a page token. - `Parent param.Field[OrganizationListParamsParent]` - `ID OrganizationListParamsParentID` Filter the list of organizations to the ones that are a sub-organization of the specified organization. "null" is a valid value to provide for this parameter. It means "where an organization has no parent (i.e. it is a 'root' organization)." - `string` - `type OrganizationListParamsParentID string` Filter the list of organizations to the ones that are a sub-organization of the specified organization. "null" is a valid value to provide for this parameter. It means "where an organization has no parent (i.e. it is a 'root' organization)." - `const OrganizationListParamsParentIDNull OrganizationListParamsParentID = "null"` ### Returns - `type Organization struct{…}` References an Organization in the Cloudflare data model. - `ID string` - `CreateTime Time` - `Meta OrganizationMeta` - `Flags OrganizationMetaFlags` Enable features for Organizations. - `AccountCreation string` - `AccountDeletion string` - `AccountMigration string` - `AccountMobility string` - `SubOrgCreation string` - `ManagedBy string` - `Name string` - `Parent OrganizationParent` - `ID string` - `Name string` - `Profile AccountProfile` - `BusinessAddress string` - `BusinessEmail string` - `BusinessName string` - `BusinessPhone string` - `ExternalMetadata string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/organizations" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) page, err := client.Organizations.List(context.TODO(), organizations.OrganizationListParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "id": "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8", "create_time": "2019-12-27T18:11:19.117Z", "meta": { "flags": { "account_creation": "account_creation", "account_deletion": "account_deletion", "account_migration": "account_migration", "account_mobility": "account_mobility", "sub_org_creation": "sub_org_creation" }, "managed_by": "managed_by" }, "name": "name", "parent": { "id": "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8", "name": "name" }, "profile": { "business_address": "business_address", "business_email": "business_email", "business_name": "business_name", "business_phone": "business_phone", "external_metadata": "external_metadata" } } ], "result_info": { "next_page_token": "next_page_token", "total_size": 0 }, "success": true } ``` ## Get organization `client.Organizations.Get(ctx, organizationID) (*Organization, error)` **get** `/organizations/{organization_id}` Retrieve the details of a certain organization. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/) ### Parameters - `organizationID string` ### Returns - `type Organization struct{…}` References an Organization in the Cloudflare data model. - `ID string` - `CreateTime Time` - `Meta OrganizationMeta` - `Flags OrganizationMetaFlags` Enable features for Organizations. - `AccountCreation string` - `AccountDeletion string` - `AccountMigration string` - `AccountMobility string` - `SubOrgCreation string` - `ManagedBy string` - `Name string` - `Parent OrganizationParent` - `ID string` - `Name string` - `Profile AccountProfile` - `BusinessAddress string` - `BusinessEmail string` - `BusinessName string` - `BusinessPhone string` - `ExternalMetadata string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) organization, err := client.Organizations.Get(context.TODO(), "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8") if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", organization.ID) } ``` #### Response ```json { "errors": [], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8", "create_time": "2019-12-27T18:11:19.117Z", "meta": { "flags": { "account_creation": "account_creation", "account_deletion": "account_deletion", "account_migration": "account_migration", "account_mobility": "account_mobility", "sub_org_creation": "sub_org_creation" }, "managed_by": "managed_by" }, "name": "name", "parent": { "id": "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8", "name": "name" }, "profile": { "business_address": "business_address", "business_email": "business_email", "business_name": "business_name", "business_phone": "business_phone", "external_metadata": "external_metadata" } }, "success": true } ``` ## Create organization `client.Organizations.New(ctx, body) (*Organization, error)` **post** `/organizations` Create a new organization for a user. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/) ### Parameters - `body OrganizationNewParams` - `Organization param.Field[Organization]` References an Organization in the Cloudflare data model. ### Returns - `type Organization struct{…}` References an Organization in the Cloudflare data model. - `ID string` - `CreateTime Time` - `Meta OrganizationMeta` - `Flags OrganizationMetaFlags` Enable features for Organizations. - `AccountCreation string` - `AccountDeletion string` - `AccountMigration string` - `AccountMobility string` - `SubOrgCreation string` - `ManagedBy string` - `Name string` - `Parent OrganizationParent` - `ID string` - `Name string` - `Profile AccountProfile` - `BusinessAddress string` - `BusinessEmail string` - `BusinessName string` - `BusinessPhone string` - `ExternalMetadata string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/organizations" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) organization, err := client.Organizations.New(context.TODO(), organizations.OrganizationNewParams{ Organization: organizations.OrganizationParam{ Name: cloudflare.F("name"), }, }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", organization.ID) } ``` #### Response ```json { "errors": [], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8", "create_time": "2019-12-27T18:11:19.117Z", "meta": { "flags": { "account_creation": "account_creation", "account_deletion": "account_deletion", "account_migration": "account_migration", "account_mobility": "account_mobility", "sub_org_creation": "sub_org_creation" }, "managed_by": "managed_by" }, "name": "name", "parent": { "id": "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8", "name": "name" }, "profile": { "business_address": "business_address", "business_email": "business_email", "business_name": "business_name", "business_phone": "business_phone", "external_metadata": "external_metadata" } }, "success": true } ``` ## Modify organization. `client.Organizations.Update(ctx, organizationID, body) (*Organization, error)` **put** `/organizations/{organization_id}` Modify organization. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/) ### Parameters - `organizationID string` - `body OrganizationUpdateParams` - `Organization param.Field[Organization]` References an Organization in the Cloudflare data model. ### Returns - `type Organization struct{…}` References an Organization in the Cloudflare data model. - `ID string` - `CreateTime Time` - `Meta OrganizationMeta` - `Flags OrganizationMetaFlags` Enable features for Organizations. - `AccountCreation string` - `AccountDeletion string` - `AccountMigration string` - `AccountMobility string` - `SubOrgCreation string` - `ManagedBy string` - `Name string` - `Parent OrganizationParent` - `ID string` - `Name string` - `Profile AccountProfile` - `BusinessAddress string` - `BusinessEmail string` - `BusinessName string` - `BusinessPhone string` - `ExternalMetadata string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/organizations" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) organization, err := client.Organizations.Update( context.TODO(), "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8", organizations.OrganizationUpdateParams{ Organization: organizations.OrganizationParam{ Name: cloudflare.F("name"), }, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", organization.ID) } ``` #### Response ```json { "errors": [], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8", "create_time": "2019-12-27T18:11:19.117Z", "meta": { "flags": { "account_creation": "account_creation", "account_deletion": "account_deletion", "account_migration": "account_migration", "account_mobility": "account_mobility", "sub_org_creation": "sub_org_creation" }, "managed_by": "managed_by" }, "name": "name", "parent": { "id": "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8", "name": "name" }, "profile": { "business_address": "business_address", "business_email": "business_email", "business_name": "business_name", "business_phone": "business_phone", "external_metadata": "external_metadata" } }, "success": true } ``` ## Delete organization. `client.Organizations.Delete(ctx, organizationID) (*OrganizationDeleteResponse, error)` **delete** `/organizations/{organization_id}` Delete an organization. The organization MUST be empty before deleting. It must not contain any sub-organizations, accounts, members or users. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/) ### Parameters - `organizationID string` ### Returns - `type OrganizationDeleteResponse struct{…}` - `ID string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) organization, err := client.Organizations.Delete(context.TODO(), "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8") if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", organization.ID) } ``` #### Response ```json { "errors": [], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "id" }, "success": true } ``` ## Domain Types ### Organization - `type Organization struct{…}` References an Organization in the Cloudflare data model. - `ID string` - `CreateTime Time` - `Meta OrganizationMeta` - `Flags OrganizationMetaFlags` Enable features for Organizations. - `AccountCreation string` - `AccountDeletion string` - `AccountMigration string` - `AccountMobility string` - `SubOrgCreation string` - `ManagedBy string` - `Name string` - `Parent OrganizationParent` - `ID string` - `Name string` - `Profile AccountProfile` - `BusinessAddress string` - `BusinessEmail string` - `BusinessName string` - `BusinessPhone string` - `ExternalMetadata string` # Organization Accounts ## Get organization accounts `client.Organizations.OrganizationAccounts.Get(ctx, organizationID, query) (*[]OrganizationAccountGetResponse, error)` **get** `/organizations/{organization_id}/accounts` Retrieve a list of accounts that belong to a specific organization. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/) ### Parameters - `organizationID string` - `query OrganizationAccountGetParams` - `AccountPubname param.Field[OrganizationAccountGetParamsAccountPubname]` - `Contains string` (case-insensitive) Filter the list of accounts to where the account_pubname contains a particular string. - `EndsWith string` (case-insensitive) Filter the list of accounts to where the account_pubname ends with a particular string. - `StartsWith string` (case-insensitive) Filter the list of accounts to where the account_pubname starts with a particular string. - `Direction param.Field[OrganizationAccountGetParamsDirection]` Sort direction for the order_by field. Valid values: `asc`, `desc`. Defaults to `asc` when order_by is specified. - `const OrganizationAccountGetParamsDirectionAsc OrganizationAccountGetParamsDirection = "asc"` - `const OrganizationAccountGetParamsDirectionDesc OrganizationAccountGetParamsDirection = "desc"` - `Name param.Field[OrganizationAccountGetParamsName]` - `Contains string` (case-insensitive) Filter the list of accounts to where the name contains a particular string. - `EndsWith string` (case-insensitive) Filter the list of accounts to where the name ends with a particular string. - `StartsWith string` (case-insensitive) Filter the list of accounts to where the name starts with a particular string. - `OrderBy param.Field[OrganizationAccountGetParamsOrderBy]` Field to order results by. Currently supported values: `account_name`. When not specified, results are ordered by internal account ID. - `const OrganizationAccountGetParamsOrderByAccountName OrganizationAccountGetParamsOrderBy = "account_name"` - `PageSize param.Field[int64]` The amount of items to return. Defaults to 10. - `PageToken param.Field[string]` An opaque token returned from the last list response that when provided will retrieve the next page. Parameters used to filter the retrieved list must remain in subsequent requests with a page token. ### Returns - `type OrganizationAccountGetResponseEnvelopeResult []OrganizationAccountGetResponse` - `ID string` - `CreatedOn Time` - `Name string` - `Settings OrganizationAccountGetResponseSettings` - `AbuseContactEmail string` - `AccessApprovalExpiry Time` - `APIAccessEnabled bool` - `DefaultNameservers string` Use [DNS Settings](https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-list-dns-settings) instead. Deprecated. - `EnforceTwofactor bool` - `UseAccountCustomNSByDefault bool` Use [DNS Settings](https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-list-dns-settings) instead. Deprecated. - `Type OrganizationAccountGetResponseType` - `const OrganizationAccountGetResponseTypeStandard OrganizationAccountGetResponseType = "standard"` - `const OrganizationAccountGetResponseTypeEnterprise OrganizationAccountGetResponseType = "enterprise"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/organizations" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) organizationAccounts, err := client.Organizations.OrganizationAccounts.Get( context.TODO(), "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8", organizations.OrganizationAccountGetParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", organizationAccounts) } ``` #### Response ```json { "errors": [], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "id": "id", "created_on": "2019-12-27T18:11:19.117Z", "name": "name", "settings": { "abuse_contact_email": "abuse_contact_email", "access_approval_expiry": "2019-12-27T18:11:19.117Z", "api_access_enabled": true, "default_nameservers": "default_nameservers", "enforce_twofactor": true, "use_account_custom_ns_by_default": true }, "type": "standard" } ], "result_info": { "next_page_token": "next_page_token", "total_size": 0 }, "success": true } ``` ## Domain Types ### Organization Accounts - `type OrganizationAccounts struct{…}` - `ID string` Identifier - `Name string` Account name - `Type OrganizationAccountsType` - `const OrganizationAccountsTypeStandard OrganizationAccountsType = "standard"` - `const OrganizationAccountsTypeEnterprise OrganizationAccountsType = "enterprise"` - `CreatedOn Time` Timestamp for the creation of the account - `ManagedBy OrganizationAccountsManagedBy` Parent container details - `ParentOrgID string` ID of the parent Organization, if one exists - `ParentOrgName string` Name of the parent Organization, if one exists - `Settings OrganizationAccountsSettings` Account settings - `AbuseContactEmail string` Sets an abuse contact email to notify for abuse reports. - `EnforceTwofactor bool` Indicates whether membership in this account requires that Two-Factor Authentication is enabled # Organization Profile ## Get organization profile `client.Organizations.OrganizationProfile.Get(ctx, organizationID) (*AccountProfile, error)` **get** `/organizations/{organization_id}/profile` Get an organizations profile if it exists. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/) ### Parameters - `organizationID string` ### Returns - `type AccountProfile struct{…}` - `BusinessAddress string` - `BusinessEmail string` - `BusinessName string` - `BusinessPhone string` - `ExternalMetadata string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) accountProfile, err := client.Organizations.OrganizationProfile.Get(context.TODO(), "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8") if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", accountProfile.BusinessAddress) } ``` #### Response ```json { "errors": [], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "business_address": "business_address", "business_email": "business_email", "business_name": "business_name", "business_phone": "business_phone", "external_metadata": "external_metadata" }, "success": true } ``` ## Modify organization profile. `client.Organizations.OrganizationProfile.Update(ctx, organizationID, body) error` **put** `/organizations/{organization_id}/profile` Modify organization profile. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/) ### Parameters - `organizationID string` - `body OrganizationProfileUpdateParams` - `AccountProfile param.Field[AccountProfile]` ### Example ```go package main import ( "context" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/accounts" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/organizations" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) err := client.Organizations.OrganizationProfile.Update( context.TODO(), "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8", organizations.OrganizationProfileUpdateParams{ AccountProfile: accounts.AccountProfileParam{ BusinessAddress: cloudflare.F("business_address"), BusinessEmail: cloudflare.F("business_email"), BusinessName: cloudflare.F("business_name"), BusinessPhone: cloudflare.F("business_phone"), ExternalMetadata: cloudflare.F("external_metadata"), }, }, ) if err != nil { panic(err.Error()) } } ``` ## Domain Types ### Organization Profile - `type OrganizationProfile struct{…}` - `BusinessAddress string` - `BusinessEmail string` - `BusinessName string` - `BusinessPhone string` - `ExternalMetadata string` # Members ## List organization members `client.Organizations.Members.List(ctx, organizationID, query) (*SinglePage[OrganizationMember], error)` **get** `/organizations/{organization_id}/members` List memberships for an Organization. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/) ### Parameters - `organizationID string` - `query MemberListParams` - `PageSize param.Field[int64]` The amount of items to return. Defaults to 10. - `PageToken param.Field[string]` An opaque token returned from the last list response that when provided will retrieve the next page. Parameters used to filter the retrieved list must remain in subsequent requests with a page token. - `Status param.Field[[]MemberListParamsStatus]` Filter the list of memberships by membership status. - `const MemberListParamsStatusActive MemberListParamsStatus = "active"` - `const MemberListParamsStatusCanceled MemberListParamsStatus = "canceled"` - `User param.Field[MemberListParamsUser]` - `Email string` Filter the list of memberships for a specific email that ends with a substring. ### Returns - `type OrganizationMember struct{…}` - `ID string` Organization Member ID - `CreateTime Time` - `Meta map[string, unknown]` - `Status OrganizationMemberStatus` - `const OrganizationMemberStatusActive OrganizationMemberStatus = "active"` - `const OrganizationMemberStatusCanceled OrganizationMemberStatus = "canceled"` - `UpdateTime Time` - `User OrganizationMemberUser` - `ID string` - `Email string` - `Name string` - `TwoFactorAuthenticationEnabled bool` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/organizations" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) page, err := client.Organizations.Members.List( context.TODO(), "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8", organizations.MemberListParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "id": "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8", "create_time": "2019-12-27T18:11:19.117Z", "meta": { "foo": {} }, "status": "active", "update_time": "2019-12-27T18:11:19.117Z", "user": { "id": "id", "email": "email", "name": "name", "two_factor_authentication_enabled": true } } ], "result_info": { "next_page_token": "next_page_token", "total_size": 0 }, "success": true } ``` ## Get organization member `client.Organizations.Members.Get(ctx, organizationID, memberID) (*OrganizationMember, error)` **get** `/organizations/{organization_id}/members/{member_id}` Retrieve a single membership from an Organization. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/) ### Parameters - `organizationID string` - `memberID string` Organization Member ID ### Returns - `type OrganizationMember struct{…}` - `ID string` Organization Member ID - `CreateTime Time` - `Meta map[string, unknown]` - `Status OrganizationMemberStatus` - `const OrganizationMemberStatusActive OrganizationMemberStatus = "active"` - `const OrganizationMemberStatusCanceled OrganizationMemberStatus = "canceled"` - `UpdateTime Time` - `User OrganizationMemberUser` - `ID string` - `Email string` - `Name string` - `TwoFactorAuthenticationEnabled bool` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) organizationMember, err := client.Organizations.Members.Get( context.TODO(), "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8", "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8", ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", organizationMember.ID) } ``` #### Response ```json { "errors": [], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8", "create_time": "2019-12-27T18:11:19.117Z", "meta": { "foo": {} }, "status": "active", "update_time": "2019-12-27T18:11:19.117Z", "user": { "id": "id", "email": "email", "name": "name", "two_factor_authentication_enabled": true } }, "success": true } ``` ## Create organization member `client.Organizations.Members.New(ctx, organizationID, body) (*OrganizationMember, error)` **post** `/organizations/{organization_id}/members` Create a membership that grants access to a specific Organization. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/) ### Parameters - `organizationID string` - `body MemberNewParams` - `Member param.Field[MemberNewParamsMember]` - `User MemberNewParamsMemberUser` - `Email string` - `Status MemberNewParamsMemberStatus` - `const MemberNewParamsMemberStatusActive MemberNewParamsMemberStatus = "active"` - `const MemberNewParamsMemberStatusCanceled MemberNewParamsMemberStatus = "canceled"` ### Returns - `type OrganizationMember struct{…}` - `ID string` Organization Member ID - `CreateTime Time` - `Meta map[string, unknown]` - `Status OrganizationMemberStatus` - `const OrganizationMemberStatusActive OrganizationMemberStatus = "active"` - `const OrganizationMemberStatusCanceled OrganizationMemberStatus = "canceled"` - `UpdateTime Time` - `User OrganizationMemberUser` - `ID string` - `Email string` - `Name string` - `TwoFactorAuthenticationEnabled bool` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/organizations" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) organizationMember, err := client.Organizations.Members.New( context.TODO(), "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8", organizations.MemberNewParams{ Member: cloudflare.F(organizations.MemberNewParamsMember{ User: cloudflare.F(organizations.MemberNewParamsMemberUser{ Email: cloudflare.F("email"), }), }), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", organizationMember.ID) } ``` #### Response ```json { "errors": [], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8", "create_time": "2019-12-27T18:11:19.117Z", "meta": { "foo": {} }, "status": "active", "update_time": "2019-12-27T18:11:19.117Z", "user": { "id": "id", "email": "email", "name": "name", "two_factor_authentication_enabled": true } }, "success": true } ``` ## Delete organization member `client.Organizations.Members.Delete(ctx, organizationID, memberID) error` **delete** `/organizations/{organization_id}/members/{member_id}` Delete a membership to a particular Organization. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/) ### Parameters - `organizationID string` - `memberID string` Organization Member ID ### Example ```go package main import ( "context" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) err := client.Organizations.Members.Delete( context.TODO(), "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8", "a7b9c3d2e8f4g1h5i6j0k9l2m3n7o4p8", ) if err != nil { panic(err.Error()) } } ``` ## Domain Types ### Organization Member - `type OrganizationMember struct{…}` - `ID string` Organization Member ID - `CreateTime Time` - `Meta map[string, unknown]` - `Status OrganizationMemberStatus` - `const OrganizationMemberStatusActive OrganizationMemberStatus = "active"` - `const OrganizationMemberStatusCanceled OrganizationMemberStatus = "canceled"` - `UpdateTime Time` - `User OrganizationMemberUser` - `ID string` - `Email string` - `Name string` - `TwoFactorAuthenticationEnabled bool`