Get all tags

GET /v3/tags

Lists all tags that are in a billing account. To get the tags attached to a specific resource, see Searching for tags by using the API.

Request

Parameters

transactionId

string

An alphanumeric string that can be used to trace a request across services. If not specified, it automatically generated with the prefix "gst-".

Constraints:

  • Min length: 1
  • Max length: 150
  • Pattern: /.*/

impersonateUser

string

The user on whose behalf the get operation must be performed (for administrators only).

Constraints:

  • Pattern: /^.*-.*$/

accountId

string

The ID of the billing account to list the tags for. If it is not set, then it is taken from the authorization token. This parameter is required if `tag_type` is set to `service`.

Constraints:

  • Pattern: /^[a-zA-Z0-9.]+$/

tagType

string

The type of the tag you want to list. Supported values are `user`, `service` and `access`.

Allowed values: user, service, access

Default: user

fullData

boolean

If set to `true`, this query returns the provider, `ghost`, `ims` or `ghost,ims`, where the tag exists and the number of attached resources.

Default: false

providers

string[]

Select a provider. Supported values are `ghost` and `ims`. To list both Global Search and Tagging tags and infrastructure tags, use `ghost,ims`. `service` and `access` tags can only be attached to resources that are onboarded to Global Search and Tagging, so you should not set this parameter to list them.

Allowed values: ghost, ims

Default: ["ghost"]

attachedTo

string

If you want to return only the list of tags that are attached to a specified resource, pass the ID of the resource on this parameter. For resources that are onboarded to Global Search and Tagging, the resource ID is the CRN; for IMS resources, it is the IMS ID. When using this parameter, you must specify the appropriate provider (`ims` or `ghost`).

Constraints:

  • Pattern: /^crn:v1(:[^:]*){8}|[0-9]+$/

offset

number

The offset is the index of the item from which you want to start returning data from.

Default: 0

limit

number

The number of tags to return.

Default: 100

timeout

number

The timeout in milliseconds, bounds the request to run within the specified time value. It returns the accumulated results until time runs out.

Default: 0

orderByName

string

Order the output by tag name.

Allowed values: asc, desc

Default: asc

attachedOnly

boolean

Filter on attached tags. If `true`, it returns only tags that are attached to one or more resources. If `false`, it returns all tags.

Default: false

Response

200 - A result paging with the list of tags that match the provided filters.

total_count

integer

Set the occurrences of the total tags that are associated with this account.

offset

integer

The offset at which tags are returned

limit

integer

The number of tags requested to be returned

items

array

Array of output results.

400 - Bad request

errors

array

Detailed errors list

401 - Unauthorized, wrong authorization token type, or IAM authorization token not valid

errors

array

Detailed errors list

407 - Unsupported operation

errors

array

Detailed errors list

429 - Too Many Requests

500 - Internal server error, IAM not initialized, or malformed IAM credentials

errors

array

Detailed errors list

default - System problem or unexpected error

Create an access management tag

POST /v3/tags

Create an access management tag. To create an `access` tag, you must have the access listed in the Granting users access to tag resources documentation. `service` and `user` tags cannot be created upfront. They are created when they are attached for the first time to a resource.

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action.

This action applies only to access management tags.

  • ghost-tags.create-access-tag

Auditing

Calling this method generates the following auditing event.

  • global-search-tagging.tag.create

Request

Parameters

tagNames

Required *

string[]

An array of tag names to create.

Constraints:

  • Min items: 1
  • Max items: 100

impersonateUser

string

The user on whose behalf the create operation must be performed (for administrators only).

Constraints:

  • Pattern: /^.*-.*$/

transactionId

string

An alphanumeric string that can be used to trace a request across services. If not specified, it automatically generated with the prefix "gst-".

Constraints:

  • Min length: 1
  • Max length: 150
  • Pattern: /.*/

accountId

string

The ID of the billing account where the tag must be created. It is a required parameter if `impersonate_user` is set.

Constraints:

  • Pattern: /^[a-zA-Z0-9.]+$|^[*]{1}$/

tagType

string

The type of the tags you want to create. The only allowed value is `access`.

Allowed values: access

Default: access

Response

200 - The tag was created successfully.

results

array

Array of results of a create_tag request.

400 - Bad request

errors

array

Detailed errors list

401 - Unauthorized, wrong authorization token type, or IAM authorization token was not valid.

