Skip to content

Plantillas

Get HTML Template by ID

Permite obtener los datos de una plantilla.

http
GET /api/template/get/:id

Regresará un objeto Plantilla

Request

bash
curl -X GET -H "X-eFirma-Auth: {"uid":"SU USER ID OBTENIDO DE LA PLATAFORMA","key":"SU API KEY DE LA PLATAFORMA"}" "https://efirma.com/api/template/get/:id"
http
GET %7B%7Befirma_url%7D%7D/api/template/get/:id HTTP/1.1
    Host:
    X-eFirma-Auth: {"uid":"SU USER ID OBTENIDO DE LA PLATAFORMA","key":"SU API KEY DE LA PLATAFORMA"}

Response

json
{
"id": "XXXXXXXX",
"ref": "Demo Plantilla",
"custom_fields": [
    {
        "name": "campo_opcion_mulitple",
        "fname": "¿Cual es la pregunta a contestar con opción múltiple?",
        "type": "multiple",
        "Choices": [
            "Opción 1",
            "Opción 2",
            "Opción 3",
            "Opción 4"
        ]
    },
    {
        "name": "campo_texto",
        "fname": "¿Que quieres mostrar en la forma de llenado de plantilla?",
        "type": "string",
        "Choices": null
    }
],
"autosigner": []
    }

List HTML Templates

INFO

Permite obtener una lista de objectos del tipo Plantilla a las cuales tienes acceso en la cuenta.

http
GET /api/template/get_all

Request

bash
curl -X GET -H "X-eFirma-Auth: {"uid":"SU USER ID OBTENIDO DE LA PLATAFORMA","key":"SU API KEY DE LA PLATAFORMA"}" "https://efirma.com/api/template/get_all"
http
GET %7B%7Befirma_url%7D%7D/api/template/get_all HTTP/1.1
    Host:
    X-eFirma-Auth: {"uid":"SU USER ID OBTENIDO DE LA PLATAFORMA","key":"SU API KEY DE LA PLATAFORMA"}

Response

json
[
{
    "id": "5dd8b9xxxxxxxx69f76",
    "ref": "Hello World",
    "custom_fields": [
        {
            "name": "test",
            "fname": "test",
            "type": "string"
        },
        {
            "name": "newtest",
            "fname": "New Test",
            "type": "string"
        }
    ]
},
{
    "id": "5dd8b957xxxxxxxxxxd12",
    "ref": "Hello World 2",
    "custom_fields": [
        {
            "name": "test",
            "fname": "test",
            "type": "string"
        },
        {
            "name": "newtest",
            "fname": "New Test",
            "type": "string"
        }
    ]
}
    ]

Create Doc from HTML Template

Permite generar un documento PDF en nuestros sistemas para su firmado, los parametros deben venir en el BODY con un Header del tipo application/json.

http
POST /api/template
NombreTipo de DatoDescripción
idStringEl identificador de la plantilla que se utilizará para generar el documento.
titleStringEl nombre con el cual se creará el documento.
descStringDescripción del documento que se agregará en la nota de invitación enviada a los usuarios por correo electrónico.
signature_typeIntEspecifica el tipo de firma electrónica a utilizar dentro del documento. 1 = Avanzada, 2 = Autógrafa Digital.
users[ ]UsersLista de objetos User con permisos en el documento.
sidreqBool (Opcional)En caso de ser verdadero, solicitará a los firmantes su Identificación Oficial.
send_mailsBoolSi es falso, no se enviarán correos de invitación a los usuarios.
idcard_requiredBool (Opcional)Si es verdadero, requiere identificación anexa para firmar.
allowed_idsAllowedIds (Opc)Arreglo indexado de identificaciones permitidas. Ejemplo: { "idcard": true, "passport": false, ... }
geo_requiredBool (Opcional)Si es verdadero, requiere geolocalización para firmar.
sms_requiredBool (Opcional)Si es verdadero, requiere validar el número de celular del firmante. Solo válido para Firma Autógrafa Digital.
expiry_inInt (Opcional)Plazo para la celebración del contrato (1-90 días, default 30).
callback_urlString (Opcional)URL para notificar acciones sobre el documento.
return_urlString (Opcional)URL para redirigir al usuario tras firmar.
reject_urlString (Opcional)URL para redirigir al usuario si rechaza el documento.
custom_fieldsJSONObjectObjeto JSON con los campos personalizados.
snippets[]JSONObjectArreglo de objetos JSON.

