On this page

Credit Information

Retrieve your available credit balance and expiration date with this endpoint. It returns a JSON object with two properties:

  • credit: Shows your remaining credits.
  • expiration_date: Indicates when your credits will expire.
  • Available Credits

    import requests
    
    headers = {
        'accept': 'application/json',
        'X-API-Key': 'YOUR_API_KEY',
    }
    
    response = requests.get('https://api.withoutbg.com/available-credit', headers=headers)
    
    
    import java.io.IOException;
    import java.io.InputStream;
    import java.net.HttpURLConnection;
    import java.net.URL;
    import java.util.Scanner;
    
    class Main {
    
    	public static void main(String[] args) throws IOException {
    		URL url = new URL("https://api.withoutbg.com/available-credit");
    		HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
    		httpConn.setRequestMethod("GET");
    
    		httpConn.setRequestProperty("accept", "application/json");
    		httpConn.setRequestProperty("X-API-Key", "YOUR_API_KEY");
    
    		InputStream responseStream = httpConn.getResponseCode() / 100 == 2
    				? httpConn.getInputStream()
    				: httpConn.getErrorStream();
    		Scanner s = new Scanner(responseStream).useDelimiter("\\A");
    		String response = s.hasNext() ? s.next() : "";
    		System.out.println(response);
    	}
    }
    
    
    
    ?<php
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'https://api.withoutbg.com/available-credit');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        'accept: application/json',
        'X-API-Key: YOUR_API_KEY',
    ]);
    
    $response = curl_exec($ch);
    
    curl_close($ch);
    
    
    extern crate reqwest;
    use reqwest::header;
    
    fn main() -> Result<(), Box> {
        let mut headers = header::HeaderMap::new();
        headers.insert("accept", "application/json".parse().unwrap());
        headers.insert("X-API-Key", "YOUR_API_KEY".parse().unwrap());
    
        let client = reqwest::blocking::Client::builder()
            .redirect(reqwest::redirect::Policy::none())
            .build()
            .unwrap();
        let res = client.get("https://api.withoutbg.com/available-credit")
            .headers(headers)
            .send()?
            .text()?;
        println!("{}", res);
    
        Ok(())
    }
    
    
    fetch('https://api.withoutbg.com/available-credit', {
        headers: {
            'accept': 'application/json',
            'X-API-Key': 'YOUR_API_KEY'
        }
    });
    
    
    package main
    
    import (
    	"fmt"
    	"io"
    	"log"
    	"net/http"
    )
    
    func main() {
    	client := &http.Client{}
    	req, err := http.NewRequest("GET", "https://api.withoutbg.com/available-credit", nil)
    	if err != nil {
    		log.Fatal(err)
    	}
    	req.Header.Set("accept", "application/json")
    	req.Header.Set("X-API-Key", "YOUR_API_KEY")
    	resp, err := client.Do(req)
    	if err != nil {
    		log.Fatal(err)
    	}
    	defer resp.Body.Close()
    	bodyText, err := io.ReadAll(resp.Body)
    	if err != nil {
    		log.Fatal(err)
    	}
    	fmt.Printf("%s\n", bodyText)
    }
    
    
    curl -X 'GET' \
      'https://api.withoutbg.com/available-credit' \
      -H 'accept: application/json' \
      -H 'X-API-Key: YOUR_API_KEY'
    
    
    using System.Net.Http;
    
    HttpClient client = new HttpClient();
    
    HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://api.withoutbg.com/available-credit");
    
    request.Headers.Add("accept", "application/json");
    request.Headers.Add("X-API-Key", "YOUR_API_KEY");
    
    HttpResponseMessage response = await client.SendAsync(request);
    response.EnsureSuccessStatusCode();
    string responseBody = await response.Content.ReadAsStringAsync();
    
    

    Sample Response:

    {
    	"credit": 100,
    	"expiration_date": "2024-05-20"
    }
    
    
    

    Status Codes

    Status Code Description
    200 Success
    401 Invalid API Key