🔔Webhooks

Create Webhook

POST https://uc.alxgsv.com/api/v1/projects/${PROJECT_ID}/webhooks.json

curl -X POST -H "Authorization: Bearer ${SECRET_KEY}" -H "Content-Type: application/json" -d '{"webhook": { "target_url": "http://example.com/webhook", "events": ["file.updated", "file.created"] }}' https://uc.alxgsv.com/api/v1/projects/${PROJECT_ID}/webhooks.json

Path Parameters

Name
Type
Description

project_id*

String

Headers

Name
Type
Description

Authorization

String

Bearer SECRET_KEY

Request Body

Name
Type
Description

webhook[target_url]*

String

webhook[events]*

Array

webhook[is_active]

Boolean

{
    "data": {
        "type": "groups",
        "id": "g-xu49PKim5ztpqxQ5AfRCwC",
        "attributes": {
            "uuid": null,
            "status": "pending"
        },
        "relationships": {
            "project": {
                "data": {
                    "type": "projects",
                    "id": "8a540ce633522d881e97"
                }
            }
        },
        "authentication": {
            "access_token": "gat-938HYhsrDjFDWpQ4kkG5q2"
        }
    }
}

View Webhook

GET https://uc.alxgsv.com/api/v1/projects/${PROJECT_ID}/webhooks/:webhook_id.json

curl -X GET -H "Authorization: Bearer ${SECRET_KEY}" -H "Content-Type: application/json" https://uc.alxgsv.com/api/v1/projects/${PROJECT_ID}/webhooks/${WEBHOOK_ID}.json

Path Parameters

Name
Type
Description

project_id*

String

webhook_id*

String

Headers

Name
Type
Description

Authorization

String

Bearer SECRET_KEY

{
    "data": {
        "type": "groups",
        "id": "g-xu49PKim5ztpqxQ5AfRCwC",
        "attributes": {
            "uuid": null,
            "status": "pending"
        },
        "relationships": {
            "project": {
                "data": {
                    "type": "projects",
                    "id": "8a540ce633522d881e97"
                }
            }
        },
        "authentication": {
            "access_token": "gat-938HYhsrDjFDWpQ4kkG5q2"
        }
    }
}

Update Webhook

PUT https://uc.alxgsv.com/api/v1/projects/${PROJECT_ID}/webhooks/:webhook_id.json

curl -X PUT -H "Authorization: Bearer ${SECRET_KEY}" -H "Content-Type: application/json" -d '{"webhook": { "target_url": "http://example.com/webhook", "events": ["file.updated", "file.created"] }}' https://uc.alxgsv.com/api/v1/projects/${PROJECT_ID}/webhooks/${WEBHOOK_ID}.json

Path Parameters

Name
Type
Description

project_id*

String

webhook_id*

String

Headers

Name
Type
Description

Authorization

String

Bearer SECRET_KEY

Request Body

Name
Type
Description

webhook[target_url]

String

webhook[events]

Array

webhook[is_active]

Boolean

{
    "data": {
        "type": "groups",
        "id": "g-xu49PKim5ztpqxQ5AfRCwC",
        "attributes": {
            "uuid": null,
            "status": "pending"
        },
        "relationships": {
            "project": {
                "data": {
                    "type": "projects",
                    "id": "8a540ce633522d881e97"
                }
            }
        },
        "authentication": {
            "access_token": "gat-938HYhsrDjFDWpQ4kkG5q2"
        }
    }
}

Update Webhook

DELETE https://uc.alxgsv.com/api/v1/projects/${PROJECT_ID}/webhooks/:webhook_id.json

curl -X DELETE -H "Authorization: Bearer ${SECRET_KEY}" -H "Content-Type: application/json" https://uc.alxgsv.com/api/v1/projects/${PROJECT_ID}/webhooks/${WEBHOOK_ID}.json

Path Parameters

Name
Type
Description

project_id*

String

webhook_id*

String

Headers

Name
Type
Description

Authorization

String

Bearer SECRET_KEY

