Component API
The component API provides endpoint to upload, download and find Golem components (WASM files with associated metadata).
Get the metadata for all component versions
| Path | Method | Protected | 
|---|---|---|
| /v2/components/{component_id} | GET | Yes | 
Each component can have multiple versions. Every time a new WASM is uploaded for a given component id, that creates a new version. This endpoint returns a list of all versions for the component id provided as part of the URL. Each element of the response describes a single version of a component, but does not contain the binary (WASM) itself:
- versionedComponentIdassociates a specific version with the component id
- userComponentIdand protectedComponentId are implementation details, not used elsewhere on the public API
- componentNameis the human-readable name of the component
- componentSizeis the WASM binary's size in bytes
- metadatacontains information extracted from the WASM itself
- metadata.exportsis a list of exported functions, including their parameter's and return value's types
- metadata.producersis a list of producer information added by tooling, each consisting of a list of fields associating one or more values to a given key. This contains information about what compilers and other WASM related tools were used to construct the Golem component.
Example Response JSON
[
  {
    "versionedComponentId": {
      "componentId": "196100ac-4eec-4fb6-a7f7-86c8b584771d",
      "version": 0
    },
    "userComponentId": {
      "versionedComponentId": {
        "componentId": "196100ac-4eec-4fb6-a7f7-86c8b584771d",
        "version": 0
      }
    },
    "protectedComponentId": {
      "versionedComponentId": {
        "componentId": "196100ac-4eec-4fb6-a7f7-86c8b584771d",
        "version": 0
      }
    },
    "componentName": "string",
    "componentSize": 0,
    "metadata": {
      "exports": [
        {
          "type": "Instance",
          "name": "string",
          "functions": [
            {
              "name": "string",
              "parameters": [
                {
                  "name": "string",
                  "typ": {
                    "type": "Variant",
                    "cases": [
                      {
                        "name": "string",
                        "typ": {}
                      }
                    ]
                  }
                }
              ],
              "results": [
                {
                  "name": "string",
                  "typ": {
                    "type": "Variant",
                    "cases": [
                      {
                        "name": "string",
                        "typ": {}
                      }
                    ]
                  }
                }
              ]
            }
          ]
        }
      ],
      "producers": [
        {
          "fields": [
            {
              "name": "string",
              "values": [
                {
                  "name": "string",
                  "version": "string"
                }
              ]
            }
          ]
        }
      ]
    },
    "projectId": "5a8591dd-4039-49df-9202-96385ba3eff8"
  }
]Update a component
| Path | Method | Protected | 
|---|---|---|
| /v2/components/{component_id}/upload | PUT | Yes | 
Request Body: WASM Binary File
Make sure to include
Content-Type: application/octet-streamHeader
Example Response JSON
{
  "versionedComponentId": {
    "componentId": "196100ac-4eec-4fb6-a7f7-86c8b584771d",
    "version": 0
  },
  "userComponentId": {
    "versionedComponentId": {
      "componentId": "196100ac-4eec-4fb6-a7f7-86c8b584771d",
      "version": 0
    }
  },
  "protectedComponentId": {
    "versionedComponentId": {
      "componentId": "196100ac-4eec-4fb6-a7f7-86c8b584771d",
      "version": 0
    }
  },
  "componentName": "string",
  "componentSize": 0,
  "metadata": {
    "exports": [
      {
        "type": "Instance",
        "name": "string",
        "functions": [
          {
            "name": "string",
            "parameters": [
              {
                "name": "string",
                "typ": {
                  "type": "Variant",
                  "cases": [
                    {
                      "name": "string",
                      "typ": {}
                    }
                  ]
                }
              }
            ],
            "results": [
              {
                "name": "string",
                "typ": {
                  "type": "Variant",
                  "cases": [
                    {
                      "name": "string",
                      "typ": {}
                    }
                  ]
                }
              }
            ]
          }
        ]
      }
    ],
    "producers": [
      {
        "fields": [
          {
            "name": "string",
            "values": [
              {
                "name": "string",
                "version": "string"
              }
            ]
          }
        ]
      }
    ]
  },
  "projectId": "5a8591dd-4039-49df-9202-96385ba3eff8"
}Upload a new component
| Path | Method | Protected | 
|---|---|---|
| /v2/components | POST | Yes | 
The request body is encoded as multipart/form-data containing metadata and the WASM binary.
Request Form: multipart/form-data
Make sure to include
Content-Type: multipart/form-dataHeader
Field query: JSON
{
  "projectId": "5a8591dd-4039-49df-9202-96385ba3eff8",
  "componentName": "string"
}Field component: string binary
Example Response JSON
{
  "versionedComponentId": {
    "componentId": "196100ac-4eec-4fb6-a7f7-86c8b584771d",
    "version": 0
  },
  "userComponentId": {
    "versionedComponentId": {
      "componentId": "196100ac-4eec-4fb6-a7f7-86c8b584771d",
      "version": 0
    }
  },
  "protectedComponentId": {
    "versionedComponentId": {
      "componentId": "196100ac-4eec-4fb6-a7f7-86c8b584771d",
      "version": 0
    }
  },
  "componentName": "string",
  "componentSize": 0,
  "metadata": {
    "exports": [
      {
        "type": "Instance",
        "name": "string",
        "functions": [
          {
            "name": "string",
            "parameters": [
              {
                "name": "string",
                "typ": {
                  "type": "Variant",
                  "cases": [
                    {
                      "name": "string",
                      "typ": {}
                    }
                  ]
                }
              }
            ],
            "results": [
              {
                "name": "string",
                "typ": {
                  "type": "Variant",
                  "cases": [
                    {
                      "name": "string",
                      "typ": {}
                    }
                  ]
                }
              }
            ]
          }
        ]
      }
    ],
    "producers": [
      {
        "fields": [
          {
            "name": "string",
            "values": [
              {
                "name": "string",
                "version": "string"
              }
            ]
          }
        ]
      }
    ]
  },
  "projectId": "5a8591dd-4039-49df-9202-96385ba3eff8"
}Get all components
| Path | Method | Protected | 
|---|---|---|
| /v2/components | GET | Yes | 
Gets all components, optionally filtered by project and/or component name.
Query Parameters
| Name | Type | Required | Description | 
|---|---|---|---|
| project-id | string | No | Project ID to filter by | 
| component-name | string | No | Component name to filter by | 
Example Response JSON
[
  {
    "versionedComponentId": {
      "componentId": "196100ac-4eec-4fb6-a7f7-86c8b584771d",
      "version": 0
    },
    "userComponentId": {
      "versionedComponentId": {
        "componentId": "196100ac-4eec-4fb6-a7f7-86c8b584771d",
        "version": 0
      }
    },
    "protectedComponentId": {
      "versionedComponentId": {
        "componentId": "196100ac-4eec-4fb6-a7f7-86c8b584771d",
        "version": 0
      }
    },
    "componentName": "string",
    "componentSize": 0,
    "metadata": {
      "exports": [
        {
          "type": "Instance",
          "name": "string",
          "functions": [
            {
              "name": "string",
              "parameters": [
                {
                  "name": "string",
                  "typ": {
                    "type": "Variant",
                    "cases": [
                      {
                        "name": "string",
                        "typ": {}
                      }
                    ]
                  }
                }
              ],
              "results": [
                {
                  "name": "string",
                  "typ": {
                    "type": "Variant",
                    "cases": [
                      {
                        "name": "string",
                        "typ": {}
                      }
                    ]
                  }
                }
              ]
            }
          ]
        }
      ],
      "producers": [
        {
          "fields": [
            {
              "name": "string",
              "values": [
                {
                  "name": "string",
                  "version": "string"
                }
              ]
            }
          ]
        }
      ]
    },
    "projectId": "5a8591dd-4039-49df-9202-96385ba3eff8"
  }
]Download a component
| Path | Method | Protected | 
|---|---|---|
| /v2/components/{component_id}/download | GET | Yes | 
Downloads a specific version of the component's WASM.
Query Parameters
| Name | Type | Required | Description | 
|---|---|---|---|
| version | integer | No | - | 
Response Body: WASM Binary File
Get the latest version of a given component
| Path | Method | Protected | 
|---|---|---|
| /v2/components/{component_id}/latest | GET | Yes | 
Gets the latest version of a component.
Example Response JSON
{
  "versionedComponentId": {
    "componentId": "196100ac-4eec-4fb6-a7f7-86c8b584771d",
    "version": 0
  },
  "userComponentId": {
    "versionedComponentId": {
      "componentId": "196100ac-4eec-4fb6-a7f7-86c8b584771d",
      "version": 0
    }
  },
  "protectedComponentId": {
    "versionedComponentId": {
      "componentId": "196100ac-4eec-4fb6-a7f7-86c8b584771d",
      "version": 0
    }
  },
  "componentName": "string",
  "componentSize": 0,
  "metadata": {
    "exports": [
      {
        "type": "Instance",
        "name": "string",
        "functions": [
          {
            "name": "string",
            "parameters": [
              {
                "name": "string",
                "typ": {
                  "type": "Variant",
                  "cases": [
                    {
                      "name": "string",
                      "typ": {}
                    }
                  ]
                }
              }
            ],
            "results": [
              {
                "name": "string",
                "typ": {
                  "type": "Variant",
                  "cases": [
                    {
                      "name": "string",
                      "typ": {}
                    }
                  ]
                }
              }
            ]
          }
        ]
      }
    ],
    "producers": [
      {
        "fields": [
          {
            "name": "string",
            "values": [
              {
                "name": "string",
                "version": "string"
              }
            ]
          }
        ]
      }
    ]
  },
  "projectId": "5a8591dd-4039-49df-9202-96385ba3eff8"
}Component API Errors
| Status Code | Description | Body | 
|---|---|---|
| 400 | Invalid request, returning with a list of issues detected in the request | {"errors":["string"]} | 
| 401 | Unauthorized | {"error":"string"} | 
| 403 | Maximum number of components exceeded | {"error":"string"} | 
| 404 | Component not found | {"error":"string"} | 
| 409 | Component already exists | {"error":"string"} | 
| 500 | Internal server error | {"error":"string"} |