• Home
  • Integrations
  • SDKs
  • Guides
  • API docs
    No results for ""
    EXPAND ALL

    EDIT ON GITHUB

    Deployment events API

    Read time: 1 minute
    Last edited: Feb 01, 2023
    This feature is for Early Access Program customers only

    Accelerate is only available to members of LaunchDarkly's Early Access Program (EAP). If you want access to this feature, join the EAP.

    Overview

    This topic describes the deployment events REST API.

    Accelerate defines a deployment as a new code change your team has introduced to an environment. Each time a deployment starts, finishes, or fails, your deployment pipeline should send a deployment event to Accelerate. Accelerate combines these events with data from your feature management to provide release and deployment metrics.

    If you are unable to send separate start and finish events, you can send a single finished event. In this case, Accelerate will set the deployment start and finish times to the same time, and will not have accurate deployment duration data.

    If you prefer not to instrument your deployment pipeline, you can send deployment information in your LaunchDarkly SDK configuration instead. To learn more, read Configuring your application to send deployment information.

    Making a deployment event request

    Here's how to structure a deployment event request using the Accelerate REST API:

    Request elementDescription
    Required headers
    • Authorization: <Access token with Writer role>
      To learn more, read API access tokens.
    • Content-Type: application/json
    REST methodPOST
    Resource/api/v2/accelerate/deployment-events

    Here are the request body parameters for the deployment events API:

    Request body parameterDescription
    projectKeyThe project key
    environmentKeyThe environment key
    applicationKeyThe application key. This defines the granularity at which you want to view your Accelerate metrics. Typically it is the name of one of the GitHub repositories that you use in this project.

    Accelerate automatically creates a new application each time you send a unique application key.
    versionThe application version. You can set the application version to any string that includes only letters, numbers, periods (.), hyphens (-), or underscores (_).

    We recommend setting the application version to the full SHA of the GitHub commit for this deployment.
    eventTypeOne of started, finished, failed
    eventTimeThe time, in Unix milliseconds, when the event occurred
    eventMetadataA JSON object containing metadata about the event
    deploymentMetadataA JSON object containing metadata about the deployment

    Here's an example deployment event request:

    curl -i -X POST \
    'https://app.launchdarkly.com/api/v2/accelerate/deployment-events' \
    -H 'Authorization: EXAMPLE-API-ACCESS-TOKEN' \
    -H 'Content-Type: application/json' \
    -d '{
    "projectKey": "{{yourProjectKey}}",
    "environmentKey": "test",
    "applicationKey": "application-key-123abc",
    "version": "a12bcde3f45ab6c789123456d78efabcde91234f",
    "eventType": "started",
    "eventTime": {{epochMilliseconds}},
    "eventMetadata": {"approver": "test-user"},
    "deploymentMetadata": {"deploymentInfo": "example-deployment-info"}
    }'