Attach a resource to an application environment
const url = 'https://dashboard.quantcdn.io/api/v3/organizations/test-org/resources/res-abc123/attachments';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"application":"test-app","environment":"production","envVarPrefix":"MEDIA","accessLevel":"scoped"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://dashboard.quantcdn.io/api/v3/organizations/test-org/resources/res-abc123/attachments \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "application": "test-app", "environment": "production", "envVarPrefix": "MEDIA", "accessLevel": "scoped" }'Object storage credentials are written immediately and take effect on the environment’s next deploy. Cache variables are rendered at the next deploy, so a cache may be attached while it is still provisioning. An environment accepts one attachment per resource type.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The organisation ID
Example
test-orgThe resource ID
Example
res-abc123Request Bodyrequired
Section titled “Request Bodyrequired”object
Example
test-appExample
productionNamespaces every injected variable, so MEDIA yields MEDIA_S3_BUCKET
Example
MEDIACache only. scoped injects an RBAC user limited to this environment’s CACHE_PREFIX (plain and {hash-tag} forms) with FLUSHALL and FLUSHDB denied. admin injects the cache-wide credential for integrations that require FLUSHDB, such as Laravel Cache::flush() or the WordPress object cache without selective flush; it can read, write and flush every attached environment’s keys.
Responses
Section titled “Responses”The attachment
object
Namespaces every injected variable, so MEDIA yields MEDIA_S3_BUCKET
Object storage only. The secret half is written to the environment’s secrets and never returned.
Cache only. This environment’s own RBAC user, limited to its CACHE_PREFIX with FLUSHALL and FLUSHDB denied, so it cannot touch another environment’s keys.
Cache only. scoped: the environment holds its own RBAC user. admin: it holds the cache-wide credential and can read, write and flush every attached environment’s keys. Absent on attachments made before access levels existed (treated as scoped).
The exact variable names this attachment wrote, removed precisely on detach
When the credentials take effect
Example
{ "appName": "test-app", "envName": "production", "envVarPrefix": "MEDIA", "accessLevel": "scoped"}An attachment of this type already exists for the environment
