---
agentTools:
  projectIndex: https://ledgers.readme.io/llms.txt
---

# Add Purchase Invoice

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Production with User Token",
    "version": "3-India"
  },
  "servers": [
    {
      "url": "https://in-api.ledgers.cloud/v3"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "name": "x-api-key",
        "in": "header"
      },
      "sec1": {
        "type": "apiKey",
        "name": "api-token",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "sec0": [],
      "sec1": []
    }
  ],
  "paths": {
    "/purchase-invoice": {
      "post": {
        "summary": "Add Purchase Invoice",
        "description": "",
        "operationId": "add-purchase-invoice",
        "parameters": [
          {
            "name": "api-token",
            "in": "header",
            "description": "Generate token  from authentication api",
            "schema": {
              "type": "string",
              "default": "xyz"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "description": "This will shared  while register",
            "schema": {
              "type": "string",
              "default": "xyz"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "purchase_number": {
                    "type": "integer",
                    "description": "Purchase number in purchase invoice",
                    "format": "int32"
                  },
                  "bill_number": {
                    "type": "string",
                    "description": "Supplier's invoice or bill number"
                  },
                  "pur_inv_date": {
                    "type": "string",
                    "description": "Date of the invoice",
                    "format": "date"
                  },
                  "due_date": {
                    "type": "string",
                    "description": "The payment due date"
                  },
                  "purchase_order_id": {
                    "type": "integer",
                    "description": "0 indicates no linked purchase order",
                    "format": "int32"
                  },
                  "tax_id1_type": {
                    "type": "string",
                    "description": "Tax applicability: - 0: No GST - 1: SGST+CGST - 2: IGST",
                    "enum": [
                      "0",
                      "1",
                      "2"
                    ]
                  },
                  "currency": {
                    "type": "string",
                    "description": "Currency code"
                  },
                  "taxable_amount": {
                    "type": "string",
                    "description": "Sum of all taxable values"
                  },
                  "non_taxable_amount": {
                    "type": "string",
                    "description": "Sum of all non taxable values"
                  },
                  "gst_amount": {
                    "type": "string",
                    "description": "Total gst amount"
                  },
                  "cess_amount": {
                    "type": "string",
                    "description": "CESS applicable under GST"
                  },
                  "adjust_amount": {
                    "type": "string",
                    "description": "Additional adjustments"
                  },
                  "addvalue_amount": {
                    "type": "string",
                    "description": "Additional value amount"
                  },
                  "total_amount": {
                    "type": "string",
                    "description": "Sum of all amounts"
                  },
                  "payable_amount": {
                    "type": "string",
                    "description": "Final amount to be paid"
                  },
                  "reverse_charge": {
                    "type": "string",
                    "description": "1-reverse charge mechanism applied, 0-reverse charge mechanism not applied",
                    "enum": [
                      "0",
                      "1"
                    ]
                  },
                  "spl_supply": {
                    "type": "string",
                    "description": "Type of supply: - 0: Regular - 1: Import - 2: Input service - 3: Composition",
                    "enum": [
                      "0",
                      "1",
                      "2",
                      "3"
                    ]
                  },
                  "basic_custom_duty": {
                    "type": "string"
                  },
                  "counter_duty": {
                    "type": "string"
                  },
                  "counter_duty_add": {
                    "type": "string"
                  },
                  "tax_credit_type": {
                    "type": "string",
                    "description": "GST ITC is claimable (1) or not (0).",
                    "enum": [
                      "0",
                      "1"
                    ]
                  },
                  "gst_tax_credit": {
                    "type": "integer",
                    "description": "Amount eligible for ITC.",
                    "format": "int32"
                  },
                  "status": {
                    "type": "string",
                    "description": "Status-0 for deleted, 1 for active",
                    "enum": [
                      "0",
                      "1"
                    ]
                  },
                  "currency_info": {
                    "type": "array",
                    "items": {
                      "properties": {
                        "currency_rate": {
                          "type": "string"
                        },
                        "currency_default_rate": {
                          "type": "string"
                        },
                        "from": {
                          "type": "string"
                        },
                        "to": {
                          "type": "string"
                        },
                        "converted_amount": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "business_info": {
                    "type": "array",
                    "items": {
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "mobile": {
                          "type": "string"
                        },
                        "logo_url": {
                          "type": "string"
                        },
                        "tax_no": {
                          "type": "string"
                        },
                        "addr1": {
                          "type": "string"
                        },
                        "addr2": {
                          "type": "string"
                        },
                        "city": {
                          "type": "string"
                        },
                        "pincode": {
                          "type": "string"
                        },
                        "state": {
                          "type": "string"
                        },
                        "country": {
                          "type": "string"
                        },
                        "bill_copy_file": {
                          "type": "string"
                        },
                        "pos": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "export_details": {
                    "type": "array",
                    "items": {
                      "properties": {
                        "export_type": {
                          "type": "string"
                        },
                        "export_bill_no": {
                          "type": "string"
                        },
                        "export_bill_date": {
                          "type": "string"
                        },
                        "export_port_code": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "seller_info": {
                    "type": "array",
                    "items": {
                      "properties": {
                        "supplier_id": {
                          "type": "string"
                        },
                        "supplier_name": {
                          "type": "string"
                        },
                        "supplier_business_name": {
                          "type": "string"
                        },
                        "supplier_addr1": {
                          "type": "string"
                        },
                        "supplier_addr2": {
                          "type": "string"
                        },
                        "supplier_city": {
                          "type": "string"
                        },
                        "supplier_pincode": {
                          "type": "string"
                        },
                        "supplier_state": {
                          "type": "string"
                        },
                        "supplier_country": {
                          "type": "string"
                        },
                        "supplier_gstin": {
                          "type": "string"
                        },
                        "business_country": {
                          "type": "string"
                        },
                        "supplier_address_index": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "billing_details": {
                    "type": "array",
                    "items": {
                      "properties": {
                        "bill_company": {
                          "type": "string"
                        },
                        "bill_addr1": {
                          "type": "string"
                        },
                        "bill_addr2": {
                          "type": "string"
                        },
                        "bill_city": {
                          "type": "string"
                        },
                        "bill_pincode": {
                          "type": "string"
                        },
                        "bill_state": {
                          "type": "string"
                        },
                        "bill_country": {
                          "type": "string"
                        },
                        "bill_ship_address_same": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "shipping_details": {
                    "type": "array",
                    "items": {
                      "properties": {
                        "ship_company": {
                          "type": "string"
                        },
                        "ship_addr1": {
                          "type": "string"
                        },
                        "ship_addr2": {
                          "type": "string"
                        },
                        "ship_city": {
                          "type": "string"
                        },
                        "ship_pincode": {
                          "type": "string"
                        },
                        "ship_state": {
                          "type": "string"
                        },
                        "ship_country": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "properties": {
                        "pid": {
                          "type": "string"
                        },
                        "vid": {
                          "type": "string"
                        },
                        "item_name": {
                          "type": "string"
                        },
                        "sku": {
                          "type": "string"
                        },
                        "item_description": {
                          "type": "string"
                        },
                        "item_code": {
                          "type": "string"
                        },
                        "item_type": {
                          "type": "string"
                        },
                        "quantity": {
                          "type": "string"
                        },
                        "rate": {
                          "type": "string"
                        },
                        "price_type": {
                          "type": "string"
                        },
                        "discount": {
                          "type": "string"
                        },
                        "taxable_amt": {
                          "type": "string"
                        },
                        "non_taxable_amt": {
                          "type": "string"
                        },
                        "gst_rate": {
                          "type": "string"
                        },
                        "gst_amt": {
                          "type": "string"
                        },
                        "igst_amt": {
                          "type": "string"
                        },
                        "igst_rate": {
                          "type": "string"
                        },
                        "sgst_amt": {
                          "type": "string"
                        },
                        "sgst_rate": {
                          "type": "string"
                        },
                        "cgst_amt": {
                          "type": "string"
                        },
                        "cgst_rate": {
                          "type": "string"
                        },
                        "cess_amt": {
                          "type": "string"
                        },
                        "cess_per": {
                          "type": "string"
                        },
                        "cess_type": {
                          "type": "string"
                        },
                        "item_total_amt": {
                          "type": "string"
                        },
                        "sale_customer_id": {
                          "type": "string"
                        },
                        "sale_customer_name": {
                          "type": "string"
                        },
                        "expense_type": {
                          "type": "string"
                        },
                        "expense_id": {
                          "type": "string"
                        },
                        "units": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "converted_amount": {
                          "type": "string"
                        },
                        "extra_field": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n    \"status\": 200,\n    \"id\": 2970,\n    \"msg\": \"Purchase Invoice Created Successfully\",\n    \"download_url\": \"https://in.ledgers.cloud/public/download-purchase-invoice/S0J2cVV2Um9zRHp2UHpBUG9TTDZFdz09/RXJlbUxtQTgzSGFJdTErNmJBSVNOUT09\",\n    \"pdf_url\": \"https://in.ledgers.cloud/public/purchase-invoice/S0J2cVV2Um9zRHp2UHpBUG9TTDZFdz09/RXJlbUxtQTgzSGFJdTErNmJBSVNOUT09\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "example": 200,
                      "default": 0
                    },
                    "id": {
                      "type": "integer",
                      "example": 2970,
                      "default": 0
                    },
                    "msg": {
                      "type": "string",
                      "example": "Purchase Invoice Created Successfully"
                    },
                    "download_url": {
                      "type": "string",
                      "example": "https://in.ledgers.cloud/public/download-purchase-invoice/S0J2cVV2Um9zRHp2UHpBUG9TTDZFdz09/RXJlbUxtQTgzSGFJdTErNmJBSVNOUT09"
                    },
                    "pdf_url": {
                      "type": "string",
                      "example": "https://in.ledgers.cloud/public/purchase-invoice/S0J2cVV2Um9zRHp2UHpBUG9TTDZFdz09/RXJlbUxtQTgzSGFJdTErNmJBSVNOUT09"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "The request was unacceptable, often due to missing a required parameter."
                  }
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"errorCode\": \"E0401\",\n  \"errorMessage\": \"x-API-key or API-token authentication failed. Contact LEDGERS Developer Support.\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "errorCode": {
                      "type": "string",
                      "example": "E0401"
                    },
                    "errorMessage": {
                      "type": "string",
                      "example": "x-API-key or API-token authentication failed. Contact LEDGERS Developer Support."
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"errorCode\": \"E0403\",\n  \"errorMessage\": \"The API key doesn't have permission to perform the request. Contact LEDGERS Developer Support\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "errorCode": {
                      "type": "string",
                      "example": "E0403"
                    },
                    "errorMessage": {
                      "type": "string",
                      "example": "The API key doesn't have permission to perform the request. Contact LEDGERS Developer Support"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "Something went wrong on Ledgers end."
                  }
                }
              }
            }
          },
          "501": {
            "description": "501",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "Something went wrong on Ledgers end."
                  }
                }
              }
            }
          },
          "502": {
            "description": "502",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "Something went wrong on Ledgers end."
                  }
                }
              }
            }
          },
          "503": {
            "description": "503",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "Something went wrong on Ledgers end."
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "673ef64e825a22001fb16a5f:673ef64e825a22001fb16a93"
}
```