Materials API

Materials are the generated videos and banners. Use these endpoints to create, manage, and publish your content.

Endpoints

Method Endpoint Description
GET /api/materials List all materials
GET /api/materials/{id} Get material by ID
POST /api/materials/update Update material
DELETE /api/materials/{id} Delete material
POST /api/materials/publish Publish material
GET /api/materials/getPublishTargets Get publish targets
GET /api/materials/filter Filter materials
GET /api/videos/{id} Get video file

List Materials

GET /api/materials

Retrieve a list of all materials in your account.

Query Parameters

Parameter Type Description
limit integer Number of materials to return (default: 20, max: 100)
offset integer Number of materials to skip for pagination
status string Filter by status: processing, ready, failed

Example Request

curl -X GET "https://api.adbot.fi/api/materials?limit=10&status=ready" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

{
  "success": true,
  "data": [
    {
      "id": "mat_abc123",
      "name": "Summer Sale Video",
      "templateId": "tpl_social_v1",
      "status": "ready",
      "createdAt": "2024-01-15T10:30:00Z"
    }
  ],
  "pagination": {
    "total": 42,
    "limit": 10,
    "offset": 0
  }
}

Get Material

GET /api/materials/{id}

Retrieve a specific material by ID.

Response

{
  "success": true,
  "data": {
    "id": "mat_abc123",
    "name": "Summer Sale Video",
    "templateId": "tpl_social_v1",
    "status": "ready",
    "data": {
      "headline": "Summer Sale - 50% Off!",
      "productImage": "https://example.com/product.png",
      "ctaText": "Shop Now"
    },
    "videos": [
      {
        "format": "1080x1920",
        "url": "https://cdn.adbot.fi/videos/mat_abc123_1080x1920.mp4",
        "thumbnail": "https://cdn.adbot.fi/thumbs/mat_abc123_1080x1920.jpg",
        "duration": 15,
        "fileSize": 2458624
      }
    ],
    "createdAt": "2024-01-15T10:30:00Z",
    "updatedAt": "2024-01-15T10:30:15Z"
  }
}

Update Material

POST /api/materials/update

Update a material's data and regenerate the video.

Request Body

{
  "id": "mat_abc123",
  "name": "Updated Summer Sale Video",
  "data": {
    "headline": "Flash Sale - 70% Off!",
    "ctaText": "Buy Now"
  }
}

Response

{
  "success": true,
  "data": {
    "id": "mat_abc123",
    "status": "processing",
    "message": "Material is being regenerated"
  }
}

Delete Material

DELETE /api/materials/{materialId}

Permanently delete a material and its associated files.

Response

{
  "success": true,
  "message": "Material deleted successfully"
}

Publish Material

POST /api/materials/publish

Publish a material to an advertising platform or digital signage.

Request Body

{
  "materialId": "mat_abc123",
  "targets": [
    {
      "type": "meta",
      "accountId": "act_123456",
      "adSetId": "adset_789"
    },
    {
      "type": "digital_signage",
      "playlistId": "playlist_456"
    }
  ]
}

Response

{
  "success": true,
  "data": {
    "materialId": "mat_abc123",
    "publications": [
      {
        "target": "meta",
        "status": "published",
        "externalId": "meta_ad_123"
      },
      {
        "target": "digital_signage",
        "status": "scheduled",
        "playlistId": "playlist_456"
      }
    ]
  }
}

Get Publish Targets

GET /api/materials/getPublishTargets

Get available publishing destinations configured in your account.

Response

{
  "success": true,
  "data": {
    "targets": [
      {
        "type": "meta",
        "name": "Meta Ads",
        "accounts": [
          { "id": "act_123", "name": "Main Ad Account" }
        ]
      },
      {
        "type": "digital_signage",
        "name": "Digital Signage",
        "playlists": [
          { "id": "pl_456", "name": "Store Displays" }
        ]
      }
    ]
  }
}

Filter Materials

GET /api/materials/filter

Advanced filtering for materials with multiple criteria.

Query Parameters

Parameter Type Description
templateId string Filter by template
projectId string Filter by project
createdAfter ISO 8601 Materials created after this date
createdBefore ISO 8601 Materials created before this date
search string Search in material names

Example Request

curl -X GET "https://api.adbot.fi/api/materials/filter?templateId=tpl_social_v1&createdAfter=2024-01-01" \
  -H "Authorization: Bearer YOUR_API_KEY"

Get Material Video

GET /api/videos/{id}

Stream or download a material's video file.

Query Parameters

Parameter Type Description
format string Video format (e.g., 1080x1920)
download boolean Force download instead of streaming