errors

array

Detailed errors list

429 - Too Many Requests

default - System problem or unexpected error.

Delete all unused tags

DELETE /v3/tags

Delete the tags that are not attached to any resource.

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action.

This action applies only to access management tags.

  • ghost-tags.delete-access-tag

Auditing

Calling this method generates the following auditing event.

  • global-search-tagging.tags.delete

Request

Parameters

transactionId

string

An alphanumeric string that can be used to trace a request across services. If not specified, it automatically generated with the prefix "gst-".

Constraints:

  • Min length: 1
  • Max length: 150
  • Pattern: /.*/

providers

string

Select a provider. Supported values are `ghost` and `ims`.

Allowed values: ghost, ims

Default: ghost

impersonateUser

string

The user on whose behalf the delete all operation must be performed (for administrators only).

Constraints:

  • Pattern: /^.*-.*$/

accountId

string

The ID of the billing account to delete the tags for. If it is not set, then it is taken from the authorization token. It is a required parameter if `tag_type` is set to `service`.

Constraints:

  • Pattern: /^[a-zA-Z0-9.]+$|^[*]{1}$/

tagType

string

The type of the tag. Supported values are `user`, `service` and `access`. `service` and `access` are not supported for IMS resources (`providers` parameter set to `ims`).

Allowed values: user, service, access

Default: user

Response

200 - A results page that includes the list of tags that have been deleted.

total_count

integer

The number of tags that have been deleted.

errors

boolean

It is set to true if there is at least one tag operation in error.

items

array

The list of tag operation results.

400 - Bad request

errors

array

Detailed errors list

401 - Unauthorized, wrong authorization token type, or IAM authorization token was not valid.

errors

array

Detailed errors list

429 - Too Many Requests

default - System problem or unexpected error

Delete an unused tag

DELETE /v3/tags/{tag_name}

Delete an existing tag. A tag can be deleted only if it is not attached to any resource.

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action.

This action applies only to access management tags.

  • ghost-tags.delete-access-tag

Auditing

Calling this method generates the following auditing event.

  • global-search-tagging.tag.delete

Request

Parameters

tagName

Required *

string

The name of tag to be deleted.

Constraints:

  • Max length: 128
  • Pattern: /^[A-Za-z0-9:_ .-]+$/

transactionId

string

An alphanumeric string that can be used to trace a request across services. If not specified, it automatically generated with the prefix "gst-".

Constraints:

  • Min length: 1
  • Max length: 150
  • Pattern: /.*/

providers

string[]

Select a provider. Supported values are `ghost` and `ims`. To delete tags both in Global Search and Tagging and in IMS, use `ghost,ims`.

Allowed values: ghost, ims

Default: ["ghost"]

impersonateUser

string

The user on whose behalf the delete operation must be performed (for administrators only).

Constraints:

  • Pattern: /^.*-.*$/

accountId

string

The ID of the billing account to delete the tag for. It is a required parameter if `tag_type` is set to `service`, otherwise it is inferred from the authorization IAM token.

Constraints:

  • Pattern: /^[a-zA-Z0-9.]+$|^[*]{1}$/

tagType

string

The type of the tag. Supported values are `user`, `service` and `access`. `service` and `access` are not supported for IMS resources (`providers` parameter set to `ims`).

Allowed values: user, service, access

Default: user

Response

200 - Success message

results

array

Array of results of a delete_tag request.

400 - Bad request

errors

array

Detailed errors list

401 - Unauthorized, wrong authorization token type, or IAM authorization token was not valid.

errors

array

Detailed errors list

429 - Too Many Requests

default - System problem or unexpected error

Attach tags

POST /v3/tags/attach

Attaches one or more tags to one or more resources. Each resource can have no more than 1000 tags per each 'user' and 'service' type, and no more than 250 'access' tags (which is the account limit).

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action.

This action applies only to user tags. Because service tags are managed by IBM services. IAM actions do not apply to them.

To attach a `user` tag on a resource, you must have the access listed in the Granting users access to tag resources documentation.

To attach a `service` tag, you must be an authorized service. If that is the case, then you can attach a `service` tag with your registered `prefix` to any resource in any account. The account ID must be set through the `account_id` query parameter.

To attach an `access` tag, you must be the resource administrator within the account. You can attach only `access` tags that already exist.

