Contact Us 1-800-596-4880

Object Store v2 REST APIs

Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations.

The Object Store v2 APIs enable you to use REST to:

  • Retrieve a list of object stores and keys associated with an application.

  • Store and retrieve key-value pairs in an object store.

  • Delete key-value pairs from an object store.

  • Retrieve Object Store usage statistics for your organization.

Object Store provides these APIs:

Before You Begin

Get a Bearer Token to Use with the Object Store v2 APIs

If MFA (multi-factor authentication) is enabled

Use a connected app to get the bearer token:

  1. Configure a connected app.

    Assign the connected app the Organization Administrator scope to access the organization and environment queries.

  2. From the Connected Apps page, click Copy Id and Copy Secret for the app you just created.

    Use this client ID and client secret to get the bearer token required to authenticate with the Object Store v2 API.

  3. Run this command to get the bearer token from the connected app client ID and client secret:

    curl --location '<AUTH_SERVER_HOST>/accounts/api/v2/oauth2/token' \
       --header 'Content-Type: application/json' \
        --data '{
          "client_id": "<CLIENT_ID>",
          "client_secret": "<CLIENT_SECRET>",
          "grant_type": "client_credentials"
          }'

    Replace AUTH_SERVER_HOST with the URL of the authorization server, for example https://anypoint.mulesoft.com/.

    The output includes the bearer token:

    {
      "access_token": "<BEARER_TOKEN>",
      "token_type": "bearer"
    }
  4. Use this bearer token to access any Object Store v2 API that requires a bearer token.

If MFA isn’t enabled

Authenticate with the credentials of a user with the Organization Administrator permission:

  1. Run this command to get the bearer token:

    curl -H \
      "Content-Type: application/json" \
      -X POST -d '{"username":"<USERNAME>","password":"<PASSWORD>"}' \
      "<AUTH_SERVER_HOST>accounts/login"

    Replace AUTH_SERVER_HOST with the URL of the authorization server, for example https://anypoint.mulesoft.com/.

    Make sure the user has the Organization Administrator permission to access the organization and environment queries.

    The output includes the bearer token:

    {
      "access_token": "<BEARER_TOKEN>",
      "expires_in": 3600,
      "token_type": "bearer"
    }
  2. Use this bearer token to access any Object Store v2 API that requires a bearer token.

Get the Organization ID and Environment ID

To get the ORG_ID, run this command, replacing AUTH_SERVER_HOST with the authorization server:

curl -X GET https://<AUTH_SERVER_HOST>/accounts/api/me \
  -H "Authorization: Bearer <BEARER_TOKEN>"

The response includes output similar to:

"organization": {
    "name": "MyCompany",
    "id": "ORG_ID",
  },

To get the ENV_ID, run this command, replacing AUTH_SERVER_HOST with the authorization server:

curl -X GET https://<AUTH_SERVER_HOST>/accounts/api/organizations/<ORG_ID>/environments \
  -H "Authorization: Bearer <BEARER_TOKEN>"

The response includes output similar to:

"environments": [
  {
    "id": "ENV_ID",
    "name": "Production",
    "organizationId": "ORG_ID",
  },
]

Get the Region ID

To get the region ID (REGION_ID), run this command, replacing BASE_URL:

curl -X GET \
 'https://<BASE_URL>/api/v1/organizations/<ORG_ID>/regions' \
 -H 'authorization: Bearer <BEARER_TOKEN>'

Get the Store ID

To get the store ID (STORE_ID), run this command, replacing BASE_URL:

curl -X GET \
 'https://<BASE_URL>/api/v1/organizations/<ORG_ID>/environments/<ENV_ID>/stores' \
 -H 'authorization: bearer <BEARER_TOKEN>'

Object Store v2 API

The Object Store v2 API reads and writes key,list values, which is different from Anypoint Connector for Object Store (Object Store Connector), which reads and writes in the key,value format.

This table compares the Object Store REST API operations to Object Store Connector operations:

Object Store v2 API Object Store v2 REST API Operations Object Store Connector Operation

POST

  • Object Store

    • Object store TTL, in seconds

      The maximum TTL is 2592000 seconds (30 days).

      If the entryTtl value specified is greater than 30 days, the value defaults to 2592000 seconds (30 days), without returning an error.

    • Persistence property

    • Usage limits for each application or environment, including options for limits based on keys or size, and how to enforce them

  • Key and list (item) value

Store

GET

  • Get keys

  • Get item

  • Get items

  • Get all items

  • Get regions for an organization

