# Create ghost card POST https://api-sandbox.payabli.com/api/MoneyOutCard/GhostCard/{entry} Content-Type: application/json Creates a ghost card, a multi-use virtual debit card issued to a vendor for recurring or discretionary spend. Unlike single-use virtual cards issued as part of a payout transaction, ghost cards aren't tied to a specific payout. They're issued directly to a vendor and can be reused up to a configurable number of times within the card's spending limits. Reference: https://docs.payabli.com/developers/api-reference/cards/create-ghost-card ## OpenAPI Specification ```yaml openapi: 3.1.0 info: title: payabliApi version: 1.0.0 paths: /MoneyOutCard/GhostCard/{entry}: post: operationId: create-ghost-card summary: Create ghost card description: >- Creates a ghost card, a multi-use virtual debit card issued to a vendor for recurring or discretionary spend. Unlike single-use virtual cards issued as part of a payout transaction, ghost cards aren't tied to a specific payout. They're issued directly to a vendor and can be reused up to a configurable number of times within the card's spending limits. tags: - subpackage_ghostCard parameters: - name: entry in: path required: true schema: $ref: '#/components/schemas/type_:Entry' - name: requestToken in: header required: true schema: type: string responses: '200': description: Success response with ghost card details. content: application/json: schema: $ref: '#/components/schemas/type_ghostCard:CreateGhostCardResponse' '400': description: Bad request/ invalid data content: application/json: schema: description: Any type '401': description: Unauthorized request. content: application/json: schema: description: Any type '500': description: Internal API Error content: application/json: schema: description: Any type '503': description: Database connection error content: application/json: schema: $ref: '#/components/schemas/type_:PayabliApiResponse' requestBody: content: application/json: schema: type: object properties: vendorId: type: integer format: int64 description: >- ID of the vendor who receives the card. The vendor must belong to the paypoint and have an active status. expenseLimit: type: number format: double description: >- Spending limit for the card. Must be greater than `0` and can't exceed the paypoint's configured payout credit limit. expirationDate: type: string description: >- Requested expiration date for the card. If not provided, defaults to 30 days from creation. amount: type: number format: double description: Initial load amount for the card. Defaults to `0`. maxNumberOfUses: type: integer description: >- Maximum number of times the card can be used. If `0` or negative, defaults to `9999`. Ignored and set to `1` when `exactAmount` is `true`. exactAmount: type: boolean description: >- When `true`, restricts the card to a single use. `maxNumberOfUses` is automatically set to `1` regardless of any other value provided. expenseLimitPeriod: type: string description: >- Time period over which `expenseLimit` applies (for example, `monthly` or `weekly`). No server-side enforcement. billingCycle: type: string description: Billing cycle identifier. billingCycleDay: type: string description: Day within the billing cycle. dailyTransactionCount: type: integer description: >- Maximum number of transactions allowed per day. Defaults to `0` (unlimited). dailyAmountLimit: type: number format: double description: >- Maximum total spend allowed per day. Defaults to `0` (unlimited). transactionAmountLimit: type: integer description: >- Maximum spend allowed per single transaction. Defaults to `0` (unlimited). mcc: type: string description: >- Merchant Category Code to restrict where the card can be used. Must be a valid MCC if provided. tcc: type: string description: >- Transaction Category Code to restrict where the card can be used. Must be a valid TCC if provided. misc1: type: string description: Custom metadata field. Stored on the card record. misc2: type: string description: Custom metadata field. Stored on the card record. required: - vendorId - expenseLimit servers: - url: https://api-sandbox.payabli.com/api - url: https://api.payabli.com/api components: schemas: type_:Entry: type: string description: >- The entity's entrypoint identifier. [Learn more](/developers/api-reference/api-overview#entrypoint-vs-entry) title: Entry type_:IsSuccess: type: boolean description: >- Boolean indicating whether the operation was successful. A `true` value indicates success. A `false` value indicates failure. title: IsSuccess type_:ResponseText: type: string description: 'Response text for operation: ''Success'' or ''Declined''.' title: ResponseText type_:ResultCode: type: integer description: >- Result code for the operation. Value 1 indicates a successful operation, values 2 and 3 indicate errors. A value of 10 indicates that an operation has been initiated and is pending. title: ResultCode type_:Resulttext: type: string description: >- Text describing the result. If `ResultCode` = 1, will return 'Approved' or a general success message. If `ResultCode`` = 2 or 3, will contain the cause of the error or decline. title: Resulttext type_ghostCard:CreateGhostCardResponseData: type: object properties: ReferenceId: type: string description: >- Card token for the ghost card. Use this value to reference the card in subsequent operations (update, cancel, etc.). ResultCode: $ref: '#/components/schemas/type_:ResultCode' ResultText: $ref: '#/components/schemas/type_:Resulttext' title: CreateGhostCardResponseData type_ghostCard:CreateGhostCardResponse: type: object properties: isSuccess: $ref: '#/components/schemas/type_:IsSuccess' responseText: $ref: '#/components/schemas/type_:ResponseText' responseData: $ref: '#/components/schemas/type_ghostCard:CreateGhostCardResponseData' required: - responseText description: Response for creating a ghost card. title: CreateGhostCardResponse type_:Responsedata: type: object additionalProperties: description: Any type description: The object containing the response data. title: Responsedata type_:PayabliApiResponse: type: object properties: isSuccess: $ref: '#/components/schemas/type_:IsSuccess' responseData: $ref: '#/components/schemas/type_:Responsedata' responseText: $ref: '#/components/schemas/type_:ResponseText' required: - responseText title: PayabliApiResponse securitySchemes: ApiKeyAuth: type: apiKey in: header name: requestToken ``` ## SDK Code Examples ```typescript CreateGhostCard import { PayabliClient } from "@payabli/sdk-node"; async function main() { const client = new PayabliClient({ apiKey: "YOUR_API_KEY_HERE", }); await client.ghostCard.createGhostCard("8cfec2e0fa", { vendorId: 42, expenseLimit: 500, maxNumberOfUses: 3, exactAmount: false, expenseLimitPeriod: "monthly", billingCycle: "monthly", billingCycleDay: "1", dailyTransactionCount: 5, dailyAmountLimit: 200, transactionAmountLimit: 100, mcc: "5411", tcc: "R", misc1: "PO-98765", misc2: "Dept-Finance", }); } main(); ``` ```python CreateGhostCard from payabli import payabli client = payabli( api_key="YOUR_API_KEY_HERE", ) client.ghost_card.create_ghost_card( entry="8cfec2e0fa", vendor_id=42, expense_limit=500, max_number_of_uses=3, exact_amount=False, expense_limit_period="monthly", billing_cycle="monthly", billing_cycle_day="1", daily_transaction_count=5, daily_amount_limit=200, transaction_amount_limit=100, mcc="5411", tcc="R", misc_1="PO-98765", misc_2="Dept-Finance", ) ``` ```csharp CreateGhostCard using PayabliPayabliApi; using System.Threading.Tasks; namespace Usage; public class Example { public async Task Do() { var client = new PayabliPayabliApiClient( apiKey: "YOUR_API_KEY_HERE" ); await client.GhostCard.CreateGhostCardAsync( "8cfec2e0fa", new CreateGhostCardRequestBody { VendorId = 42L, ExpenseLimit = 500, MaxNumberOfUses = 3, ExactAmount = false, ExpenseLimitPeriod = "monthly", BillingCycle = "monthly", BillingCycleDay = "1", DailyTransactionCount = 5, DailyAmountLimit = 200, TransactionAmountLimit = 100, Mcc = "5411", Tcc = "R", Misc1 = "PO-98765", Misc2 = "Dept-Finance" } ); } } ``` ```go CreateGhostCard package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api-sandbox.payabli.com/api/MoneyOutCard/GhostCard/8cfec2e0fa" payload := strings.NewReader("{\n \"vendorId\": 42,\n \"expenseLimit\": 500,\n \"maxNumberOfUses\": 3,\n \"exactAmount\": false,\n \"expenseLimitPeriod\": \"monthly\",\n \"billingCycle\": \"monthly\",\n \"billingCycleDay\": \"1\",\n \"dailyTransactionCount\": 5,\n \"dailyAmountLimit\": 200,\n \"transactionAmountLimit\": 100,\n \"mcc\": \"5411\",\n \"tcc\": \"R\",\n \"misc1\": \"PO-98765\",\n \"misc2\": \"Dept-Finance\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("requestToken", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby CreateGhostCard require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/MoneyOutCard/GhostCard/8cfec2e0fa") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["requestToken"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"vendorId\": 42,\n \"expenseLimit\": 500,\n \"maxNumberOfUses\": 3,\n \"exactAmount\": false,\n \"expenseLimitPeriod\": \"monthly\",\n \"billingCycle\": \"monthly\",\n \"billingCycleDay\": \"1\",\n \"dailyTransactionCount\": 5,\n \"dailyAmountLimit\": 200,\n \"transactionAmountLimit\": 100,\n \"mcc\": \"5411\",\n \"tcc\": \"R\",\n \"misc1\": \"PO-98765\",\n \"misc2\": \"Dept-Finance\"\n}" response = http.request(request) puts response.read_body ``` ```java CreateGhostCard import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api-sandbox.payabli.com/api/MoneyOutCard/GhostCard/8cfec2e0fa") .header("requestToken", "") .header("Content-Type", "application/json") .body("{\n \"vendorId\": 42,\n \"expenseLimit\": 500,\n \"maxNumberOfUses\": 3,\n \"exactAmount\": false,\n \"expenseLimitPeriod\": \"monthly\",\n \"billingCycle\": \"monthly\",\n \"billingCycleDay\": \"1\",\n \"dailyTransactionCount\": 5,\n \"dailyAmountLimit\": 200,\n \"transactionAmountLimit\": 100,\n \"mcc\": \"5411\",\n \"tcc\": \"R\",\n \"misc1\": \"PO-98765\",\n \"misc2\": \"Dept-Finance\"\n}") .asString(); ``` ```php CreateGhostCard request('POST', 'https://api-sandbox.payabli.com/api/MoneyOutCard/GhostCard/8cfec2e0fa', [ 'body' => '{ "vendorId": 42, "expenseLimit": 500, "maxNumberOfUses": 3, "exactAmount": false, "expenseLimitPeriod": "monthly", "billingCycle": "monthly", "billingCycleDay": "1", "dailyTransactionCount": 5, "dailyAmountLimit": 200, "transactionAmountLimit": 100, "mcc": "5411", "tcc": "R", "misc1": "PO-98765", "misc2": "Dept-Finance" }', 'headers' => [ 'Content-Type' => 'application/json', 'requestToken' => '', ], ]); echo $response->getBody(); ``` ```swift CreateGhostCard import Foundation let headers = [ "requestToken": "", "Content-Type": "application/json" ] let parameters = [ "vendorId": 42, "expenseLimit": 500, "maxNumberOfUses": 3, "exactAmount": false, "expenseLimitPeriod": "monthly", "billingCycle": "monthly", "billingCycleDay": "1", "dailyTransactionCount": 5, "dailyAmountLimit": 200, "transactionAmountLimit": 100, "mcc": "5411", "tcc": "R", "misc1": "PO-98765", "misc2": "Dept-Finance" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/MoneyOutCard/GhostCard/8cfec2e0fa")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```