Request

bash
curl -X POST -H "Content-Type: application/json" -H "Accept-Encoding: application/json" -H "X-eFirma-Auth: {"uid":"SU USER ID OBTENIDO DE LA PLATAFORMA","key":"SU API KEY DE LA PLATAFORMA"}" -d '{
"id": "XXXXXXXXX",
"title": "Documento 1",
"desc": "This is a test made thru the API to check on the template creation",
"users": [
    {
        "email": "usuario@correo.com",
        "type": "signer"
        "sidreq":false

    }
],
"custom_fields":
    {
        "string_test":"David Gutierrez",
        "test_multiple":"1,2"
    }
,
"send_mails": false,
"signature_type": 2,
"idcard_required": true,
"geo_required": false,
"sms_required": false,
"allowed_ids": {
    "idcard": true,
    "passport": false,
    "fmcard": true
},
"callback_url": "https://callback.example.com",
"return_url": "https://example.com",
"reject_url": "https://example.com/reject",
"expiry_in": 30
}' "https://efirma.com/api/template/"
http
POST %7B%7Befirma_url%7D%7D/api/template/ HTTP/1.1
Host:
Content-Type: application/json
Accept-Encoding: application/json
X-eFirma-Auth: {"uid":"SU USER ID OBTENIDO DE LA PLATAFORMA","key":"SU API KEY DE LA PLATAFORMA"}
{
    "id": "XXXXXXXXX",
    "title": "Documento 1",
    "desc": "This is a test made thru the API to check on the template creation",
    "users": [
        {
            "email": "usuario@correo.com",
            "type": "signer"
            "sidreq":false

        }
    ],
    "custom_fields":
        {
            "string_test":"David Gutierrez",
            "test_multiple":"1,2"
        }
    ,
"snippets": [
        {
            "name": "prod",
            "custom_fields": [
                {
                    "name": "snippet_name",
                    "custom_fields": [  //Agregar tantos objetos como queramos que se repita el snippet.
                        {
                            "variable_snippet1": "valor",
                            "variable_snippet2": "valor"
                        },
                        {
                            "variable_snippet1": "valor",
                            "variable_snippet2": "valor"
                        },
                        {
                            "variable_snippet1": "valor",
                            "variable_snippet2": "valor"
                        }
                    ]
                }
    ],
    "send_mails": false,
    "signature_type": 2,
    "idcard_required": true,
    "geo_required": false,
    "sms_required": false,
    "allowed_ids": {
        "idcard": true,
        "passport": false,
        "fmcard": true
    },
    "callback_url": "https://callback.example.com",
    "return_url": "https://example.com",
    "reject_url": "https://example.com/reject",
    "expiry_in": 30
}

Response

json
    {
    "id": "5e41dd35aa4xxxxx10db52f7"
    }
json
{
        "message": "The API User does not have a specified role in the document",
        "status": "error"
}

Upload PDFTemplate

Permite crear/subir un documento a nuestros sistemas para su firmado, el contenido debe venir en un multipart/form-data y los parametros en formato JSON dentro de un campo con nombre “data”.

html
POST /api/document/
NombreTipo de DatoDescripción
nameStringNombre del documento.
auto_signers[]Auto_SignersArreglo de autofirmantes [{"email":"example@example.com"}, ...]

TIP

Regresa un JSON con el “id” del documento creado

bash
curl -X POST -H "Content-Type: multipart/form-data" -H "X-eFirma-Auth: {"uid":"SU USER ID OBTENIDO DE LA PLATAFORMA","key":"SU API KEY DE LA PLATAFORMA"}" "https://efirma.com/api/pdftemplate"
html
POST %7B%7Befirma_url%7D%7D/api/pdftemplate HTTP/1.1
    Host:
    Content-Type: multipart/form-data
    X-eFirma-Auth: {"uid":"SU USER ID OBTENIDO DE LA PLATAFORMA","key":"SU API KEY DE LA PLATAFORMA"}

Response

json
{
    "id": "xxxxxxxxxxxx",
    "title": "API Template Title",
    "custom_fields": [
        {
            "name": "num_clie",
            "fname": "num_clie",
            "type": "string"
        },
        {
            "name": "tip_clie",
            "fname": "tip_clie",
            "type": "string"
        },
        {
            "name": "tip_prod",
            "fname": "tip_prod",
            "type": "string"
        },
        {
            "name": "pf_pm",
            "fname": "pf_pm",
            "type": "string"
        },
        {
            "name": "num_cod_copp",
            "fname": "num_cod_copp",
            "type": "string"
        },
        {
            "name": "raz_soc",
            "fname": "raz_soc",
            "type": "string"
        },
        {
            "name": "rfc",
            "fname": "rfc",
            "type": "string"
        },
        {
            "name": "dom_fisc_col",
            "fname": "dom_fisc_col",
            "type": "string"
        },
        {
            "name": "dom_fis_calle_y_num",
            "fname": "dom_fis_calle_y_num",
            "type": "string"
        },
        {
            "name": "dom_fisc_cp",
            "fname": "dom_fisc_cp",
            "type": "string"
        },
        {
            "name": "dom_fisc_ef",
            "fname": "dom_fisc_ef",
            "type": "string"
        },
        {
            "name": "dom_fisc_mun",
            "fname": "dom_fisc_mun",
            "type": "string"
        },
        {
            "name": "tel",
            "fname": "tel",
            "type": "string"
        },
        {
            "name": "num_esc_pub",
            "fname": "num_esc_pub",
            "type": "string"
        },
        {
            "name": "num_ntaria",
            "fname": "num_ntaria",
            "type": "string"
        },
        {
            "name": "rppyc",
            "fname": "rppyc",
            "type": "string"
        },
        {
            "name": "fech_const",
            "fname": "fech_const",
            "type": "string"
        },
        {
            "name": "fecha_rppyc",
            "fname": "fecha_rppyc",
            "type": "string"
        },
        {
            "name": "nom_rl",
            "fname": "nom_rl",
            "type": "string"
        },
        {
            "name": "poder_rl",
            "fname": "poder_rl",
            "type": "string"
        },
        {
            "name": "num_not_rl",
            "fname": "num_not_rl",
            "type": "string"
        },
        {
            "name": "fecha_rl",
            "fname": "fecha_rl",
            "type": "string"
        },
        {
            "name": "nom_not_pub",
            "fname": "nom_not_pub",
            "type": "string"
        },
        {
            "name": "com_cli_1",
            "fname": "com_cli_1",
            "type": "string"
        },
        {
            "name": "com_cli_2",
            "fname": "com_cli_2",
            "type": "string"
        },
        {
            "name": "com_cli_3",
            "fname": "com_cli_3",
            "type": "string"
        },
        {
            "name": "com_cli_4",
            "fname": "com_cli_4",
            "type": "string"
        },
        {
            "name": "com_cli_5",
            "fname": "com_cli_5",
            "type": "string"
        },
        {
            "name": "cost_lic_intg1",
            "fname": "cost_lic_intg1",
            "type": "string"
        },
        {
            "name": "cost_lic_intg2",
            "fname": "cost_lic_intg2",
            "type": "string"
        },
        {
            "name": "per_lic_intg1",
            "fname": "per_lic_intg1",
            "type": "string"
        }
    ],
    "auto_signers": [
        {
            "Id": "xxxxxxxxxxxxxxxxxxxx",
            "email": "test@efirma.com",
            "SignatureId": ""
        },
        {
            "Id": "xxxxxxxxxxxxxxxxxxxx",
            "email": "test@efirma.com",
            "SignatureId": ""
        }
    ]
}

Fill PDFTemplate

Permite generar un documento PDF a partir de una plantilla PDF para su firmado, los parametros deben venir en el BODY con un Header del tipo application/json.

http
POST /api/pdftemplate/fill
NombreTipo de DatoDescripción
idStringEl identificador de la plantilla que se utilizará para generar el documento.
titleStringEl nombre con el cual se creará el documento.
descStringDescripción del documento que se agregará en la nota de invitación enviada a los usuarios por correo electrónico.
signature_typeIntEspecifica el tipo de firma electrónica a utilizar dentro del documento. 1 = Avanzada, 2 = Autógrafa Digital.
users[ ]UsersLista de objetos User con permisos en el documento.
sidreBool (Opcional)En caso de ser verdadero, solicitará a los firmantes su Identificación Oficial.
send_mailsBoolSi es falso, no se enviarán correos de invitación a los usuarios.
idcard_requiredBool (Opcional)Si es verdadero, requiere identificación anexa para firmar.
allowed_idsAllowedIds (Opc)Arreglo indexado de identificaciones permitidas. Ejemplo: { "idcard": true, "passport": false, ... }
geo_requiredBool (Opcional)Si es verdadero, requiere geolocalización para firmar.
sms_requiredBool (Opcional)Si es verdadero, requiere validar el número de celular del firmante. Solo válido para Firma Autógrafa Digital.
expiry_inInt (Opcional)Plazo para la celebración del contrato (1-90 días, default 30).
callback_urlString (Opcional)URL para notificar acciones sobre el documento.
return_urlString (Opcional)URL para redirigir al usuario tras firmar.
reject_urlString (Opcional)URL para redirigir al usuario si rechaza el documento.
custom_fieldsJSONObjectObjeto JSON con los campos personalizados.
bash
curl -X POST -H "Content-Type: application/json" -H "Accept-Encoding: application/json" -H "X-eFirma-Auth: {"uid":"SU USER ID OBTENIDO DE LA PLATAFORMA","key":"SU API KEY DE LA PLATAFORMA"}" -d '{
        "id": "xxxxxxxxxxxx",
        "title": "Documento",
        "desc": "This is a test made thru the API to check on the template creation",
        "users": [
            {
                "email": "usuario@correo.com",
                "type": "signer"
                "sidreq":false

            }
        ],
        "custom_fields":
            {
               "num_clie":"test",
                    "tip_clie":"test",
                    "tip_prod":"test",
                    "pf_pm":"test",
                    "num_cod_copp":"test",
                    "raz_soc":"test",
                    "rfc":"test",
                    "dom_fisc_col":"test",
                    "dom_fis_calle_y_num":"test",
                    "dom_fisc_cp":"test",
                    "dom_fisc_ef":"test",
                    "dom_fisc_mun":"test",
                    "tel":"test",
                    "num_esc_pub":"test",
                    "num_ntaria":"test",
                    "rppyc":"test",
                    "fech_const":"test",
                    "fecha_rppyc":"test",
                    "nom_rl":"test",
                    "poder_rl":"test",
                    "num_not_rl":"test",
                    "fecha_rl":"test",
                    "nom_not_pub":"test",
                    "com_cli_1":"test",
                    "com_cli_2":"test",
                    "com_cli_3":"test",
                    "com_cli_4":"test",
                    "com_cli_5":"test",
                    "cost_lic_intg1":"test",
                    "cost_lic_intg2":"test",
                    "per_lic_intg1":"test"
            }
        ,
        "send_mails": false,
        "signature_type": 2,
        "idcard_required": false,
        "geo_required": false,
        "sms_required": false,
        "allowed_ids": {
            "idcard": false,
            "passport": false,
            "fmcard": false
        },
        "callback_url": "https://callback.example.com",
        "return_url": "https://example.com",
        "reject_url": "https://example.com/reject",
        "expiry_in": 30
    }' "https://efirma.com/api/pdftemplate/fill"
http
POST %7B%7Befirma_url%7D%7D/api/pdftemplate/fill HTTP/1.1
    Host:
    Content-Type: application/json
    Accept-Encoding: application/json
    X-eFirma-Auth: {"uid":"SU USER ID OBTENIDO DE LA PLATAFORMA","key":"SU API KEY DE LA PLATAFORMA"}
    {
        "id": "xxxxxxxxxxxx",
        "title": "Documento",
        "desc": "This is a test made thru the API to check on the template creation",
        "users": [
            {
                "email": "usuario@correo.com",
                "type": "signer"
                "sidreq":false

            }
        ],
        "custom_fields":
            {
               "num_clie":"test",
                    "tip_clie":"test",
                    "tip_prod":"test",
                    "pf_pm":"test",
                    "num_cod_copp":"test",
                    "raz_soc":"test",
                    "rfc":"test",
                    "dom_fisc_col":"test",
                    "dom_fis_calle_y_num":"test",
                    "dom_fisc_cp":"test",
                    "dom_fisc_ef":"test",
                    "dom_fisc_mun":"test",
                    "tel":"test",
                    "num_esc_pub":"test",
                    "num_ntaria":"test",
                    "rppyc":"test",
                    "fech_const":"test",
                    "fecha_rppyc":"test",
                    "nom_rl":"test",
                    "poder_rl":"test",
                    "num_not_rl":"test",
                    "fecha_rl":"test",
                    "nom_not_pub":"test",
                    "com_cli_1":"test",
                    "com_cli_2":"test",
                    "com_cli_3":"test",
                    "com_cli_4":"test",
                    "com_cli_5":"test",
                    "cost_lic_intg1":"test",
                    "cost_lic_intg2":"test",
                    "per_lic_intg1":"test"
            }
        ,
        "send_mails": false,
        "signature_type": 2,
        "idcard_required": false,
        "geo_required": false,
        "sms_required": false,
        "allowed_ids": {
            "idcard": false,
            "passport": false,
            "fmcard": false
        },
        "callback_url": "https://callback.example.com",
        "return_url": "https://example.com",
        "reject_url": "https://example.com/reject",
        "expiry_in": 30
    }

Response

json

Status	200 OK
{
    "id": "xxxxxxxxxxxx",
    "users": [
        {
            "email": "test@efirma.com",
            "iframe_url": "https://efirma.com/frame/verify/doc?doc=xxxxxxxx&at=xxxxxxxxxxxx&ae=xxxxxxxxxxxx",
            "token": "xxxx-xxxx",
            "type": "signer"
        }
    ]
}

Get PDF Template by ID

INFO

Permite obtener los datos de una plantilla.

http
GET /api/pdftemplate/get/:id

INFO

Regresará un objeto Plantilla

bash
curl -X GET -H "X-eFirma-Auth: {"uid":"SU USER ID OBTENIDO DE LA PLATAFORMA","key":"SU API KEY DE LA PLATAFORMA"}" "https://efirma.com/api/pdftemplate/get/:id"
http
GET %7B%7Befirma_url%7D%7D/api/pdftemplate/get/:id HTTP/1.1
    Host:
    X-eFirma-Auth: {"uid":"SU USER ID OBTENIDO DE LA PLATAFORMA","key":"SU API KEY DE LA PLATAFORMA"}

List PDF Templates

Permite obtener una lista de objectos del tipo Plantilla a las cuales tienes acceso en la cuenta.

http
GET /api/template/get_all
bash
curl -X GET -H "X-eFirma-Auth: {"uid":"SU USER ID OBTENIDO DE LA PLATAFORMA","key":"SU API KEY DE LA PLATAFORMA"}" "https://efirma.com/api/pdftemplate/get_all"
http
GET %7B%7Befirma_url%7D%7D/api/pdftemplate/get_all HTTP/1.1
    Host:
    X-eFirma-Auth: {"uid":"SU USER ID OBTENIDO DE LA PLATAFORMA","key":"SU API KEY DE LA PLATAFORMA"}