> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.simplificagestao.com.br/llms.txt.
> For full documentation content, see https://docs.simplificagestao.com.br/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.simplificagestao.com.br/_mcp/server.

# Gerar venda a partir da oportunidade

POST https://gestao.simplificagestao.com.br/ords/gestao/simplificav2/oportunidade/{id}/venda
Content-Type: application/json

Cria uma venda em aberto a partir de uma oportunidade ativa e pendente.

Regras:
- a oportunidade precisa estar ativa e pendente;
- a venda nasce com os itens ativos da oportunidade;
- você pode enviar pagamentos junto com a geração da venda;
- o total dos pagamentos não pode ser maior que o total da venda;
- a rota gera a venda, mas não finaliza a venda automaticamente.

Exemplo de uso:
```http
POST {{base_url}}/simplificav2/oportunidade/29627/venda
Authorization: Bearer {{bearer_token}}
Content-Type: application/json

{
  "data_venda": "2026-04-06",
  "data_previsao_entrega": "2026-04-10",
  "pagamentos": [
    {
      "forma_pagamento_id": 3,
      "numero_parcela": 1,
      "valor_parcela": 1400,
      "data_vencimento": "2026-04-06"
    }
  ]
}
```


Reference: https://docs.simplificagestao.com.br/api-reference/comercial/oportunidades/create-venda-from-oportunidade

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: openapi-simplifica
  version: 1.0.0
paths:
  /simplificav2/oportunidade/{id}/venda:
    post:
      operationId: create-venda-from-oportunidade
      summary: Gerar venda a partir da oportunidade
      description: |
        Cria uma venda em aberto a partir de uma oportunidade ativa e pendente.

        Regras:
        - a oportunidade precisa estar ativa e pendente;
        - a venda nasce com os itens ativos da oportunidade;
        - você pode enviar pagamentos junto com a geração da venda;
        - o total dos pagamentos não pode ser maior que o total da venda;
        - a rota gera a venda, mas não finaliza a venda automaticamente.

        Exemplo de uso:
        ```http
        POST {{base_url}}/simplificav2/oportunidade/29627/venda
        Authorization: Bearer {{bearer_token}}
        Content-Type: application/json

        {
          "data_venda": "2026-04-06",
          "data_previsao_entrega": "2026-04-10",
          "pagamentos": [
            {
              "forma_pagamento_id": 3,
              "numero_parcela": 1,
              "valor_parcela": 1400,
              "data_vencimento": "2026-04-06"
            }
          ]
        }
        ```
      tags:
        - subpackage_comercial
      parameters:
        - name: id
          in: path
          description: Identificador da oportunidade.
          required: true
          schema:
            type: integer
        - name: Authorization
          in: header
          description: |
            Token privado usado para consultar dados da plataforma.

            Como usar:
            - obtenha o token privado da sua empresa;
            - envie `Authorization: Bearer SEU_TOKEN_PRIVADO`;
            - não use `x-api-key` neste módulo.
          required: true
          schema:
            type: string
      responses:
        '201':
          description: Venda gerada com sucesso.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WriteIdSuccessResponse'
        '400':
          description: Corpo JSON inválido.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FollowUpWriteErrorResponse'
        '401':
          description: Token ausente, inválido ou sem empresa associada.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FollowUpWriteErrorResponse'
        '404':
          description: Recurso não encontrado no escopo da empresa autenticada.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FollowUpWriteErrorResponse'
        '409':
          description: >-
            O estado atual do recurso ou o valor informado não permitem a
            operação solicitada.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FollowUpWriteErrorResponse'
        '422':
          description: Requisição válida em JSON, mas com regra funcional inválida.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FollowUpWriteErrorResponse'
        '500':
          description: Erro interno inesperado ao executar a operação.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FollowUpWriteErrorResponse'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OportunidadeVendaCreateRequest'
servers:
  - url: https://gestao.simplificagestao.com.br/ords/gestao
  - url: >-
      https://gd341ff411ca4b6-dbdevsimplificav2.adb.sa-saopaulo-1.oraclecloudapps.com/ords/gestao