{
    "data": {
        "type": "groups",
        "id": "g-xu49PKim5ztpqxQ5AfRCwC",
        "attributes": {
            "uuid": null,
            "status": "pending"
        },
        "relationships": {
            "project": {
                "data": {
                    "type": "projects",
                    "id": "8a540ce633522d881e97"
                }
            }
        },
        "authentication": {
            "access_token": "gat-938HYhsrDjFDWpQ4kkG5q2"
        }
    }
}

Event Schema

{
  "data": {
    "type": "webhook_events",
    "id": WEBHOOK_EVENT_ID, // Unique Event Id (not to confuse with webhook id)
    "attributes": {
      "event": WEBHOOK_EVENT_TYPE // Event type, like "file.created", "file.updated", etc
    },
    "relationships": {
      "webhook": {
        "data": {
          "type": "webhooks",
          "id": WEBHOOK_ID
        }
      },
      "resource": {
        "data": {
          "type": RESOURCE_TYPE, // "files", "groups" or "action"
          "id": RESOURCE_ID
        }
      }
    }
  },
  "included": [
    RESOURCE, // full resource serialized
    WEBHOOK // full webhook serialized
  ]
}
Webhook Event Example
{
  "data": {
    "type": "webhook_events",
    "id": "we-vSv8IGDd4hyU9FNIn4Ev8d",
    "attributes": {
      "event": "file.created"
    },
    "relationships": {
      "webhook": {
        "data": {
          "type": "webhooks",
          "id": "wh-BQ26I4Ks4D4bdAZUxzKBRT"
        }
      },
      "resource": {
        "data": {
          "type": "files",
          "id": "f-DkEgAMVLgpa0XxfXwaESIc"
        }
      }
    }
  },
  "included": [
    {
      "type": "files",
      "id": "f-DkEgAMVLgpa0XxfXwaESIc",
      "attributes": {
        "uuid": "2feda6cf-8c85-4f3e-b369-254997fd847f",
        "is_image": true,
        "status": "ready",
        "mime": {
          "mime": "image/png",
          "type": "image",
          "subtype": "png"
        },
        "original_url": null,
        "original_name": "blank.png",
        "size": 8,
        "original_protected": true,
        "chunked_upload": {
          "is_chunked_upload": false,
          "chunk_size": null,
          "is_complete": false
        },
        "metadata": {},
        "content": {
          "image": {
            "dpi": [
              72,
              72
            ],
            "width": 42,
            "format": "PNG",
            "height": 42,
            "sequence": false,
            "color_mode": "P",
            "orientation": null,
            "geo_location": null,
            "datetime_original": null
          },
          "video": null
        },
        "created_at": "2023-11-26T05: 17: 07.185Z",
        "uploaded_at": null,
        "removed_at": null,
        "expires_at": null
      },
      "relationships": {
        "project": {
          "data": {
            "type": "projects",
            "id": "8a540ce633522d881e97"
          }
        }
      },
      "authentication": {
        "access_token": "fat-dcT6AHJ5UqUpOSMVIe27kH"
      },
      "chunked_upload_urls": []
    },
    {
      "type": "webhooks",
      "id": "wh-BQ26I4Ks4D4bdAZUxzKBRT",
      "attributes": {
        "events": [
          "file.created",
          "file.updated",
          "file.deleted",
          "group.created",
          "group.updated",
          "group.deleted",
          "action.created",
          "action.updated"
        ],
        "target_url": "http: //localhost:8080/webhook",
        "is_active": true,
        "version": "1",
        "signing_secret": "whsec-3UOLI5otLDaNONGsM49fEs"
      },
      "relationships": {
        "project": {
          "data": {
            "type": "projects",
            "id": "8a540ce633522d881e97"
          }
        }
      }
    }
  ]
}

Events Types

File

Type
Triggers

file.created

File is created and assigned an ID

file.updated

File is updated (from_url load finish, chunked upload finish, conversion finish, attribute update)

file.deleted

File is deleted (manually or expiration)

Group

Type
Triggers

group.created

Group is created and assigned an ID

group.updated

Group is updated (received UUID from Uploadcare, updated UUID from Uploadcare)

group.deleted

Group is deleted

Actions

Type
Triggers

action.created

Action is created and assigned an ID

action.updated

Action result is ready

Last updated