Contains + Retrieve + Retrieve all keys + Retrieve and store (Retrieve part)

PUT

  • Put item as string

  • Put item as number

  • Put item as confirmable string

  • Put store

Store

DELETE

  • Remove object store

  • Delete key

  • Delete item

Remove

You can retrieve a maximum of 25 keys with each GET operation.

Limitations

If an application writes to an object store using the REST interface and reads with Object Store Connector for Mule 3 from the same key, the read can retrieve only the value at element 0. Therefore, when using the REST API, use the API to write and read content from the object store. Alternatively, you can use the API to write only to index 0.

This limitation doesn’t apply to Object Store Connector for Mule 4 or Anypoint Studio Object Store Connector.

Access the Object Store v2 API

  1. Get a Bearer Token to Use with the Object Store v2 APIs.

  2. Set up an application, such as Postman, to access the object store.

  3. Configure the object store access URL, replacing ORG_ID with your organization ID and ENV_ID with your environment ID:

    <BASE_URL>/api/v1/organizations/<ORG_ID>/environments/<ENV_ID>/stores/myTestStoreId/objects

    Depending on the deployment region, use one of these domains for the value of BASE_URL in the access URL:

    Control Plane BASE_URL Region

    U.S.

    object-store-us-east-1.anypoint.mulesoft.com

    US East (N. Virginia)

    object-store-us-east-2.anypoint.mulesoft.com

    US East (Ohio)

    object-store-us-west-1.anypoint.mulesoft.com

    US West (N. California)

    object-store-us-west-2.anypoint.mulesoft.com

    US West (Oregon)

    object-store-ap-southeast-1.anypoint.mulesoft.com

    Asia Pacific (Singapore)

    object-store-ap-southeast-2.anypoint.mulesoft.com

    Asia Pacific (Sydney)

    object-store-ap-northeast-1.anypoint.mulesoft.com

    Asia Pacific (Tokyo)

    object-store-ca-central-1.anypoint.mulesoft.com

    Canada (Central)

    object-store-eu-central-1.anypoint.mulesoft.com

    Europe (Frankfurt)

    object-store-eu-west-1.anypoint.mulesoft.com

    Europe (Ireland)

    object-store-eu-west-2.anypoint.mulesoft.com

    Europe (London)

    object-store-sa-east-1.anypoint.mulesoft.com

    South America (São Paulo)

    U.S.

    MuleSoft Government Cloud

    object-store-us-gov-west-1.gov.anypoint.mulesoft.com

    US Gov West

    EU

    object-store-eu-central-1.eu1.anypoint.mulesoft.com

    Europe (Frankfurt)

    object-store-eu-west-1.eu1.anypoint.mulesoft.com

    Europe (Ireland)

    Canada Cloud

    object-store-ca-central-1.ca1.platform.mulesoft.com

    Canada (Central)

    Japan Cloud

    object-store-ap-northeast-1.jp1.platform.mulesoft.com

    Asia Pacific (Tokyo)

  4. Configure the application with HTTP headers and body for values to store to or read from the object store.

  5. Send the operation to the Object Store v2 API.

Examples: Object Store v2 API

Example: Retrieve a List of Object Stores

To view the list of object stores, run a curl command, replacing BASE_URL with the regional domain, ORG_ID with your organization ID, ENV_ID with your environment ID, and BEARER_TOKEN with your bearer token:

curl -X GET \
 'https://<BASE_URL>/api/v1/organizations/<ORG_ID>/environments/<ENV_ID>/stores' \
 -H 'authorization: bearer <BEARER_TOKEN>'

This command returns output similar to:

  {"values":[{"storeId":"APP_os-simple-flow__defaultPersistentObjectStore","encrypted":true,"permanentOsFlag":false,
    "persistent":true,"defaultTtlSeconds":2592000,"defaultConfirmationTtlSeconds":600,"isFixedTtl":null},
  {"storeId":"APP_scheduler-tests__defaultPersistentObjectStore","encrypted":true,"permanentOsFlag":false,
    "persistent":true,"defaultTtlSeconds":2592000,"defaultConfirmationTtlSeconds":600,"isFixedTtl":null}
  {"storeId":"APP_sending-a-csv-file-thru-email-using-smtp__defaultPersistentObjectStore","encrypted":true,"permanentOsFlag":false,
    "persistent":true,"defaultTtlSeconds":2592000,"defaultConfirmationTtlSeconds":600,"isFixedTtl":null}],"nextPageToken":null}

Example: Retrieve a List of Regions