In the case you want to replace all the list of user tags attached, you must have both the accesses to attach and detach user tags to the resource.

In the case you want to replace all the list of access tags attached, you must have both the accesses to attach and detach access tags to the resource.

  • global-search-tagging.tag.attach-user-tag
  • global-search-tagging.tag.attach-access-tag
  • global-search-tagging.tag.detach-user-tag
  • global-search-tagging.tag.detach-access-tag

Auditing

Calling this method generates the following auditing event.

  • <serviceName>.tag.attach

Request

Parameters

resources

Required *

Resource[]

List of resources on which the tag or tags are attached.

Constraints:

  • Min items: 1
  • Max items: 100

tagName

string

The name of the tag to attach.

Constraints:

  • Max length: 128
  • Pattern: /^([ ]*[A-Za-z0-9:_.-]+[ ]*)+$/

tagNames

string[]

An array of tag names to attach.

Constraints:

  • Min items: 1
  • Max items: 100

transactionId

string

An alphanumeric string that can be used to trace a request across services. If not specified, it automatically generated with the prefix "gst-".

Constraints:

  • Min length: 1
  • Max length: 150
  • Pattern: /.*/

impersonateUser

string

The user on whose behalf the attach operation must be performed (for administrators only).

Constraints:

  • Pattern: /^.*-.*$/

accountId

string

The ID of the billing account of the tagged resource. It is a required parameter if `tag_type` is set to `service`. Otherwise, it is inferred from the authorization IAM token.

Constraints:

  • Pattern: /^[a-zA-Z0-9.]+$|^[*]{1}$/

tagType

string

The type of the tag. Supported values are `user`, `service` and `access`. `service` and `access` are not supported for IMS resources.

Allowed values: user, service, access

Default: user

Response

200 - The array of tag attach operations result

results

array

Array of results of an attach_tag or detach_tag request.

400 - Bad request

errors

array

Detailed errors list

401 - Unauthorized, wrong authorization token type, or IAM authorization token was not valid.

errors

array

Detailed errors list

429 - Too Many Requests

default - System problem or unexpected error

Detach tags

POST /v3/tags/detach

Detaches one or more tags from one or more resources.

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action.

This action applies only to user tags. Because service tags are managed by IBM services, IAM actions do not apply to them.

To detach a `user` tag on a resource you must have the permissions listed in the Granting users access to tag resources documentation.

To detach a `service` tag, you must be an authorized Service. If that is the case, then you can detach a `service` tag with your registered `prefix` from any resource in any account. The account ID must be set through the `account_id` query parameter.

To detach an `access` tag, you must be the resource administrator within the account.

  • global-search-tagging.tag.detach-user-tag
  • global-search-tagging.tag.detach-access-tag

Auditing

Calling this method generates the following auditing event.

  • <serviceName>.tag.detach

Request

Parameters

resources

Required *

Resource[]

List of resources on which the tag or tags are detached.

Constraints:

  • Min items: 1
  • Max items: 100

tagName

string

The name of the tag to detach.

Constraints:

  • Max length: 128
  • Pattern: /^[A-Za-z0-9:_ .-]+$|^[*]{1}$/

tagNames

string[]

An array of tag names to detach.

Constraints:

  • Min items: 1
  • Max items: 100

transactionId

string

An alphanumeric string that can be used to trace a request across services. If not specified, it automatically generated with the prefix "gst-".

Constraints:

  • Min length: 1
  • Max length: 150
  • Pattern: /.*/

impersonateUser

string

The user on whose behalf the detach operation must be performed (for administrators only).

Constraints:

  • Pattern: /^.*-.*$/

accountId

string

The ID of the billing account of the untagged resource. It is a required parameter if `tag_type` is set to `service`, otherwise it is inferred from the authorization IAM token.

Constraints:

  • Pattern: /^[a-zA-Z0-9.]+$|^[*]{1}$/

tagType

string

The type of the tag. Supported values are `user`, `service` and `access`. `service` and `access` are not supported for IMS resources.

Allowed values: user, service, access

Default: user

Response

200 - The array of tag detach operations results.

results

array

Array of results of an attach_tag or detach_tag request.

400 - Bad request

errors

array

Detailed errors list

401 - Unauthorized, wrong authorization token type, or IAM authorization token was not valid.

errors

array

Detailed errors list

429 - Too Many Requests

default - System problem or unexpected error