Assets API reference
#Overview
The Asset model is included with every project, can be modified with custom Field Types, and are localized by default, but cannot be deleted.
While most commonly used for photos, can support any file type including audio files, zip files, and more.
The Asset type extends the system fields.
Here are some links that might help you:
Document name | Description |
---|---|
Fetching assets | Learn about the 4 query types that Hygraph automatically creates for every asset. |
Referencing assets | Learn how to query assets in relation to a model in your schema. |
Transformations | Learn about asset transformations. |
Uploading assets | Learn how to upload assets by file and by remote URL. |
Updating assets | Learn how to use the updateAsset mutation. |
Deleting assets | Learn how to delete assets using the deleteAsset mutation. |
Publishing assets | Learn how to use the publishAsset and unpublishAsset mutations. |
Localized assets | Learn about asset localization. |
Embedded types | Learn how to ember assets into Rich Text fields. |
#Which asset system does my project use?
At the moment, Hygraph projects can use one of two asset systems. Projects created after February 2024 will use the new Hygraph Asset Management system, while projects that are older than that will use the Legacy asset system.
If your project is a clone of an older project, it will use the legacy asset system.
To learn what system your project uses, check the asset upload popup in the UI.
UI asset upload
If your project shows this, you are using the legacy asset system:
UI - Legacy Asset system
If your project shows this, you are using the Hygraph Asset Management system:
UI - Hygraph Asset Management system
Another way to quickly see which asset system your project uses is to navigate to Project Settings > Endpoints, and look for the Assets section.
If you see this, your project uses the new Hygraph Asset Management system:
Hygraph Asset Management system
If you see this, your project uses the Legacy Asset system:
Legacy Asset system
While both systems are available, our documentation will provide information on how to work with each. You will find this in our API Reference for Assets in the transformations, asset upload, and localization documents.
Simply identify the system your project uses and proceed with that documentation.