To view the list of regions, submit a curl command, replacing BASE_URL with the regional domain, ORG_ID with your organization ID, and BEARER_TOKEN with your bearer token:

curl -X GET \
 'https://<BASE_URL>/api/v1/organizations/<ORG_ID>/regions' \
 -H 'authorization: Bearer <BEARER_TOKEN>'

This command returns output similar to:

[
  {
    "id": "us-east-1",
    "name": "US East (N. Virginia)",
    "url": "http://object-store.us-east-1.anypoint.mulesoft.com"
  },
  {
    "id": "us-west-1",
    "name": "US West (N. California)",
    "url": "http://object-store.us-west-1.anypoint.mulesoft.com"
  }
]

Example: Retrieve a List of Partitions

To view the list of partitions, submit a curl command, replacing BASE_URL with the regional domain, ORG_ID with your organization ID, ENV_ID with your environment ID, and STORE_ID with the storeId from the list of object stores, and BEARER_TOKEN with your bearer token:

curl -X GET \
  https://<BASE_URL>/api/v1/organizations/<ORG_ID>/environments/<ENV_ID>/stores/<STORE_ID>/partitions \
  -H "Authorization: Bearer <BEARER_TOKEN>"

This command returns output similar to:

  {"values":["PARTITION_ID"],"nextPageToken":null}

Example: Retrieve a List of Keys in a Partition

To view the keys in a partition, submit a curl command, replacing BASE_URL with the regional domain, ORG_ID with your organization ID, ENV_ID with your environment ID, STORE_ID with the name of the object store, PARTITION_ID with the name of the partition, and BEARER_TOKEN with your bearer token:

curl -X GET \
  https://<BASE_URL>/api/v1/organizations/<ORG_ID>/environments/<ENV_ID>/stores/<STORE_ID>/partitions/<PARTITION_ID>/keys \
  -H "Authorization: Bearer <BEARER_TOKEN>"

This command returns output similar to:

{"values":[{"keyId":"KeyTwo"},{"keyId":"KeyOne"}],"nextPageToken":null}

Example: Retrieve the Value of a Key

To view the value of a key, submit a curl command, replacing BASE_URL with the regional domain, ORG_ID with your organization ID, ENV_ID with your environment ID, STORE_ID with the name of the object store, PARTITION_ID with the name of the partition, KEY_ID with the key ID, and BEARER_TOKEN with your bearer token:

curl -X GET \
  https://<BASE_URL>/api/v1/organizations/<ORG_ID>/environments/<ENV_ID>/stores/<STORE_ID>/partitions/<PARTITION_ID>/keys/<KEY_ID> \
  -H "Authorization: Bearer <BEARER_TOKEN>"

This command returns output similar to:

{"binaryValue":"++Kn0AIBAQBbwoABDiJLZXkgMiBWYWx1ZSL8rNmhAQEBAWphdmEuaW8uU2VyaWFsaXphYmzlgGFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9VVRGLbgAAAAAAAAADQ==","keyId":"KeyTwo","valueType":"BINARY"}

Example: Store a Key-Value Pair

To store a key-value pair, submit a curl command, replacing BASE_URL with the regional domain, ORG_ID with your organization ID, ENV_ID with your environment ID, STORE_ID with the name of the object store, PARTITION_ID with the name of the partition, BEARER_TOKEN with your bearer token, and specify a value (myTestKey) for KEY_ID:

KEY_ID=myTestKey; \
curl -X POST \
  https://<BASE_URL>/api/v1/organizations/<ORG_ID>/environments/<ENV_ID>/stores/<STORE_ID>/partitions/<PARTITION_ID>/keys/myTestKey \
  -H "Authorization: Bearer <BEARER_TOKEN>" \
  -H "Content-Type: application/json" \
  --data '{"stringValue":"Hello World","keyId":"myTestKey","valueType":"STRING"}'

In this command, the value is a JSON string.

To verify that the key-pair is in the object store, get a list of the keys in the partition:

curl -X GET \
  https://<BASE_URL>/api/v1/organizations/<ORG_ID>/environments/<ENV_ID>/stores/<STORE_ID>/partitions/<PARTITION_ID>/keys \
  -H "Authorization: Bearer <BEARER_TOKEN>"

This command returns output similar to:

{"values":[{"keyId":"KeyTwo"},{"keyId":"KeyOne"},{"keyId":"myTestKey"}],"nextPageToken":null}

Example: Delete a Key and Value