components:
  schemas:
    VendaPagamentoWrite:
      type: object
      properties:
        forma_pagamento_id:
          type: integer
          description: >-
            Identificador da forma de pagamento ativa. Use os IDs publicados em
            `GET /simplificav2/tipo_pagamento`.
        numero_parcela:
          type: integer
          description: Número da parcela.
        valor_parcela:
          type: number
          format: double
          description: Valor da parcela.
        data_vencimento:
          type: string
          description: Data de vencimento da parcela no formato `YYYY-MM-DD`.
        bandeira_cartao:
          type:
            - string
            - 'null'
          description: >-
            Bandeira do cartão quando a forma de pagamento exigir essa
            informação.
      required:
        - forma_pagamento_id
        - numero_parcela
        - valor_parcela
        - data_vencimento
      title: VendaPagamentoWrite
    OportunidadeVendaCreateRequest:
      type: object
      properties:
        data_venda:
          type:
            - string
            - 'null'
          description: Data da venda no formato `YYYY-MM-DD`.
        data_previsao_entrega:
          type:
            - string
            - 'null'
          description: Data prevista de entrega no formato `YYYY-MM-DD`.
        endereco_entrega_id:
          type:
            - integer
            - 'null'
          description: Endereço de entrega da venda gerada.
        observacao:
          type:
            - string
            - 'null'
          description: Observação visível no documento da venda.
        observacao_interna:
          type:
            - string
            - 'null'
          description: Observação interna da venda.
        vl_acrescimo:
          type:
            - number
            - 'null'
          format: double
          description: Valor adicional aplicado à venda gerada.
        vl_frete:
          type:
            - number
            - 'null'
          format: double
          description: Valor de frete aplicado à venda gerada.
        pagamentos:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/VendaPagamentoWrite'
          description: Lista opcional de pagamentos iniciais da venda gerada.
      title: OportunidadeVendaCreateRequest
    WriteIdData:
      type: object
      properties:
        id:
          type: integer
      required:
        - id
      title: WriteIdData
    WriteIdSuccessResponse:
      type: object
      properties:
        status:
          type: string
        mensagem:
          type: string
        data:
          $ref: '#/components/schemas/WriteIdData'
      required:
        - status
        - mensagem
        - data
      title: WriteIdSuccessResponse
    FollowUpWriteErrorResponse:
      type: object
      properties:
        status:
          type: string
        codigo:
          type: string
        mensagem:
          type: string
      required:
        - status
        - codigo
        - mensagem
      title: FollowUpWriteErrorResponse
  securitySchemes:
    SimplificaPrivateBearer:
      type: http
      scheme: bearer
      description: |
        Token privado usado para consultar dados da plataforma.

        Como usar:
        - obtenha o token privado da sua empresa;
        - envie `Authorization: Bearer SEU_TOKEN_PRIVADO`;
        - não use `x-api-key` neste módulo.

```

## SDK Code Examples

```python Comercial_createVendaFromOportunidade_example
import requests

url = "https://gestao.simplificagestao.com.br/ords/gestao/simplificav2/oportunidade/1/venda"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Comercial_createVendaFromOportunidade_example
const url = 'https://gestao.simplificagestao.com.br/ords/gestao/simplificav2/oportunidade/1/venda';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Comercial_createVendaFromOportunidade_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://gestao.simplificagestao.com.br/ords/gestao/simplificav2/oportunidade/1/venda"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	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 Comercial_createVendaFromOportunidade_example
require 'uri'
require 'net/http'

url = URI("https://gestao.simplificagestao.com.br/ords/gestao/simplificav2/oportunidade/1/venda")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java Comercial_createVendaFromOportunidade_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://gestao.simplificagestao.com.br/ords/gestao/simplificav2/oportunidade/1/venda")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php Comercial_createVendaFromOportunidade_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://gestao.simplificagestao.com.br/ords/gestao/simplificav2/oportunidade/1/venda', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Comercial_createVendaFromOportunidade_example
using RestSharp;

var client = new RestClient("https://gestao.simplificagestao.com.br/ords/gestao/simplificav2/oportunidade/1/venda");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Comercial_createVendaFromOportunidade_example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://gestao.simplificagestao.com.br/ords/gestao/simplificav2/oportunidade/1/venda")! 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()
```