# Example Request
curl -X POST "https://api.getmetal.io/v1/data-entities" \
--header 'Content-Type: application/json' \
--header 'x-metal-api-key: <api-key>' \
--header 'x-metal-client-id: <client-id>' \
--data '{
"datasource": "datasourceID",
"name": "Song Lyrics",
"sourceType": "file",
"metadata": {
"author": "Rolling Stone"
}
}'
{
"data": {
"id": "dataEntityID",
"datasource": "datasourceID",
"name": "Song Lyrics",
"extractedMetadata": [
{
"name": "band",
"value": "Iron Maiden",
"type": "string",
"autoExtract": true
}
],
"sourcetype": "file",
"status": "CREATED",
"createdAt": "2023-08-29T17:00:55.002Z",
"updatedAt": "1970-01-01T00:00:00Z",
"metadata": {
"author": "Rolling Stone",
"band": "Iron Maiden"
},
"metadataFields": [
{
"name": "band",
"type": "string",
"description": "Which heavy metal band is represented by the iconic mascot Eddie?",
"autoExtract": true
},
{
"name": "author",
"type": "string",
"autoExtract": false
}
],
"url": "signed_upload_url",
"createdBy": "userID"
}
}
📄 Data Entities
Add a Data Entity
This endpoint creates a new Data Entity.
POST
/
v1
/
data-entities
# Example Request
curl -X POST "https://api.getmetal.io/v1/data-entities" \
--header 'Content-Type: application/json' \
--header 'x-metal-api-key: <api-key>' \
--header 'x-metal-client-id: <client-id>' \
--data '{
"datasource": "datasourceID",
"name": "Song Lyrics",
"sourceType": "file",
"metadata": {
"author": "Rolling Stone"
}
}'
{
"data": {
"id": "dataEntityID",
"datasource": "datasourceID",
"name": "Song Lyrics",
"extractedMetadata": [
{
"name": "band",
"value": "Iron Maiden",
"type": "string",
"autoExtract": true
}
],
"sourcetype": "file",
"status": "CREATED",
"createdAt": "2023-08-29T17:00:55.002Z",
"updatedAt": "1970-01-01T00:00:00Z",
"metadata": {
"author": "Rolling Stone",
"band": "Iron Maiden"
},
"metadataFields": [
{
"name": "band",
"type": "string",
"description": "Which heavy metal band is represented by the iconic mascot Eddie?",
"autoExtract": true
},
{
"name": "author",
"type": "string",
"autoExtract": false
}
],
"url": "signed_upload_url",
"createdBy": "userID"
}
}
Two-step process
This endpoint is a two-step process. First, you create the data entity’s URL, and then you upload the file to the signed URL.- Step 1:
POST https://api.getmetal.io/v1/data-entities - Step 2:
PUTto the signed URL
Step 1: Request URL for the File
Auth Headers
string
required
An API key for your org.
string
required
A Client ID for your org.
Body
ObjectID
required
The datasource ID.
string
required
The name of the data entity.
object
An object of metdatadata keys/values. The key is the field key and the value
is the field value for this entity.
string
required
The type of the source (e.g., “PDF”, “Text”).
Response
Data Entity Object
# Example Request
curl -X POST "https://api.getmetal.io/v1/data-entities" \
--header 'Content-Type: application/json' \
--header 'x-metal-api-key: <api-key>' \
--header 'x-metal-client-id: <client-id>' \
--data '{
"datasource": "datasourceID",
"name": "Song Lyrics",
"sourceType": "file",
"metadata": {
"author": "Rolling Stone"
}
}'
{
"data": {
"id": "dataEntityID",
"datasource": "datasourceID",
"name": "Song Lyrics",
"extractedMetadata": [
{
"name": "band",
"value": "Iron Maiden",
"type": "string",
"autoExtract": true
}
],
"sourcetype": "file",
"status": "CREATED",
"createdAt": "2023-08-29T17:00:55.002Z",
"updatedAt": "1970-01-01T00:00:00Z",
"metadata": {
"author": "Rolling Stone",
"band": "Iron Maiden"
},
"metadataFields": [
{
"name": "band",
"type": "string",
"description": "Which heavy metal band is represented by the iconic mascot Eddie?",
"autoExtract": true
},
{
"name": "author",
"type": "string",
"autoExtract": false
}
],
"url": "signed_upload_url",
"createdBy": "userID"
}
}
Step 2: Upload the File to the Signed URL
# Example Request
curl --location --request PUT '<preSignedUrl>' \
--header 'Content-Type: application/pdf' \
--upload-file '/path/to/your/example.pdf'