To delete a key-value pair, submit a curl command, replacing BASE_URL with the regional domain, ORG_ID with your organization ID, ENV_ID with your environment ID, STORE_ID with the name of the object store, PARTITION_ID with the name of the partition, KEY_ID with the key ID, and BEARER_TOKEN with your bearer token:

curl -X DELETE \
  https://<BASE_URL>/api/v1/organizations/<ORG_ID>/environments/<ENV_ID>/stores/<STORE_ID>/partitions/<PARTITION_ID>/keys/KEY_ID \
  -H "Authorization: Bearer <BEARER_TOKEN>"

In this command, the value is a JSON string.

To verify that the key-pair is no longer in the object store, get a list of the keys in the partition:

curl -X GET \
  https://<BASE_URL>/api/v1/organizations/<ORG_ID>/environments/<ENV_ID>/stores/<STORE_ID>/partitions/<PARTITION_ID>/keys \
  -H "Authorization: Bearer <BEARER_TOKEN>"

This command returns output similar to:

{"values":[{"keyId":"KeyTwo"},{"keyId":"KeyOne"}],"nextPageToken":null}

Object Store v2 Stats API

Only the US Cloud and EU Cloud instances of Anypoint Platform support these REST APIs.

The Object Store v2 Stats API enables you to retrieve statistics on your Object Store usage.

The usage statistics aren’t real-time and might include latency.

Use the Stats API to view your entire organization’s usage of Object Store for billing purposes:

  • Usage per root organization and all sub-organizations

  • Usage per organization

  • Usage per environment

  • Usage per region

  • Usage per store

Access the Object Store v2 Stats API

  1. Get a Bearer Token to Use with the Object Store v2 APIs.

  2. Set up an application, such as Postman, to access the object store.

  3. Configure the access URL, replacing ORG_ID with your organization ID and ENV_ID with your environment ID:

    https://object-store-stats.anypoint.mulesoft.com/api/v1/organizations/<ORG_ID>/environments/ENV_ID?startDate=...&endDate=...&period=...
    The query parameters must be URL-encoded to preserve their values.

For example, you must URL-encode a startDate of 2024-07-11T17:51:54.000Z to 11T17%3A51%3A54.000Z before sending it in the query. . Configure the application with HTTP headers and body for values to store to or read from the object store. . Send the operation to the Object Store v2 Stats API.

Examples: Object Store v2 Stats API

Example: Get Usage Metrics by Organization

By default, the Object Store v2 Stats API endpoint retrieves statistics only for the specified ORG_ID. To get the usage data for the root organization and all sub-organizations, set isMaster to true when ORG_ID is the root organization. If you use isMaster=true to query a sub-organization, the endpoint returns no results.

To view Object Store usage statistics for the root organization and all sub-organizations, between August 11, 2024 and September 11, 2024, submit a curl command, replacing ORG_ID with the organization ID for your root organization and BEARER_TOKEN with your bearer token:

curl -X GET \
  'https://object-store-stats.anypoint.mulesoft.com/api/v1/organizations/<ORG_ID>?startDate=2024-08-11T17%3A51%3A54.000Z&endDate=2024-09-11T17%3A51%3A54.000Z&period=1month&isMaster=true' \
  -H 'authorization: Bearer <BEARER_TOKEN>'

This request returns a response similar to:

[
 {"timeStamp":"2024-08-01T00:00:00Z","objectStoreRequestCount":38},
 {"timeStamp":"2024-09-01T00:00:00Z","objectStoreRequestCount":28}
]

To view Object Store usage statistics for the root organization and all sub-organizations for one day, submit a curl command, replacing ORG_ID with the organization ID for your root organization and BEARER_TOKEN with your bearer token:

curl -X GET \
  'https://object-store-stats.anypoint.mulesoft.com/api/v1/organizations/<ORG_ID>?startDate=2024-11-11T17%3A51%3A54.000Z&endDate=2024-11-131T17%3A51%3A54.000Z&period=1day&isMaster=true' \
  -H 'authorization: Bearer <BEARER_TOKEN>'

This request returns a response similar to:

[
 {"timeStamp":"2024-11-11T00:00:00Z","objectStoreRequestCount":36}
 {"timeStamp":"2024-11-12T00:00:00Z","objectStoreRequestCount":22}
 {"timeStamp":"2024-11-13T00:00:00Z","objectStoreRequestCount":43}
]

To view Object Store usage statistics for a sub-organization, between February 10, 2024 and March 10, 2024, submit a curl command, replacing ORG_ID with the organization ID for the sub-organization and BEARER_TOKEN with your bearer token:

curl -X GET \
  'https://object-store-stats.anypoint.mulesoft.com/api/v1/organizations/<ORG_ID>?startDate=2024-02-10T17%3A51%3A54.000Z&endDate=2024-03-10T17%3A51%3A54.000Z&period=1month' \
  -H 'authorization: Bearer <BEARER_TOKEN>'

This request returns a response similar to:

[
 {"timeStamp":"2024-02-10T00:00:00Z","objectStoreRequestCount":1},
 {"timeStamp":"2024-03-10T00:00:00Z","objectStoreRequestCount":15},
]

To view Object Store usage statistics for one day for a sub-organization, submit a curl command, replacing ORG_ID with the organization ID for the sub-organization and BEARER_TOKEN with your bearer token:

curl -X GET \
  'https://object-store-stats.anypoint.mulesoft.com/api/v1/organizations/<ORG_ID>?startDate=2024-12-01T17%3A51%3A54.000Z&endDate=2024-12-03T17%3A51%3A54.000Z&period=1day' \
  -H 'authorization: Bearer <BEARER_TOKEN>'

This request returns a response similar to:

[
 {"timeStamp":"2024-12-01T00:00:00Z","objectStoreRequestCount":4}
 {"timeStamp":"2024-12-02T00:00:00Z","objectStoreRequestCount":2}
 {"timeStamp":"2024-12-03T00:00:00Z","objectStoreRequestCount":8}

]

Example: Get Usage Metrics by Environment

To view Object Store usage statistics for an environment between August 13, 2024 and September 13, 2024, submit a curl command, replacing ORG_ID with your organization ID, ENV_ID with your environment ID, and BEARER_TOKEN with your bearer token:

curl -X GET \
  'https://object-store-stats.anypoint.mulesoft.com/api/v1/organizations/<ORG_ID>/environments/<ENV_ID>?startDate=2024-08-13T17%3A51%3A54.000Z&endDate=2024-09-13T17%3A51%3A54.000Z&period=1month' \
  -H 'authorization: Bearer <BEARER_TOKEN>'

This request returns a response similar to:

[
 {"timeStamp":"2024-08-01T00:00:00Z","objectStoreRequestCount":1},
 {"timeStamp":"2024-09-01T00:00:00Z","objectStoreRequestCount":25}
]

Example: Get Usage Metrics by Region

To view Object Store usage statistics for a region, submit a curl command, replacing ORG_ID with your organization ID, ENV_ID with your environment ID, REGION_ID with the region from which to retrieve metrics, and BEARER_TOKEN with your bearer token:

 curl -X GET \
  'https://object-store-stats.anypoint.mulesoft.com/api/v1/organizations/<ORG_ID>/environments/<ENV_ID>/regions/<REGION_ID>?startDate=2024-08-13T17%3A51%3A54.000Z&endDate=2024-09-13T17%3A51%3A54.000Z&period=1month' \
  -H 'authorization: Bearer <BEARER_TOKEN>'

To retrieve the REGION_ID, see Example: Retrieve a List of Regions.

This request returns a response similar to:

[
 {"timeStamp":"2024-08-01T00:00:00Z","objectStoreRequestCount":1},
 {"timeStamp":"2024-09-01T00:00:00Z","objectStoreRequestCount":25}
]

Example: Get Usage Metrics by Store

To view Object Store usage statistics for a store, submit a curl command, replacing ORG_ID with your organization ID, ENV_ID with your environment ID, REGION_ID with the region to retrieve metrics from, STORE_ID with the store ID to retrieve metrics for, and BEARER_TOKEN with your bearer token:

 curl -X GET \
  'https://object-store-stats.anypoint.mulesoft.com/api/v1/organizations/<ORG_ID>/environments/<ENV_ID>/regions/<REGION_ID>/stores/<STORE_ID>?startDate=2024-08-13T17%3A51%3A54.000Z&endDate=2024-09-13T17%3A51%3A54.000Z&period=1month' \
  -H 'authorization: Bearer <BEARER_TOKEN>'

To retrieve the STORE_ID, see Example: Retrieve a List of Object Stores.

This request returns a response similar to:

[
 {"timeStamp":"2024-08-01T00:00:00Z","objectStoreRequestCount":1},
 {"timeStamp":"2024-09-01T00:00:00Z","objectStoreRequestCount":25}
]

Download Object Store APIs from Exchange

To download the Object Store APIs from Exchange:

  1. Go to Exchange and click Download.

  2. Select the format to download:

    • RAML

    • OAS

    • Mule 4 or Mule 3 connector file

Download button for the Object Store v2 API in Exchange