Create Data Request Authentication Token

Generate an authentication token for a data request. This authentication token will expire in one hour, so you should wait until your user is ready to sign the form.

See the Embedded Data Request Forms documentation for more information.

HTTP Request

POST https://app.formapi.io/api/v1/data_requests/<DATA_REQUEST_ID>/tokens

Authentication

You must send an Authorization header with the value Basic followed by base 64 encoded token_id:token_secret.

For example: Authorization: Basic dG9rZW5faWQ6dG9rZW5fc2VjcmV0Cg==

See the Authentication documentation for more information.

Example Response

{
  "status": "success",
  "token": {
    "id": "TOKEN_ID",
    "secret": "TOKEN_SECRET",
    "expires_at": "TIMESTAMP",
    "data_request_url": "https://app.formapi.io/data_requests/<DATA_REQUEST_ID>?token_id=TOKEN_ID&token_secret=TOKEN_SECRET"
  }
}

Example Code

var FormAPI = require("@formapi/formapi");

var config = new FormAPI.Configuration();
config.apiTokenId = "FORMAPI_TOKEN_ID";
config.apiTokenSecret = "FORMAPI_TOKEN_SECRET";
client = new FormAPI.Client(config);

client.createDataRequestToken("DATA_REQUEST_ID", function(error, token) {
  if (error) throw error;
  console.log(token);
});
require 'form_api'

FormAPI.configure do |c|
  c.username  = ENV['FORMAPI_TOKEN_ID']
  c.password  = ENV['FORMAPI_TOKEN_SECRET']
end

formapi = FormAPI::Client.new
response = formapi.create_data_request_token('DATA_REQUEST_ID')
puts response
import form_api

client = form_api.Client()
client.api_client.configuration.username = "FORMAPI_TOKEN_ID"
client.api_client.configuration.password = "FORMAPI_TOKEN_SECRET"

response = client.create_data_request_token('DATA_REQUEST_ID')
puts response
<?php
$formapi = new FormAPI\Client();
$formapi->getConfig()->setUsername("FORMAPI_TOKEN_ID");
$formapi->getConfig()->setPassword("FORMAPI_TOKEN_SECRET");

$response = $formapi->createDataRequestToken('DATA_REQUEST_ID');
echo $response;
using System;
using System.Diagnostics;
using FormApi.Client.Api;
using FormApi.Client.Client;
using FormApi.Client.Model;

namespace Example
{
    public class FormAPIExample
    {
        public void main()
        {
          Configuration.Default.Username = "FORMAPI_TOKEN_ID";
          Configuration.Default.Password = "FORMAPI_TOKEN_SECRET";

          var apiInstance = new PDFApi();
          string dataRequestId = "DATA_REQUEST_ID";
          DataRequestToken token = apiInstance.CreateDataRequestToken(dataRequestId);
          Debug.WriteLine(submission);
        }
    }
}
curl -s -X POST "https://app.formapi.io/api/v1/submissions/DATA_REQUEST_ID" \
  -u "YOUR_API_TOKEN_ID:YOUR_API_TOKEN_SECRET"

results matching ""

    No results matching ""