Skip to main content
POST
/
applications
/
attachments
cURL
curl -X POST \
  "https://api.incentives.leap.energy/alpha/applications/attachments?application_id=123" \
  -H "x-api-key: leap_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "attachment_type": "INVOICE_EQUIPMENT",
    "filename": "invoice.pdf",
    "contentType": "application/pdf"
  }'
import requests

url = "https://api.incentives.leap.energy/alpha/applications/attachments?application_id=123"

payload = {
"attachment_type": "INVOICE_EQUIPMENT",
"filename": "invoice.pdf",
"contentType": "application/pdf"
}

headers = {
"x-api-key": "leap_live_...",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch(
'https://api.incentives.leap.energy/alpha/applications/attachments?application_id=123',
{
method: 'POST',
headers: {
'x-api-key': 'leap_live_...',
'Content-Type': 'application/json'
},
body: JSON.stringify({
attachment_type: 'INVOICE_EQUIPMENT',
filename: 'invoice.pdf',
contentType: 'application/pdf'
})
}
);

const data = await response.json();
console.log(data);
<?php

$url = 'https://api.incentives.leap.energy/alpha/applications/attachments?application_id=123';

$payload = [
'attachment_type' => 'INVOICE_EQUIPMENT',
'filename' => 'invoice.pdf',
'contentType' => 'application/pdf'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: leap_live_...',
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

print_r(json_decode($response, true));
import java.net.http.*;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();

String json = """{
"attachment_type": "INVOICE_EQUIPMENT",
"filename": "invoice.pdf",
"contentType": "application/pdf"
}""";

HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.incentives.leap.energy/alpha/applications/attachments?application_id=123"))
.header("x-api-key", "leap_live_...")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
require 'net/http'
require 'json'

uri = URI('https://api.incentives.leap.energy/alpha/applications/attachments?application_id=123')

payload = {
attachment_type: 'INVOICE_EQUIPMENT',
filename: 'invoice.pdf',
contentType: 'application/pdf'
}

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri)
request['x-api-key'] = 'leap_live_...'
request['Content-Type'] = 'application/json'
request.body = payload.to_json

response = http.request(request)
puts JSON.parse(response.body)
package main

import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)

func main() {
url := "https://api.incentives.leap.energy/alpha/applications/attachments?application_id=123"

payload := map[string]interface{}{
"attachment_type": "INVOICE_EQUIPMENT",
"filename": "invoice.pdf",
"contentType": "application/pdf",
}

jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("x-api-key", "leap_live_...")
req.Header.Set("Content-Type", "application/json")

client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()

var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
}
{
  "ok": true,
  "requestId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
  "uploadUrl": "https://your-project.supabase.co/storage/v1/object/sign/attachments/app-123/uuid-invoice.pdf?token=...",
  "path": "app-123/a1b2c3d4-e5f6-7890-abcd-ef1234567890-invoice.pdf",
  "bucket": "attachments",
  "instructions": "PUT bytes to uploadUrl with the file content-type, then call POST /applications/attachments/commit to finalize."
}
{
"code": "not_found",
"message": "Application 123 not found",
"requestId": "550e8400-e29b-41d4-a716-446655440000",
"details": "Additional context about the error"
}
{
"code": "not_found",
"message": "Application 123 not found",
"requestId": "550e8400-e29b-41d4-a716-446655440000",
"details": "Additional context about the error"
}

Overview

Upload documentation attachments for applications using a three-step process:
  1. Create Upload URL: Request a signed URL
  2. Upload File: PUT file to the signed URL
  3. Commit Upload: Finalize the attachment
  • application_id comes from the query parameter, not the request body
  • The signed upload URL expires quickly (typically 60 seconds)
  • The path in commit must match the path from create upload URL response
Make sure to upload and commit the file before the signed URL expires, or request a new upload URL.
For detailed workflow explanation, storage paths, attachment types, and best practices, see the Attachments Workflow section in the API Guide.

Authorizations

x-api-key
string
header
required

API key for authentication. Include your Leap API key in the x-api-key header: x-api-key: leap_live_...

Query Parameters

application_id
integer
required

Application ID to attach the file to. The application must belong to your organization.

Body

application/json

Attachment metadata for creating the upload URL. Note: application_id comes from query parameter, not body.

attachment_type
enum<string>
required

Type of attachment being uploaded

Available options:
INVOICE_EQUIPMENT,
INVOICE_INSTALL,
PERMIT,
PHOTO_NAMEPLATE,
PHOTO_INSTALL,
PHOTO_METER,
AHRI_CERT,
NEAT_REPORT,
INCOME_FORM,
W9,
OTHER,
MODEL_TECH_SPECS,
VEHICLE_PURCHASE,
UTILITY_BILL,
VEHICLE_REGISTRATION,
TARIFF_CONFIRMATION
Example:

"INVOICE_EQUIPMENT"

filename
string
required

Name of the file being uploaded

Example:

"invoice.pdf"

contentType
string
required

MIME type of the file

Example:

"application/pdf"

Response

Successfully created upload URL

ok
boolean
Example:

true

requestId
string
Example:

"b2c3d4e5-f6a7-8901-bcde-f12345678901"

uploadUrl
string<uri>

Signed URL for uploading the file (PUT file bytes here)

Example:

"https://your-project.supabase.co/storage/v1/object/sign/attachments/app-123/uuid-invoice.pdf?token=..."

path
string

Object path to use in commit step

Example:

"app-123/a1b2c3d4-e5f6-7890-abcd-ef1234567890-invoice.pdf"

bucket
string
Example:

"attachments"

instructions
string
Example:

"PUT bytes to uploadUrl with the file content-type, then call POST /applications/attachments/commit to finalize."