Make Your First API Call
Step-by-step guide to making your first API call using the Videnly API.
Step 6: Make Your First API Call
With your API key integrated, you are ready to make your first request to the Videnly API.
This initial call will help you verify that your integration is working correctly and allow you to start generating videos.
Important Requirements Before Your First Call
- Project ID: Ensure you have the ID of the project you created. This ID is essential to specify which project configuration to use for generating videos.
- Credits: Confirm that your account has sufficient credits, as each video generation request will consume credits based on your plan.
- Optional Parameters: You can pass additional parameters to customize the video generation request, such as
overwriteProjectSettings
andoverwriteCustomPrompt
.
How to Make Your First API Call
Prepare Your Environment
You can use tools like Postman, cURL, or any programming language that supports HTTP requests.
Construct Your API Request
Make a POST request to the Videnly API endpoint, ensuring your API key is included in the Authorization
header.
Example of a Simple API Call
Here’s an example of making your first API call to add a video generation request to the queue:
Example using cURL
- Replace
YOUR_API_KEY
with the actual API key from the Developers page. - Replace
YOUR_PROJECT_ID
with the ID of the project you created.
Understanding the Request Body
- projectId: The unique ID of the project you created earlier. This is required for specifying which project settings to use for video generation.
- overwriteProjectSettings (optional): A flag that can be set to
true
orfalse
to determine if custom project settings should override the saved ones. - overwriteCustomPrompt (optional | required if overwriteProjectSettings:
true
): If provided, this custom prompt will be used instead of the default project prompt.
Code Examples in Various Languages
Use the examples below to see how you can make an API call using different programming languages:
Understanding the Response
A successful API call will return a JSON response with details about the queued video generation request. Here is an example of what the response might look like:
- status: Indicates if the request was successful.
- newQueueItem: Contains details about the queued item, including
queueId
,status
, andcreatedAt
.
Verify Your API Call
- Check the Response: If your request is successful, you should see a response similar to the example above, confirming your video generation request has been added to the queue.
- Handle Errors: If the request fails, check the response for error messages. Common issues might include an invalid API key, missing
projectId
, or insufficient credits.
Tips for Your First API Call
- Ensure You Have Credits: Each video generation request consumes credits. Confirm your account has enough credits.
- Include the Project ID: Always specify the
projectId
to ensure the correct settings are applied to the video generation request. - Use Optional Parameters as Needed: Use
overwriteProjectSettings
andoverwriteCustomPrompt
to customize your requests. - Use Testing Tools: Tools like Postman or cURL can help you debug and confirm your API call works before integrating it.
Next Steps: Monitor the Queue
Now that you’ve made your first API call, you can start monitoring your queued requests by using the Queue Progress endpoint to check the status of your video generation requests.
Need Help?
If you encounter any issues or need further guidance, please visit our Support Center.